From f1ef7d85a89f4ac382b0634f752719357cf28870 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 07:39:46 -0600 Subject: [PATCH 01/21] =?UTF-8?q?T2345:=20Replace=20instances=20of=20NULL?= =?UTF-8?q?=20with=20nullptr=20The=20following=20changes=20have=20been=20a?= =?UTF-8?q?pplied=20to=20src=20and=20lib=20folders:=20regex=20replace:=20(?= =?UTF-8?q?[^"=5F])NULL=20=E2=87=92=20\1nullptr=20(8968=20chgs=20in=20src,?= =?UTF-8?q?=201153=20in=20lib)=20Manually=20find/change:=20(void=20\*)=20n?= =?UTF-8?q?ullptr=20=E2=87=92=20nullptr=20(1=20case)=20regex=20find:=20".*?= =?UTF-8?q?=3Fnullptr.*=3F"=20=20=20Manually=20~14=20cases=20back=20to=20"?= =?UTF-8?q?NULL"=20in=20src,=20~2=20in=20lib=20=20=20regex=20finds=20a=20f?= =?UTF-8?q?ew=20false=20positive=20where=20nullptr=20appears=20between=20t?= =?UTF-8?q?wo=20=20=20strings=20in=20a=20function=20call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/atc/ATC_Coupling.cpp | 50 +-- lib/atc/ATC_Coupling.h | 24 +- lib/atc/ATC_CouplingEnergy.cpp | 6 +- lib/atc/ATC_CouplingMomentumEnergy.cpp | 6 +- lib/atc/ATC_Method.cpp | 52 +-- lib/atc/ATC_Method.h | 2 +- lib/atc/ATC_Transfer.cpp | 22 +- lib/atc/Array.h | 28 +- lib/atc/Array2D.h | 20 +- lib/atc/AtomicRegulator.cpp | 36 +- lib/atc/AtomicRegulator.h | 2 +- lib/atc/CauchyBorn.cpp | 2 +- lib/atc/ChargeRegulator.cpp | 2 +- lib/atc/CloneVector.h | 6 +- lib/atc/ConcentrationRegulator.cpp | 8 +- lib/atc/DenseMatrix.h | 12 +- lib/atc/DenseVector.h | 8 +- lib/atc/DiagonalMatrix.h | 6 +- lib/atc/DislocationExtractor.h | 16 +- lib/atc/ElasticTimeIntegrator.cpp | 10 +- lib/atc/ElectronHeatFlux.h | 10 +- lib/atc/ExtrinsicModel.cpp | 6 +- lib/atc/ExtrinsicModelDriftDiffusion.cpp | 10 +- lib/atc/ExtrinsicModelElectrostatic.cpp | 10 +- lib/atc/ExtrinsicModelTwoTemperature.cpp | 4 +- lib/atc/FE_Element.cpp | 2 +- lib/atc/FE_Engine.cpp | 2 +- lib/atc/FE_Engine.h | 22 +- lib/atc/FE_Mesh.cpp | 12 +- lib/atc/FieldEulerIntegrator.cpp | 2 +- lib/atc/FieldManager.cpp | 2 +- lib/atc/FieldManager.h | 14 +- lib/atc/Function.cpp | 12 +- lib/atc/FundamentalAtomicQuantity.cpp | 2 +- lib/atc/FundamentalAtomicQuantity.h | 4 +- lib/atc/GhostManager.cpp | 26 +- lib/atc/InterscaleOperators.cpp | 8 +- lib/atc/InterscaleOperators.h | 4 +- lib/atc/KD_Tree.cpp | 14 +- lib/atc/KernelFunction.cpp | 6 +- lib/atc/KinetoThermostat.cpp | 48 +-- lib/atc/Kinetostat.cpp | 44 +-- lib/atc/LammpsInterface.cpp | 38 +-- lib/atc/LammpsInterface.h | 2 +- lib/atc/LinearSolver.cpp | 16 +- lib/atc/LinearSolver.h | 4 +- lib/atc/Material.cpp | 36 +- lib/atc/MoleculeSet.h | 8 +- lib/atc/NonLinearSolver.h | 2 +- lib/atc/OutputManager.cpp | 24 +- lib/atc/OutputManager.h | 6 +- lib/atc/PaqAtcUtility.cpp | 2 +- lib/atc/ParDenseMatrix.h | 2 +- lib/atc/ParSparseMatrix.cpp | 8 +- lib/atc/ParSparseMatrix.h | 6 +- lib/atc/PerAtomQuantity-inl.h | 10 +- lib/atc/PerAtomQuantity.h | 8 +- lib/atc/PerAtomQuantityLibrary.h | 130 +++---- lib/atc/PerPairQuantity.cpp | 2 +- lib/atc/PhysicsModel.h | 2 +- lib/atc/PoissonSolver.cpp | 6 +- lib/atc/PrescribedDataManager.cpp | 26 +- lib/atc/Quadrature.cpp | 6 +- lib/atc/SchrodingerSolver.cpp | 2 +- lib/atc/SparseMatrix-inl.h | 16 +- lib/atc/SparseVector.h | 2 +- lib/atc/SpeciesTimeIntegrator.cpp | 4 +- lib/atc/SpeciesTimeIntegrator.h | 2 +- lib/atc/Stress.cpp | 6 +- lib/atc/Stress.h | 2 +- lib/atc/ThermalTimeIntegrator.cpp | 4 +- lib/atc/Thermostat.cpp | 56 +-- lib/atc/TimeFilter.cpp | 2 +- lib/atc/TimeIntegrator.cpp | 12 +- lib/atc/TransferLibrary.cpp | 10 +- lib/atc/TransferLibrary.h | 34 +- lib/atc/TransferOperator.h | 6 +- lib/atc/Utility.h | 2 +- lib/awpmd/ivutils/include/logexc.h | 8 +- lib/awpmd/ivutils/include/pairhash.h | 28 +- lib/awpmd/ivutils/include/refobj.h | 20 +- lib/awpmd/ivutils/include/vector_3.h | 14 +- lib/awpmd/ivutils/src/logexc.cpp | 2 +- lib/awpmd/systems/interact/TCP/wpmd.h | 20 +- lib/awpmd/systems/interact/TCP/wpmd_split.cpp | 4 +- lib/awpmd/systems/interact/TCP/wpmd_split.h | 16 +- lib/colvars/colvar.cpp | 20 +- lib/colvars/colvaratoms.cpp | 8 +- lib/colvars/colvarbias.cpp | 26 +- lib/colvars/colvarbias.h | 4 +- lib/colvars/colvarbias_abf.cpp | 42 +-- lib/colvars/colvarbias_histogram.cpp | 4 +- lib/colvars/colvarbias_meta.cpp | 46 +-- lib/colvars/colvarcomp.cpp | 8 +- lib/colvars/colvarcomp_coordnums.cpp | 38 +-- lib/colvars/colvarcomp_distances.cpp | 2 +- lib/colvars/colvardeps.cpp | 2 +- lib/colvars/colvargrid.cpp | 14 +- lib/colvars/colvarmodule.cpp | 60 ++-- lib/colvars/colvarmodule.h | 6 +- lib/colvars/colvarparams.cpp | 6 +- lib/colvars/colvarparse.cpp | 10 +- lib/colvars/colvarparse.h | 8 +- lib/colvars/colvarproxy.cpp | 16 +- lib/colvars/colvarproxy.h | 2 +- lib/colvars/colvarscript.cpp | 20 +- lib/colvars/colvarscript.h | 2 +- lib/colvars/colvartypes.h | 4 +- lib/colvars/lepton/include/lepton/Operation.h | 12 +- lib/colvars/lepton/src/CompiledExpression.cpp | 8 +- lib/colvars/lepton/src/ExpressionTreeNode.cpp | 8 +- lib/colvars/lepton/src/ParsedExpression.cpp | 2 +- lib/gpu/cudpp_mini/cudpp.cpp | 14 +- lib/gpu/cudpp_mini/cudpp_plan.cpp | 2 +- lib/gpu/cudpp_mini/cudpp_plan_manager.cpp | 22 +- lib/gpu/cudpp_mini/cutil.h | 20 +- lib/gpu/geryon/hip_device.h | 4 +- lib/gpu/geryon/hip_kernel.h | 8 +- lib/gpu/geryon/hip_memory.h | 6 +- lib/gpu/geryon/hip_texture.h | 2 +- lib/gpu/geryon/nvd_kernel.h | 10 +- lib/gpu/geryon/nvd_memory.h | 6 +- lib/gpu/geryon/nvd_texture.h | 2 +- lib/gpu/geryon/ocl_device.h | 40 +-- lib/gpu/geryon/ocl_kernel.h | 26 +- lib/gpu/geryon/ocl_memory.h | 78 ++--- lib/gpu/geryon/ocl_timer.h | 6 +- lib/gpu/geryon/ucl_basemat.h | 4 +- lib/gpu/geryon/ucl_d_vec.h | 2 +- lib/gpu/lal_answer.cpp | 14 +- lib/gpu/lal_base_atomic.cpp | 10 +- lib/gpu/lal_base_charge.cpp | 10 +- lib/gpu/lal_base_dipole.cpp | 10 +- lib/gpu/lal_base_dpd.cpp | 10 +- lib/gpu/lal_base_ellipsoid.cpp | 16 +- lib/gpu/lal_base_three.cpp | 10 +- lib/gpu/lal_base_three.h | 2 +- lib/gpu/lal_device.cpp | 18 +- lib/gpu/lal_eam.cpp | 6 +- lib/gpu/lal_lj_tip4p_long.cpp | 4 +- lib/gpu/lal_neighbor.cpp | 2 +- lib/gpu/lal_pppm.cpp | 2 +- lib/gpu/lal_pppm_ext.cpp | 6 +- lib/gpu/lal_yukawa_colloid.cpp | 4 +- lib/kokkos/cmake/compile_tests/pthread.cpp | 6 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 2 +- lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp | 2 +- .../core/src/impl/Kokkos_SharedAlloc.cpp | 2 +- lib/kokkos/core/unit_test/TestCTestDevice.cpp | 2 +- lib/message/cslib/src/STUBS_ZMQ/zmq.h | 6 +- lib/message/cslib/src/cslib.cpp | 28 +- lib/message/cslib/src/cslib_wrap.cpp | 2 +- lib/message/cslib/src/msg.cpp | 6 +- lib/message/cslib/src/msg_mpi_two.cpp | 2 +- lib/message/cslib/src/msg_zmq.cpp | 8 +- lib/molfile/molfile_plugin.h | 32 +- lib/poems/SystemProcessor.h | 30 +- lib/poems/poemsnodelib.h | 20 +- lib/poems/poemstree.h | 62 ++-- lib/poems/poemstreenode.cpp | 2 +- lib/poems/poemstreenode.h | 2 +- lib/poems/solver.cpp | 2 +- lib/poems/system.cpp | 10 +- lib/poems/workspace.cpp | 6 +- src/ASPHERE/compute_temp_asphere.cpp | 4 +- src/ASPHERE/pair_gayberne.cpp | 24 +- src/ASPHERE/pair_line_lj.cpp | 4 +- src/ASPHERE/pair_resquared.cpp | 16 +- src/ASPHERE/pair_tri_lj.cpp | 4 +- src/BODY/body_nparticle.cpp | 4 +- src/BODY/body_rounded_polygon.cpp | 2 +- src/BODY/body_rounded_polyhedron.cpp | 4 +- src/BODY/compute_body_local.cpp | 6 +- src/BODY/compute_temp_body.cpp | 4 +- src/BODY/fix_wall_body_polygon.cpp | 14 +- src/BODY/fix_wall_body_polyhedron.cpp | 18 +- src/BODY/pair_body_nparticle.cpp | 4 +- src/BODY/pair_body_rounded_polygon.cpp | 16 +- src/BODY/pair_body_rounded_polyhedron.cpp | 32 +- src/CLASS2/angle_class2.cpp | 26 +- src/CLASS2/bond_class2.cpp | 10 +- src/CLASS2/dihedral_class2.cpp | 78 ++--- src/CLASS2/improper_class2.cpp | 18 +- src/CLASS2/pair_lj_class2.cpp | 20 +- src/CLASS2/pair_lj_class2_coul_cut.cpp | 22 +- src/CLASS2/pair_lj_class2_coul_long.cpp | 32 +- src/COLLOID/pair_brownian.cpp | 32 +- src/COLLOID/pair_brownian_poly.cpp | 2 +- src/COLLOID/pair_colloid.cpp | 18 +- src/COLLOID/pair_lubricate.cpp | 26 +- src/COLLOID/pair_lubricateU.cpp | 28 +- src/COLLOID/pair_lubricateU_poly.cpp | 2 +- src/COLLOID/pair_lubricate_poly.cpp | 4 +- src/COMPRESS/dump_atom_gz.cpp | 12 +- src/COMPRESS/dump_cfg_gz.cpp | 12 +- src/COMPRESS/dump_custom_gz.cpp | 12 +- src/COMPRESS/dump_local_gz.cpp | 12 +- src/COMPRESS/dump_xyz_gz.cpp | 12 +- src/CORESHELL/compute_temp_cs.cpp | 4 +- src/CORESHELL/pair_born_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_buck_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_lj_class2_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_lj_cut_coul_long_cs.cpp | 2 +- src/DIPOLE/pair_lj_cut_dipole_cut.cpp | 18 +- src/DIPOLE/pair_lj_cut_dipole_long.cpp | 20 +- src/DIPOLE/pair_lj_long_dipole_long.cpp | 32 +- src/GPU/fix_gpu.cpp | 4 +- src/GPU/pair_born_coul_long_cs_gpu.cpp | 2 +- src/GPU/pair_born_coul_long_gpu.cpp | 2 +- src/GPU/pair_buck_coul_long_gpu.cpp | 2 +- src/GPU/pair_colloid_gpu.cpp | 2 +- src/GPU/pair_coul_long_cs_gpu.cpp | 4 +- src/GPU/pair_coul_long_gpu.cpp | 4 +- src/GPU/pair_eam_alloy_gpu.cpp | 4 +- src/GPU/pair_eam_alloy_gpu.h | 2 +- src/GPU/pair_eam_fs_gpu.cpp | 4 +- src/GPU/pair_eam_fs_gpu.h | 2 +- src/GPU/pair_eam_gpu.cpp | 2 +- src/GPU/pair_eam_gpu.h | 2 +- src/GPU/pair_gayberne_gpu.cpp | 2 +- src/GPU/pair_lj96_cut_gpu.cpp | 2 +- src/GPU/pair_lj_charmm_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_class2_coul_long_gpu.cpp | 2 +- src/GPU/pair_lj_cut_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_cut_coul_msm_gpu.cpp | 2 +- src/GPU/pair_lj_cut_dipole_long_gpu.cpp | 4 +- src/GPU/pair_lj_cut_gpu.cpp | 2 +- src/GPU/pair_lj_cut_tip4p_long_gpu.cpp | 8 +- src/GPU/pair_lj_expand_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_sdk_coul_long_gpu.cpp | 4 +- src/GPU/pair_mie_cut_gpu.cpp | 2 +- src/GPU/pair_resquared_gpu.cpp | 2 +- src/GPU/pair_sw_gpu.cpp | 8 +- src/GPU/pair_table_gpu.cpp | 4 +- src/GPU/pair_tersoff_gpu.cpp | 12 +- src/GPU/pair_tersoff_mod_gpu.cpp | 12 +- src/GPU/pair_tersoff_zbl_gpu.cpp | 12 +- src/GPU/pair_ufm_gpu.cpp | 2 +- src/GPU/pair_vashishta_gpu.cpp | 12 +- src/GPU/pppm_gpu.cpp | 10 +- src/GRANULAR/fix_pour.cpp | 24 +- src/GRANULAR/fix_wall_gran.cpp | 18 +- src/GRANULAR/fix_wall_gran.h | 2 +- src/GRANULAR/fix_wall_gran_region.cpp | 16 +- src/GRANULAR/pair_gran_hooke_history.cpp | 22 +- src/GRANULAR/pair_gran_hooke_history.h | 2 +- src/GRANULAR/pair_granular.cpp | 40 +-- src/GRANULAR/pair_granular.h | 2 +- src/KIM/fix_store_kim.cpp | 14 +- src/KIM/fix_store_kim.h | 4 +- src/KIM/kim_init.cpp | 8 +- src/KIM/kim_interactions.cpp | 10 +- src/KIM/kim_param.cpp | 12 +- src/KIM/kim_property.cpp | 4 +- src/KIM/pair_kim.cpp | 44 +-- src/KOKKOS/atom_kokkos.cpp | 12 +- src/KOKKOS/atom_vec_angle_kokkos.cpp | 2 +- src/KOKKOS/atom_vec_kokkos.cpp | 2 +- src/KOKKOS/comm_kokkos.cpp | 14 +- src/KOKKOS/fft3d_kokkos.cpp | 52 +-- src/KOKKOS/fix_langevin_kokkos.cpp | 26 +- src/KOKKOS/fix_minimize_kokkos.cpp | 2 +- src/KOKKOS/fix_neigh_history_kokkos.cpp | 6 +- src/KOKKOS/fix_nve_kokkos.cpp | 4 +- src/KOKKOS/fix_nve_sphere_kokkos.cpp | 4 +- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 2 +- src/KOKKOS/fix_reaxc_bonds_kokkos.cpp | 2 +- src/KOKKOS/fix_reaxc_species_kokkos.cpp | 2 +- src/KOKKOS/fix_rx_kokkos.cpp | 12 +- src/KOKKOS/fix_rx_kokkos.h | 2 +- src/KOKKOS/fix_setforce_kokkos.cpp | 4 +- src/KOKKOS/fix_shardlow_kokkos.cpp | 8 +- src/KOKKOS/gridcomm_kokkos.cpp | 14 +- src/KOKKOS/kokkos.cpp | 2 +- src/KOKKOS/memory_kokkos.h | 26 +- src/KOKKOS/min_kokkos.cpp | 2 +- src/KOKKOS/neighbor_kokkos.cpp | 10 +- src/KOKKOS/pair_buck_coul_cut_kokkos.cpp | 16 +- src/KOKKOS/pair_buck_coul_long_kokkos.cpp | 24 +- src/KOKKOS/pair_buck_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_cut_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_debye_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_long_kokkos.cpp | 16 +- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_alloy_kokkos.h | 2 +- src/KOKKOS/pair_eam_fs_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_fs_kokkos.h | 2 +- src/KOKKOS/pair_eam_kokkos.h | 2 +- src/KOKKOS/pair_exp6_rx_kokkos.cpp | 12 +- src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 6 +- src/KOKKOS/pair_hybrid_kokkos.cpp | 2 +- src/KOKKOS/pair_kokkos.h | 2 +- ..._lj_charmm_coul_charmm_implicit_kokkos.cpp | 16 +- .../pair_lj_charmm_coul_charmm_kokkos.cpp | 16 +- .../pair_lj_charmm_coul_long_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp | 16 +- .../pair_lj_class2_coul_long_kokkos.cpp | 14 +- src/KOKKOS/pair_lj_class2_kokkos.cpp | 10 +- src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp | 18 +- src/KOKKOS/pair_lj_cut_kokkos.cpp | 14 +- src/KOKKOS/pair_lj_expand_kokkos.cpp | 10 +- .../pair_lj_gromacs_coul_gromacs_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_gromacs_kokkos.cpp | 26 +- src/KOKKOS/pair_lj_sdk_kokkos.cpp | 10 +- src/KOKKOS/pair_morse_kokkos.cpp | 14 +- src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp | 4 +- src/KOKKOS/pair_reaxc_kokkos.cpp | 6 +- src/KOKKOS/pair_sw_kokkos.cpp | 4 +- src/KOKKOS/pair_table_kokkos.cpp | 10 +- src/KOKKOS/pair_table_rx_kokkos.cpp | 10 +- src/KOKKOS/pair_vashishta_kokkos.cpp | 4 +- src/KOKKOS/pair_yukawa_kokkos.cpp | 14 +- src/KOKKOS/pair_zbl_kokkos.cpp | 12 +- src/KOKKOS/pppm_kokkos.cpp | 52 +-- src/KOKKOS/rand_pool_wrap_kokkos.cpp | 4 +- src/KOKKOS/rand_pool_wrap_kokkos.h | 2 +- src/KOKKOS/remap_kokkos.cpp | 26 +- src/KSPACE/ewald.cpp | 24 +- src/KSPACE/ewald_dipole.cpp | 8 +- src/KSPACE/ewald_dipole_spin.cpp | 2 +- src/KSPACE/ewald_disp.cpp | 58 ++-- src/KSPACE/fft3d.cpp | 58 ++-- src/KSPACE/fft3d_wrap.cpp | 2 +- src/KSPACE/gridcomm.cpp | 12 +- src/KSPACE/kissfft.h | 6 +- src/KSPACE/msm.cpp | 84 ++--- src/KSPACE/msm_cg.cpp | 2 +- src/KSPACE/pair_born_coul_long.cpp | 38 +-- src/KSPACE/pair_born_coul_msm.cpp | 4 +- src/KSPACE/pair_buck_coul_long.cpp | 30 +- src/KSPACE/pair_buck_coul_msm.cpp | 4 +- src/KSPACE/pair_buck_long_coul_long.cpp | 42 +-- src/KSPACE/pair_coul_long.cpp | 24 +- src/KSPACE/pair_coul_msm.cpp | 2 +- src/KSPACE/pair_lj_charmm_coul_long.cpp | 34 +- src/KSPACE/pair_lj_charmm_coul_msm.cpp | 4 +- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 34 +- src/KSPACE/pair_lj_cut_coul_long.cpp | 32 +- src/KSPACE/pair_lj_cut_coul_msm.cpp | 4 +- src/KSPACE/pair_lj_cut_tip4p_long.cpp | 36 +- src/KSPACE/pair_lj_long_coul_long.cpp | 40 +-- src/KSPACE/pair_lj_long_tip4p_long.cpp | 44 +-- src/KSPACE/pair_tip4p_long.cpp | 20 +- src/KSPACE/pppm.cpp | 66 ++-- src/KSPACE/pppm_cg.cpp | 2 +- src/KSPACE/pppm_dipole.cpp | 34 +- src/KSPACE/pppm_dipole_spin.cpp | 12 +- src/KSPACE/pppm_disp.cpp | 322 +++++++++--------- src/KSPACE/pppm_stagger.cpp | 2 +- src/KSPACE/remap.cpp | 28 +- src/KSPACE/remap_wrap.cpp | 2 +- src/LATTE/fix_latte.cpp | 12 +- src/MANYBODY/fix_qeq_comb.cpp | 10 +- src/MANYBODY/pair_adp.cpp | 40 +-- src/MANYBODY/pair_airebo.cpp | 14 +- src/MANYBODY/pair_airebo.h | 2 +- src/MANYBODY/pair_atm.cpp | 8 +- src/MANYBODY/pair_bop.cpp | 232 ++++++------- src/MANYBODY/pair_comb.cpp | 42 +-- src/MANYBODY/pair_comb3.cpp | 62 ++-- src/MANYBODY/pair_eam.cpp | 42 +-- src/MANYBODY/pair_eam_alloy.cpp | 2 +- src/MANYBODY/pair_eam_cd.cpp | 10 +- src/MANYBODY/pair_eam_cd.h | 2 +- src/MANYBODY/pair_eam_fs.cpp | 2 +- src/MANYBODY/pair_eim.cpp | 32 +- src/MANYBODY/pair_gw.cpp | 14 +- src/MANYBODY/pair_gw_zbl.cpp | 2 +- src/MANYBODY/pair_lcbop.cpp | 18 +- src/MANYBODY/pair_lcbop.h | 2 +- src/MANYBODY/pair_nb3b_harmonic.cpp | 12 +- src/MANYBODY/pair_polymorphic.cpp | 4 +- src/MANYBODY/pair_sw.cpp | 14 +- src/MANYBODY/pair_tersoff.cpp | 14 +- src/MANYBODY/pair_vashishta.cpp | 14 +- src/MANYBODY/pair_vashishta_table.cpp | 8 +- src/MC/fix_atom_swap.cpp | 14 +- src/MC/fix_bond_break.cpp | 4 +- src/MC/fix_bond_create.cpp | 14 +- src/MC/fix_bond_swap.cpp | 12 +- src/MC/fix_gcmc.cpp | 28 +- src/MC/fix_tfmc.cpp | 6 +- src/MC/fix_widom.cpp | 14 +- src/MC/pair_dsmc.cpp | 20 +- src/MESSAGE/fix_client_md.cpp | 2 +- src/MESSAGE/message.cpp | 2 +- src/MESSAGE/server_mc.cpp | 4 +- src/MESSAGE/server_md.cpp | 28 +- src/MISC/compute_ti.cpp | 12 +- src/MISC/dump_xtc.cpp | 50 +-- src/MISC/fix_deposit.cpp | 20 +- src/MISC/fix_efield.cpp | 12 +- src/MISC/fix_evaporate.cpp | 6 +- src/MISC/fix_gld.cpp | 4 +- src/MISC/fix_oneway.cpp | 2 +- src/MISC/fix_orient_bcc.cpp | 6 +- src/MISC/fix_orient_fcc.cpp | 8 +- src/MISC/fix_thermal_conductivity.cpp | 2 +- src/MISC/fix_ttm.cpp | 16 +- src/MISC/fix_viscosity.cpp | 2 +- src/MISC/pair_nm_cut.cpp | 22 +- src/MISC/pair_nm_cut_coul_cut.cpp | 26 +- src/MISC/pair_nm_cut_coul_long.cpp | 34 +- src/MISC/xdr_compat.cpp | 14 +- src/MLIAP/compute_mliap.cpp | 6 +- src/MLIAP/mliap_data.cpp | 8 +- src/MLIAP/mliap_data.h | 2 +- src/MLIAP/mliap_descriptor_snap.cpp | 20 +- src/MLIAP/mliap_model.cpp | 10 +- src/MLIAP/mliap_model_quadratic.h | 2 +- src/MOLECULE/angle_charmm.cpp | 8 +- src/MOLECULE/angle_cosine.cpp | 2 +- src/MOLECULE/angle_cosine_periodic.cpp | 6 +- src/MOLECULE/angle_cosine_squared.cpp | 8 +- src/MOLECULE/angle_harmonic.cpp | 8 +- src/MOLECULE/angle_table.cpp | 16 +- src/MOLECULE/atom_vec_angle.cpp | 2 +- src/MOLECULE/atom_vec_bond.cpp | 2 +- src/MOLECULE/atom_vec_full.cpp | 2 +- src/MOLECULE/atom_vec_molecular.cpp | 2 +- src/MOLECULE/bond_fene.cpp | 10 +- src/MOLECULE/bond_fene_expand.cpp | 10 +- src/MOLECULE/bond_gromos.cpp | 6 +- src/MOLECULE/bond_harmonic.cpp | 6 +- src/MOLECULE/bond_morse.cpp | 8 +- src/MOLECULE/bond_nonlinear.cpp | 8 +- src/MOLECULE/bond_quartic.cpp | 12 +- src/MOLECULE/bond_table.cpp | 16 +- src/MOLECULE/dihedral_charmm.cpp | 12 +- src/MOLECULE/dihedral_charmmfsw.cpp | 16 +- src/MOLECULE/dihedral_harmonic.cpp | 6 +- src/MOLECULE/dihedral_helix.cpp | 6 +- src/MOLECULE/dihedral_multi_harmonic.cpp | 10 +- src/MOLECULE/dihedral_opls.cpp | 8 +- src/MOLECULE/fix_cmap.cpp | 46 +-- src/MOLECULE/improper_cvff.cpp | 6 +- src/MOLECULE/improper_harmonic.cpp | 4 +- src/MOLECULE/improper_umbrella.cpp | 6 +- src/MOLECULE/pair_hbond_dreiding_lj.cpp | 2 +- src/MOLECULE/pair_lj_charmm_coul_charmm.cpp | 24 +- .../pair_lj_charmmfsw_coul_charmmfsh.cpp | 22 +- src/MOLECULE/pair_lj_cut_tip4p_cut.cpp | 40 +-- src/MOLECULE/pair_tip4p_cut.cpp | 22 +- src/MPIIO/dump_atom_mpiio.cpp | 2 +- src/MPIIO/dump_cfg_mpiio.cpp | 2 +- src/MPIIO/dump_custom_mpiio.cpp | 6 +- src/MPIIO/dump_xyz_mpiio.cpp | 4 +- src/MSCG/fix_mscg.cpp | 2 +- src/PERI/compute_damage_atom.cpp | 2 +- src/PERI/compute_dilatation_atom.cpp | 2 +- src/PERI/compute_plasticity_atom.cpp | 2 +- src/PERI/fix_peri_neigh.cpp | 38 +-- src/PERI/pair_peri_eps.cpp | 32 +- src/PERI/pair_peri_lps.cpp | 24 +- src/PERI/pair_peri_pmb.cpp | 20 +- src/PERI/pair_peri_ves.cpp | 34 +- src/POEMS/fix_poems.cpp | 44 +-- src/PYTHON/fix_python_move.cpp | 10 +- src/PYTHON/pair_python.cpp | 10 +- src/PYTHON/python_compat.h | 4 +- src/PYTHON/python_impl.cpp | 32 +- src/QEQ/fix_qeq.cpp | 56 +-- src/QEQ/fix_qeq_fire.cpp | 4 +- src/QEQ/fix_qeq_shielded.cpp | 4 +- src/QEQ/fix_qeq_slater.cpp | 6 +- src/REPLICA/compute_event_displace.cpp | 14 +- src/REPLICA/fix_event.cpp | 4 +- src/REPLICA/fix_hyper.cpp | 2 +- src/REPLICA/fix_hyper_global.cpp | 10 +- src/REPLICA/fix_hyper_local.cpp | 40 +-- src/REPLICA/fix_neb.cpp | 18 +- src/REPLICA/hyper.cpp | 8 +- src/REPLICA/neb.cpp | 8 +- src/REPLICA/prd.cpp | 22 +- src/REPLICA/tad.cpp | 16 +- src/REPLICA/temper.cpp | 2 +- src/REPLICA/verlet_split.cpp | 6 +- src/RIGID/compute_erotate_rigid.cpp | 2 +- src/RIGID/compute_ke_rigid.cpp | 2 +- src/RIGID/compute_rigid_local.cpp | 10 +- src/RIGID/fix_ehex.cpp | 12 +- src/RIGID/fix_rattle.cpp | 2 +- src/RIGID/fix_rigid.cpp | 56 +-- src/RIGID/fix_rigid_nh.cpp | 20 +- src/RIGID/fix_rigid_nh_small.cpp | 20 +- src/RIGID/fix_rigid_small.cpp | 54 +-- src/RIGID/fix_shake.cpp | 42 +-- src/SHOCK/fix_append_atoms.cpp | 10 +- src/SHOCK/fix_msst.cpp | 16 +- src/SHOCK/fix_nphug.cpp | 2 +- src/SHOCK/fix_wall_piston.cpp | 6 +- src/SNAP/compute_sna_atom.cpp | 12 +- src/SNAP/compute_snad_atom.cpp | 12 +- src/SNAP/compute_snap.cpp | 12 +- src/SNAP/compute_snav_atom.cpp | 12 +- src/SNAP/pair_snap.cpp | 34 +- src/SNAP/sna.cpp | 20 +- src/SPIN/compute_spin.cpp | 2 +- src/SPIN/fix_langevin_spin.cpp | 2 +- src/SPIN/fix_neb_spin.cpp | 24 +- src/SPIN/fix_nve_spin.cpp | 6 +- src/SPIN/fix_precession_spin.cpp | 4 +- src/SPIN/fix_setforce_spin.cpp | 6 +- src/SPIN/min_spin_cg.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/SPIN/neb_spin.cpp | 8 +- src/SPIN/pair_spin.cpp | 2 +- src/SPIN/pair_spin.h | 2 +- src/SPIN/pair_spin_dipole_cut.cpp | 10 +- src/SPIN/pair_spin_dipole_long.cpp | 12 +- src/SPIN/pair_spin_dmi.cpp | 26 +- src/SPIN/pair_spin_exchange.cpp | 20 +- src/SPIN/pair_spin_magelec.cpp | 20 +- src/SPIN/pair_spin_neel.cpp | 28 +- src/SRD/fix_srd.cpp | 42 +-- src/SRD/fix_wall_srd.cpp | 2 +- src/STUBS/mpi.h | 4 +- src/USER-ADIOS/dump_atom_adios.cpp | 2 +- src/USER-ADIOS/dump_custom_adios.cpp | 2 +- src/USER-ADIOS/reader_adios.cpp | 4 +- src/USER-ATC/fix_atc.cpp | 2 +- src/USER-AWPMD/pair_awpmd_cut.cpp | 20 +- src/USER-BOCS/compute_pressure_bocs.cpp | 16 +- src/USER-BOCS/fix_bocs.cpp | 30 +- src/USER-CGDNA/bond_oxdna_fene.cpp | 6 +- src/USER-CGDNA/pair_oxdna2_coaxstk.cpp | 82 ++--- src/USER-CGDNA/pair_oxdna2_dh.cpp | 20 +- src/USER-CGDNA/pair_oxdna_coaxstk.cpp | 94 ++--- src/USER-CGDNA/pair_oxdna_excv.cpp | 40 +-- src/USER-CGDNA/pair_oxdna_hbond.cpp | 104 +++--- src/USER-CGDNA/pair_oxdna_stk.cpp | 86 ++--- src/USER-CGDNA/pair_oxdna_xstk.cpp | 100 +++--- src/USER-CGDNA/pair_oxrna2_stk.cpp | 98 +++--- src/USER-CGDNA/pair_oxrna2_xstk.cpp | 88 ++--- src/USER-CGSDK/angle_sdk.cpp | 8 +- src/USER-CGSDK/pair_lj_sdk.cpp | 20 +- src/USER-CGSDK/pair_lj_sdk_coul_long.cpp | 32 +- src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp | 4 +- src/USER-COLVARS/colvarproxy_lammps.cpp | 4 +- src/USER-COLVARS/fix_colvars.cpp | 26 +- src/USER-COLVARS/group_ndx.cpp | 2 +- src/USER-COLVARS/ndx_group.cpp | 34 +- src/USER-DIFFRACTION/compute_saed.cpp | 2 +- src/USER-DIFFRACTION/compute_xrd.cpp | 2 +- src/USER-DIFFRACTION/fix_saed_vtk.cpp | 18 +- src/USER-DPD/compute_dpd_atom.cpp | 2 +- src/USER-DPD/fix_dpd_energy.cpp | 6 +- src/USER-DPD/fix_eos_table.cpp | 20 +- src/USER-DPD/fix_eos_table_rx.cpp | 42 +-- src/USER-DPD/fix_rx.cpp | 98 +++--- src/USER-DPD/fix_shardlow.cpp | 16 +- src/USER-DPD/npair_half_bin_newton_ssa.cpp | 6 +- src/USER-DPD/pair_dpd_fdt.cpp | 18 +- src/USER-DPD/pair_dpd_fdt_energy.cpp | 22 +- src/USER-DPD/pair_exp6_rx.cpp | 50 +-- src/USER-DPD/pair_multi_lucy.cpp | 36 +- src/USER-DPD/pair_multi_lucy_rx.cpp | 44 +-- src/USER-DPD/pair_table_rx.cpp | 14 +- src/USER-DRUDE/compute_temp_drude.cpp | 6 +- src/USER-DRUDE/fix_drude.cpp | 12 +- src/USER-DRUDE/fix_drude_transform.cpp | 4 +- src/USER-DRUDE/fix_langevin_drude.cpp | 12 +- src/USER-DRUDE/pair_lj_cut_thole_long.cpp | 40 +-- src/USER-DRUDE/pair_thole.cpp | 20 +- src/USER-EFF/compute_ke_atom_eff.cpp | 2 +- src/USER-EFF/compute_temp_deform_eff.cpp | 2 +- src/USER-EFF/compute_temp_region_eff.cpp | 2 +- src/USER-EFF/fix_langevin_eff.cpp | 4 +- src/USER-EFF/pair_eff_cut.cpp | 14 +- src/USER-FEP/compute_fep.cpp | 24 +- src/USER-FEP/fix_adapt_fep.cpp | 16 +- src/USER-FEP/pair_coul_cut_soft.cpp | 18 +- src/USER-FEP/pair_coul_long_soft.cpp | 18 +- .../pair_lj_charmm_coul_long_soft.cpp | 36 +- src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp | 32 +- .../pair_lj_class2_coul_long_soft.cpp | 32 +- src/USER-FEP/pair_lj_class2_soft.cpp | 24 +- src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp | 32 +- src/USER-FEP/pair_lj_cut_coul_long_soft.cpp | 34 +- src/USER-FEP/pair_lj_cut_soft.cpp | 26 +- src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp | 32 +- src/USER-FEP/pair_morse_soft.cpp | 22 +- src/USER-FEP/pair_tip4p_long_soft.cpp | 20 +- src/USER-H5MD/dump_h5md.cpp | 40 +-- src/USER-INTEL/angle_charmm_intel.h | 2 +- src/USER-INTEL/angle_harmonic_intel.h | 2 +- src/USER-INTEL/bond_fene_intel.h | 2 +- src/USER-INTEL/bond_harmonic_intel.h | 2 +- src/USER-INTEL/dihedral_charmm_intel.h | 2 +- src/USER-INTEL/dihedral_fourier_intel.h | 2 +- src/USER-INTEL/dihedral_harmonic_intel.h | 2 +- src/USER-INTEL/dihedral_opls_intel.h | 2 +- src/USER-INTEL/fix_intel.cpp | 20 +- src/USER-INTEL/fix_intel.h | 4 +- src/USER-INTEL/improper_cvff_intel.h | 2 +- src/USER-INTEL/improper_harmonic_intel.h | 2 +- src/USER-INTEL/intel_buffers.cpp | 40 +-- src/USER-INTEL/intel_buffers.h | 4 +- src/USER-INTEL/intel_preprocess.h | 2 +- src/USER-INTEL/nbin_intel.cpp | 4 +- src/USER-INTEL/npair_full_bin_ghost_intel.cpp | 4 +- src/USER-INTEL/npair_intel.cpp | 4 +- src/USER-INTEL/pair_airebo_intel.cpp | 18 +- src/USER-INTEL/pair_buck_coul_cut_intel.cpp | 8 +- src/USER-INTEL/pair_buck_coul_cut_intel.h | 2 +- src/USER-INTEL/pair_buck_coul_long_intel.cpp | 16 +- src/USER-INTEL/pair_buck_coul_long_intel.h | 2 +- src/USER-INTEL/pair_buck_intel.cpp | 8 +- src/USER-INTEL/pair_buck_intel.h | 2 +- src/USER-INTEL/pair_dpd_intel.cpp | 2 +- src/USER-INTEL/pair_dpd_intel.h | 2 +- src/USER-INTEL/pair_eam_alloy_intel.cpp | 2 +- src/USER-INTEL/pair_eam_fs_intel.cpp | 2 +- src/USER-INTEL/pair_eam_intel.h | 2 +- src/USER-INTEL/pair_gayberne_intel.cpp | 16 +- src/USER-INTEL/pair_gayberne_intel.h | 2 +- .../pair_lj_charmm_coul_charmm_intel.cpp | 8 +- .../pair_lj_charmm_coul_charmm_intel.h | 2 +- .../pair_lj_charmm_coul_long_intel.cpp | 14 +- .../pair_lj_charmm_coul_long_intel.h | 2 +- .../pair_lj_cut_coul_long_intel.cpp | 18 +- src/USER-INTEL/pair_lj_cut_coul_long_intel.h | 2 +- src/USER-INTEL/pair_lj_cut_intel.cpp | 2 +- src/USER-INTEL/pair_lj_cut_intel.h | 2 +- .../pair_lj_long_coul_long_intel.cpp | 2 +- src/USER-INTEL/pair_sw_intel.cpp | 8 +- src/USER-INTEL/pair_sw_intel.h | 2 +- src/USER-INTEL/pair_tersoff_intel.cpp | 8 +- src/USER-INTEL/pair_tersoff_intel.h | 2 +- src/USER-INTEL/pppm_disp_intel.cpp | 24 +- src/USER-INTEL/pppm_intel.cpp | 6 +- src/USER-INTEL/verlet_lrt_intel.cpp | 10 +- src/USER-LB/fix_lb_fluid.cpp | 46 +-- src/USER-LB/fix_lb_pc.cpp | 6 +- src/USER-LB/fix_lb_rigid_pc_sphere.cpp | 4 +- src/USER-LB/fix_lb_viscous.cpp | 2 +- src/USER-MANIFOLD/fix_manifoldforce.cpp | 2 +- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 2 +- src/USER-MANIFOLD/fix_nve_manifold_rattle.h | 4 +- src/USER-MANIFOLD/fix_nvt_manifold_rattle.h | 4 +- src/USER-MANIFOLD/manifold.h | 2 +- src/USER-MANIFOLD/manifold_factory.cpp | 2 +- src/USER-MANIFOLD/manifold_factory.h | 2 +- src/USER-MANIFOLD/manifold_gaussian_bump.cpp | 2 +- src/USER-MANIFOLD/manifold_thylakoid.cpp | 4 +- src/USER-MANIFOLD/manifold_thylakoid.h | 2 +- src/USER-MEAMC/meam_impl.cpp | 10 +- src/USER-MEAMC/meam_setup_done.cpp | 16 +- src/USER-MEAMC/pair_meamc.cpp | 26 +- src/USER-MESODPD/compute_edpd_temp_atom.cpp | 2 +- src/USER-MESODPD/compute_tdpd_cc_atom.cpp | 2 +- src/USER-MESODPD/pair_edpd.cpp | 30 +- src/USER-MESODPD/pair_mdpd.cpp | 22 +- src/USER-MESODPD/pair_tdpd.cpp | 28 +- src/USER-MESONT/compute_mesont.cpp | 6 +- src/USER-MESONT/pair_mesocnt.cpp | 8 +- src/USER-MESONT/pair_mesont_tpm.cpp | 18 +- src/USER-MGPT/mgpt_readpot.cpp | 6 +- src/USER-MGPT/mgpt_readpot.h | 6 +- src/USER-MGPT/pair_mgpt.cpp | 6 +- src/USER-MISC/angle_cosine_shift.cpp | 10 +- src/USER-MISC/angle_cosine_shift_exp.cpp | 24 +- src/USER-MISC/angle_dipole.cpp | 8 +- src/USER-MISC/angle_fourier.cpp | 16 +- src/USER-MISC/angle_fourier_simple.cpp | 12 +- src/USER-MISC/angle_quartic.cpp | 8 +- src/USER-MISC/bond_harmonic_shift.cpp | 6 +- src/USER-MISC/bond_harmonic_shift_cut.cpp | 6 +- src/USER-MISC/bond_special.cpp | 4 +- src/USER-MISC/compute_ackland_atom.cpp | 10 +- src/USER-MISC/compute_basal_atom.cpp | 10 +- src/USER-MISC/compute_cnp_atom.cpp | 4 +- src/USER-MISC/compute_entropy_atom.cpp | 4 +- src/USER-MISC/compute_gyration_shape.cpp | 2 +- .../compute_gyration_shape_chunk.cpp | 2 +- src/USER-MISC/compute_hma.cpp | 6 +- src/USER-MISC/compute_pressure_cylinder.cpp | 10 +- src/USER-MISC/compute_pressure_grem.cpp | 2 +- src/USER-MISC/compute_stress_mop.cpp | 14 +- src/USER-MISC/compute_stress_mop_profile.cpp | 16 +- src/USER-MISC/compute_temp_rotate.cpp | 2 +- src/USER-MISC/compute_viscosity_cos.cpp | 2 +- src/USER-MISC/dihedral_cosine_shift_exp.cpp | 10 +- src/USER-MISC/dihedral_fourier.cpp | 8 +- src/USER-MISC/dihedral_nharmonic.cpp | 4 +- src/USER-MISC/dihedral_quadratic.cpp | 4 +- src/USER-MISC/dihedral_spherical.cpp | 42 +-- src/USER-MISC/dihedral_table.cpp | 14 +- src/USER-MISC/dihedral_table_cut.cpp | 34 +- src/USER-MISC/fix_addtorque.cpp | 2 +- src/USER-MISC/fix_ave_correlate_long.cpp | 8 +- src/USER-MISC/fix_electron_stopping.cpp | 12 +- src/USER-MISC/fix_ffl.cpp | 6 +- src/USER-MISC/fix_filter_corotate.cpp | 32 +- src/USER-MISC/fix_gle.cpp | 26 +- src/USER-MISC/fix_grem.cpp | 8 +- src/USER-MISC/fix_imd.cpp | 72 ++-- src/USER-MISC/fix_ipi.cpp | 2 +- src/USER-MISC/fix_npt_cauchy.cpp | 18 +- src/USER-MISC/fix_orient_eco.cpp | 4 +- src/USER-MISC/fix_pafi.cpp | 4 +- src/USER-MISC/fix_pimd.cpp | 30 +- src/USER-MISC/fix_propel_self.cpp | 2 +- src/USER-MISC/fix_srp.cpp | 4 +- src/USER-MISC/fix_ti_spring.cpp | 2 +- src/USER-MISC/fix_ttm_mod.cpp | 16 +- src/USER-MISC/fix_wall_reflect_stochastic.cpp | 2 +- src/USER-MISC/improper_cossq.cpp | 4 +- src/USER-MISC/improper_distance.cpp | 4 +- src/USER-MISC/improper_fourier.cpp | 10 +- src/USER-MISC/improper_ring.cpp | 4 +- src/USER-MISC/pair_agni.cpp | 22 +- src/USER-MISC/pair_buck_mdf.cpp | 24 +- src/USER-MISC/pair_cosine_squared.cpp | 12 +- src/USER-MISC/pair_coul_diel.cpp | 14 +- src/USER-MISC/pair_coul_shield.cpp | 12 +- src/USER-MISC/pair_coul_slater_long.cpp | 8 +- src/USER-MISC/pair_drip.cpp | 26 +- src/USER-MISC/pair_e3b.cpp | 12 +- src/USER-MISC/pair_edip.cpp | 32 +- src/USER-MISC/pair_edip_multi.cpp | 20 +- src/USER-MISC/pair_extep.cpp | 38 +-- src/USER-MISC/pair_gauss_cut.cpp | 16 +- src/USER-MISC/pair_ilp_graphene_hbn.cpp | 38 +-- src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 38 +-- src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 22 +- src/USER-MISC/pair_lebedeva_z.cpp | 22 +- src/USER-MISC/pair_lennard_mdf.cpp | 18 +- src/USER-MISC/pair_list.cpp | 34 +- src/USER-MISC/pair_lj_expand_coul_long.cpp | 34 +- src/USER-MISC/pair_lj_mdf.cpp | 14 +- src/USER-MISC/pair_lj_sf_dipole_sf.cpp | 20 +- src/USER-MISC/pair_local_density.cpp | 46 +-- src/USER-MISC/pair_meam_spline.cpp | 44 +-- src/USER-MISC/pair_meam_spline.h | 4 +- src/USER-MISC/pair_meam_sw_spline.cpp | 24 +- src/USER-MISC/pair_meam_sw_spline.h | 4 +- src/USER-MISC/pair_momb.cpp | 24 +- src/USER-MISC/pair_morse_smooth_linear.cpp | 16 +- src/USER-MISC/pair_srp.cpp | 20 +- src/USER-MISC/pair_tersoff_table.cpp | 4 +- src/USER-MISC/temper_grem.cpp | 2 +- src/USER-MISC/temper_npt.cpp | 2 +- src/USER-MOFFF/angle_class2_p6.cpp | 30 +- src/USER-MOFFF/angle_cosine_buck6d.cpp | 8 +- .../improper_inversion_harmonic.cpp | 4 +- src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp | 28 +- .../pair_buck6d_coul_gauss_long.cpp | 32 +- src/USER-MOLFILE/dump_molfile.cpp | 14 +- src/USER-MOLFILE/molfile_interface.cpp | 96 +++--- src/USER-MOLFILE/reader_molfile.cpp | 14 +- src/USER-NETCDF/dump_netcdf.cpp | 8 +- src/USER-NETCDF/dump_netcdf_mpiio.cpp | 10 +- src/USER-OMP/bond_class2_omp.cpp | 2 +- src/USER-OMP/bond_fene_expand_omp.cpp | 2 +- src/USER-OMP/bond_fene_omp.cpp | 2 +- src/USER-OMP/bond_gromos_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_shift_cut_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_shift_omp.cpp | 2 +- src/USER-OMP/bond_morse_omp.cpp | 2 +- src/USER-OMP/bond_nonlinear_omp.cpp | 2 +- src/USER-OMP/bond_quartic_omp.cpp | 2 +- src/USER-OMP/bond_table_omp.cpp | 2 +- src/USER-OMP/ewald_omp.cpp | 2 +- src/USER-OMP/fix_neigh_history_omp.cpp | 8 +- src/USER-OMP/fix_omp.cpp | 18 +- src/USER-OMP/fix_qeq_comb_omp.cpp | 6 +- src/USER-OMP/fix_qeq_reax_omp.cpp | 4 +- src/USER-OMP/msm_cg_omp.cpp | 2 +- src/USER-OMP/pair_adp_omp.cpp | 2 +- src/USER-OMP/pair_agni_omp.cpp | 2 +- src/USER-OMP/pair_airebo_omp.cpp | 2 +- src/USER-OMP/pair_beck_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_born_omp.cpp | 2 +- src/USER-OMP/pair_brownian_omp.cpp | 10 +- src/USER-OMP/pair_brownian_poly_omp.cpp | 10 +- src/USER-OMP/pair_buck_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_buck_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_buck_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_buck_long_coul_long_omp.cpp | 10 +- src/USER-OMP/pair_buck_omp.cpp | 2 +- src/USER-OMP/pair_colloid_omp.cpp | 2 +- src/USER-OMP/pair_comb_omp.cpp | 2 +- src/USER-OMP/pair_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_coul_cut_soft_omp.cpp | 2 +- src/USER-OMP/pair_coul_debye_omp.cpp | 2 +- src/USER-OMP/pair_coul_diel_omp.cpp | 2 +- src/USER-OMP/pair_coul_dsf_omp.cpp | 2 +- src/USER-OMP/pair_coul_long_omp.cpp | 4 +- src/USER-OMP/pair_coul_long_soft_omp.cpp | 2 +- src/USER-OMP/pair_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_dpd_omp.cpp | 10 +- src/USER-OMP/pair_dpd_tstat_omp.cpp | 10 +- src/USER-OMP/pair_eam_alloy_omp.cpp | 2 +- src/USER-OMP/pair_eam_fs_omp.cpp | 2 +- src/USER-OMP/pair_eam_omp.cpp | 2 +- src/USER-OMP/pair_edip_omp.cpp | 2 +- src/USER-OMP/pair_eim_omp.cpp | 2 +- src/USER-OMP/pair_gauss_cut_omp.cpp | 2 +- src/USER-OMP/pair_gauss_omp.cpp | 2 +- src/USER-OMP/pair_gayberne_omp.cpp | 2 +- src/USER-OMP/pair_gran_hertz_history_omp.cpp | 2 +- src/USER-OMP/pair_gran_hooke_history_omp.cpp | 2 +- src/USER-OMP/pair_gran_hooke_omp.cpp | 2 +- src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp | 4 +- .../pair_hbond_dreiding_morse_omp.cpp | 4 +- src/USER-OMP/pair_lj96_cut_omp.cpp | 4 +- ...air_lj_charmm_coul_charmm_implicit_omp.cpp | 2 +- .../pair_lj_charmm_coul_charmm_omp.cpp | 2 +- src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp | 4 +- .../pair_lj_charmm_coul_long_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_lj_class2_coul_long_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_omp.cpp | 2 +- src/USER-OMP/pair_lj_cubic_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp | 2 +- .../pair_lj_cut_coul_cut_soft_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_long_omp.cpp | 4 +- .../pair_lj_cut_coul_long_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_thole_long_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp | 6 +- src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp | 6 +- .../pair_lj_cut_tip4p_long_soft_omp.cpp | 6 +- src/USER-OMP/pair_lj_expand_omp.cpp | 2 +- .../pair_lj_gromacs_coul_gromacs_omp.cpp | 2 +- src/USER-OMP/pair_lj_gromacs_omp.cpp | 2 +- src/USER-OMP/pair_lj_long_coul_long_omp.cpp | 10 +- src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp | 14 +- src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_lj_sdk_omp.cpp | 2 +- src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp | 2 +- src/USER-OMP/pair_lj_smooth_linear_omp.cpp | 2 +- src/USER-OMP/pair_lj_smooth_omp.cpp | 2 +- src/USER-OMP/pair_lubricate_omp.cpp | 2 +- src/USER-OMP/pair_lubricate_poly_omp.cpp | 2 +- src/USER-OMP/pair_meam_spline_omp.cpp | 2 +- src/USER-OMP/pair_morse_omp.cpp | 2 +- src/USER-OMP/pair_morse_smooth_linear_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_omp.cpp | 2 +- src/USER-OMP/pair_peri_lps_omp.cpp | 2 +- src/USER-OMP/pair_peri_pmb_omp.cpp | 2 +- src/USER-OMP/pair_reaxc_omp.cpp | 4 +- src/USER-OMP/pair_resquared_omp.cpp | 2 +- src/USER-OMP/pair_soft_omp.cpp | 2 +- src/USER-OMP/pair_sw_omp.cpp | 2 +- src/USER-OMP/pair_table_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_mod_c_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_mod_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_table_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_cut_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_long_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_long_soft_omp.cpp | 6 +- src/USER-OMP/pair_ufm_omp.cpp | 2 +- src/USER-OMP/pair_vashishta_omp.cpp | 2 +- src/USER-OMP/pair_vashishta_table_omp.cpp | 2 +- src/USER-OMP/pair_yukawa_colloid_omp.cpp | 2 +- src/USER-OMP/pair_yukawa_omp.cpp | 2 +- src/USER-OMP/pair_zbl_omp.cpp | 2 +- src/USER-OMP/reaxc_bonds_omp.cpp | 2 +- src/USER-OMP/reaxc_forces_omp.cpp | 2 +- src/USER-OMP/thr_data.cpp | 18 +- src/USER-OMP/thr_data.h | 4 +- src/USER-OMP/thr_omp.cpp | 6 +- src/USER-PHONON/dynamical_matrix.cpp | 6 +- src/USER-PHONON/fix_phonon.cpp | 26 +- src/USER-PHONON/third_order.cpp | 6 +- src/USER-PLUMED/fix_plumed.cpp | 8 +- src/USER-PTM/compute_ptm_atom.cpp | 8 +- src/USER-PTM/ptm_index.cpp | 22 +- src/USER-PTM/ptm_initialize_data.h | 90 ++--- src/USER-QMMM/fix_qmmm.cpp | 18 +- src/USER-QTB/fix_qbmsst.cpp | 28 +- src/USER-QTB/fix_qtb.cpp | 22 +- src/USER-QUIP/pair_quip.cpp | 8 +- src/USER-REACTION/fix_bond_react.cpp | 64 ++-- src/USER-REAXC/compute_spec_atom.cpp | 4 +- src/USER-REAXC/fix_qeq_reax.cpp | 46 +-- src/USER-REAXC/fix_reaxc.cpp | 4 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 12 +- src/USER-REAXC/fix_reaxc_species.cpp | 50 +-- src/USER-REAXC/pair_reaxc.cpp | 16 +- src/USER-REAXC/reaxc_allocate.cpp | 8 +- src/USER-REAXC/reaxc_control.cpp | 2 +- src/USER-REAXC/reaxc_io_tools.cpp | 8 +- src/USER-REAXC/reaxc_list.cpp | 18 +- src/USER-REAXC/reaxc_tool_box.cpp | 18 +- src/USER-REAXC/reaxc_traj.cpp | 4 +- src/USER-SCAFACOS/scafacos.cpp | 8 +- src/USER-SDPD/fix_meso_move.cpp | 26 +- .../pair_sdpd_taitwater_isothermal.cpp | 2 +- src/USER-SMD/compute_smd_contact_radius.cpp | 2 +- src/USER-SMD/compute_smd_damage.cpp | 2 +- src/USER-SMD/compute_smd_hourglass_error.cpp | 4 +- src/USER-SMD/compute_smd_internal_energy.cpp | 2 +- src/USER-SMD/compute_smd_plastic_strain.cpp | 2 +- .../compute_smd_plastic_strain_rate.cpp | 2 +- src/USER-SMD/compute_smd_rho.cpp | 2 +- src/USER-SMD/compute_smd_tlsph_defgrad.cpp | 2 +- src/USER-SMD/compute_smd_tlsph_dt.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_num_neighs.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_shape.cpp | 6 +- src/USER-SMD/compute_smd_tlsph_strain.cpp | 4 +- .../compute_smd_tlsph_strain_rate.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_stress.cpp | 4 +- .../compute_smd_triangle_vertices.cpp | 2 +- src/USER-SMD/compute_smd_ulsph_effm.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_num_neighs.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_strain.cpp | 2 +- .../compute_smd_ulsph_strain_rate.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_stress.cpp | 4 +- src/USER-SMD/compute_smd_vol.cpp | 2 +- src/USER-SMD/fix_smd_adjust_dt.cpp | 14 +- src/USER-SMD/fix_smd_integrate_tlsph.cpp | 2 +- src/USER-SMD/fix_smd_integrate_ulsph.cpp | 6 +- src/USER-SMD/fix_smd_setvel.cpp | 6 +- .../fix_smd_tlsph_reference_configuration.cpp | 18 +- src/USER-SMD/fix_smd_wall_surface.cpp | 36 +- src/USER-SMD/pair_smd_hertz.cpp | 8 +- src/USER-SMD/pair_smd_tlsph.cpp | 30 +- .../pair_smd_triangulated_surface.cpp | 8 +- src/USER-SMD/pair_smd_ulsph.cpp | 30 +- src/USER-SMTBQ/pair_smtbq.cpp | 84 ++--- src/USER-SPH/compute_sph_e_atom.cpp | 2 +- src/USER-SPH/compute_sph_rho_atom.cpp | 2 +- src/USER-SPH/compute_sph_t_atom.cpp | 2 +- src/USER-TALLY/compute_force_tally.cpp | 4 +- src/USER-TALLY/compute_heat_flux_tally.cpp | 6 +- src/USER-TALLY/compute_pe_mol_tally.cpp | 2 +- src/USER-TALLY/compute_pe_tally.cpp | 4 +- src/USER-TALLY/compute_stress_tally.cpp | 4 +- src/USER-UEF/fix_nh_uef.cpp | 2 +- src/USER-VTK/dump_vtk.cpp | 44 +-- src/USER-YAFF/angle_cross.cpp | 12 +- src/USER-YAFF/angle_mm3.cpp | 4 +- src/USER-YAFF/bond_mm3.cpp | 4 +- src/USER-YAFF/improper_distharm.cpp | 4 +- src/USER-YAFF/improper_sqdistharm.cpp | 4 +- .../pair_lj_switch3_coulgauss_long.cpp | 34 +- .../pair_mm3_switch3_coulgauss_long.cpp | 34 +- src/VORONOI/compute_voronoi_atom.cpp | 28 +- src/angle.cpp | 8 +- src/angle_hybrid.cpp | 8 +- src/angle_zero.cpp | 2 +- src/atom.cpp | 238 ++++++------- src/atom.h | 2 +- src/atom_map.cpp | 8 +- src/atom_vec.cpp | 4 +- src/atom_vec_body.cpp | 8 +- src/atom_vec_ellipsoid.cpp | 4 +- src/atom_vec_hybrid.cpp | 10 +- src/atom_vec_line.cpp | 4 +- src/atom_vec_tri.cpp | 4 +- src/balance.cpp | 26 +- src/body.cpp | 4 +- src/bond.cpp | 10 +- src/bond.h | 2 +- src/bond_hybrid.cpp | 8 +- src/bond_zero.cpp | 4 +- src/citeme.cpp | 2 +- src/comm.cpp | 34 +- src/comm.h | 4 +- src/comm_brick.cpp | 28 +- src/comm_tiled.cpp | 48 +-- src/compute.cpp | 8 +- src/compute_adf.cpp | 24 +- src/compute_aggregate_atom.cpp | 6 +- src/compute_angle.cpp | 2 +- src/compute_angle_local.cpp | 10 +- src/compute_angmom_chunk.cpp | 2 +- src/compute_bond.cpp | 2 +- src/compute_bond_local.cpp | 10 +- src/compute_centro_atom.cpp | 4 +- src/compute_centroid_stress_atom.cpp | 6 +- src/compute_chunk_atom.cpp | 44 +-- src/compute_chunk_atom.h | 2 +- src/compute_chunk_spread_atom.cpp | 8 +- src/compute_cluster_atom.cpp | 4 +- src/compute_cna_atom.cpp | 4 +- src/compute_com_chunk.cpp | 2 +- src/compute_contact_atom.cpp | 4 +- src/compute_coord_atom.cpp | 6 +- src/compute_dihedral.cpp | 2 +- src/compute_dihedral_local.cpp | 10 +- src/compute_dipole_chunk.cpp | 6 +- src/compute_displace_atom.cpp | 6 +- src/compute_erotate_sphere_atom.cpp | 2 +- src/compute_fragment_atom.cpp | 8 +- src/compute_global_atom.cpp | 10 +- src/compute_group_group.cpp | 12 +- src/compute_gyration_chunk.cpp | 4 +- src/compute_heat_flux.cpp | 2 +- src/compute_hexorder_atom.cpp | 4 +- src/compute_improper.cpp | 2 +- src/compute_improper_local.cpp | 10 +- src/compute_inertia_chunk.cpp | 4 +- src/compute_ke_atom.cpp | 2 +- src/compute_msd.cpp | 2 +- src/compute_msd_chunk.cpp | 2 +- src/compute_omega_chunk.cpp | 4 +- src/compute_orientorder_atom.cpp | 6 +- src/compute_pair.cpp | 4 +- src/compute_pair_local.cpp | 8 +- src/compute_pe_atom.cpp | 2 +- src/compute_pressure.cpp | 12 +- src/compute_property_atom.cpp | 4 +- src/compute_property_chunk.cpp | 2 +- src/compute_property_local.cpp | 8 +- src/compute_rdf.cpp | 6 +- src/compute_reduce.cpp | 20 +- src/compute_reduce_chunk.cpp | 14 +- src/compute_slice.cpp | 2 +- src/compute_stress_atom.cpp | 6 +- src/compute_temp_chunk.cpp | 6 +- src/compute_temp_deform.cpp | 2 +- src/compute_temp_partial.cpp | 2 +- src/compute_temp_profile.cpp | 2 +- src/compute_temp_ramp.cpp | 2 +- src/compute_temp_region.cpp | 4 +- src/compute_temp_sphere.cpp | 2 +- src/compute_torque_chunk.cpp | 2 +- src/compute_vacf.cpp | 2 +- src/compute_vcm_chunk.cpp | 2 +- src/create_atoms.cpp | 6 +- src/create_atoms.h | 2 +- src/create_bonds.cpp | 4 +- src/delete_atoms.cpp | 6 +- src/delete_bonds.cpp | 2 +- src/dihedral.cpp | 8 +- src/dihedral_hybrid.cpp | 8 +- src/displace_atoms.cpp | 6 +- src/domain.cpp | 8 +- src/dump.cpp | 74 ++-- src/dump_atom.cpp | 2 +- src/dump_cfg.cpp | 4 +- src/dump_custom.cpp | 82 ++--- src/dump_dcd.cpp | 8 +- src/dump_image.cpp | 50 +-- src/dump_local.cpp | 22 +- src/dump_movie.cpp | 6 +- src/dump_xyz.cpp | 12 +- src/error.cpp | 12 +- src/fix.cpp | 4 +- src/fix.h | 2 +- src/fix_adapt.cpp | 28 +- src/fix_addforce.cpp | 6 +- src/fix_ave_atom.cpp | 12 +- src/fix_ave_chunk.cpp | 74 ++-- src/fix_ave_correlate.cpp | 14 +- src/fix_ave_histo.cpp | 42 +-- src/fix_ave_histo_weight.cpp | 8 +- src/fix_ave_time.cpp | 36 +- src/fix_aveforce.cpp | 10 +- src/fix_balance.cpp | 2 +- src/fix_box_relax.cpp | 4 +- src/fix_controller.cpp | 2 +- src/fix_deform.cpp | 6 +- src/fix_enforce2d.cpp | 2 +- src/fix_external.cpp | 8 +- src/fix_gravity.cpp | 8 +- src/fix_group.cpp | 10 +- src/fix_halt.cpp | 4 +- src/fix_heat.cpp | 6 +- src/fix_indent.cpp | 4 +- src/fix_langevin.cpp | 20 +- src/fix_minimize.cpp | 2 +- src/fix_move.cpp | 36 +- src/fix_neigh_history.cpp | 42 +-- src/fix_nh.cpp | 24 +- src/fix_numdiff.cpp | 4 +- src/fix_press_berendsen.cpp | 6 +- src/fix_print.cpp | 8 +- src/fix_property_atom.cpp | 16 +- src/fix_read_restart.cpp | 2 +- src/fix_respa.cpp | 6 +- src/fix_restrain.cpp | 6 +- src/fix_setforce.cpp | 10 +- src/fix_spring.cpp | 2 +- src/fix_spring_chunk.cpp | 6 +- src/fix_spring_rg.cpp | 2 +- src/fix_spring_self.cpp | 4 +- src/fix_store.cpp | 16 +- src/fix_store_force.cpp | 2 +- src/fix_store_state.cpp | 14 +- src/fix_temp_berendsen.cpp | 6 +- src/fix_temp_csld.cpp | 10 +- src/fix_temp_csvr.cpp | 6 +- src/fix_temp_rescale.cpp | 6 +- src/fix_tmd.cpp | 12 +- src/fix_vector.cpp | 6 +- src/fix_viscous.cpp | 2 +- src/fix_wall.cpp | 2 +- src/fix_wall_region.cpp | 2 +- src/force.cpp | 76 ++--- src/group.cpp | 30 +- src/image.cpp | 28 +- src/improper.cpp | 8 +- src/improper_hybrid.cpp | 8 +- src/info.cpp | 14 +- src/input.cpp | 84 ++--- src/integrate.cpp | 8 +- src/irregular.cpp | 10 +- src/irregular.h | 2 +- src/kspace.cpp | 8 +- src/lammps.cpp | 138 ++++---- src/lattice.cpp | 4 +- src/library.cpp | 244 ++++++------- src/lmppython.cpp | 2 +- src/memory.cpp | 12 +- src/memory.h | 74 ++-- src/min.cpp | 28 +- src/min_hftn.cpp | 24 +- src/min_linesearch.cpp | 8 +- src/modify.cpp | 106 +++--- src/molecule.cpp | 88 ++--- src/my_page.cpp | 4 +- src/my_page.h | 2 +- src/nbin.cpp | 6 +- src/neigh_list.cpp | 40 +-- src/neigh_request.cpp | 10 +- src/neighbor.cpp | 92 ++--- src/npair.cpp | 4 +- src/nstencil.cpp | 14 +- src/ntopo.cpp | 2 +- src/output.cpp | 40 +-- src/output.h | 2 +- src/pair.cpp | 36 +- src/pair.h | 2 +- src/pair_beck.cpp | 18 +- src/pair_born.cpp | 24 +- src/pair_born_coul_dsf.cpp | 24 +- src/pair_born_coul_wolf.cpp | 24 +- src/pair_buck.cpp | 20 +- src/pair_buck_coul_cut.cpp | 22 +- src/pair_coul_cut.cpp | 12 +- src/pair_coul_debye.cpp | 8 +- src/pair_coul_dsf.cpp | 12 +- src/pair_coul_streitz.cpp | 14 +- src/pair_coul_wolf.cpp | 10 +- src/pair_dpd.cpp | 18 +- src/pair_dpd_tstat.cpp | 16 +- src/pair_gauss.cpp | 16 +- src/pair_hybrid.cpp | 42 +-- src/pair_hybrid_overlay.cpp | 2 +- src/pair_lj96_cut.cpp | 20 +- src/pair_lj_cubic.cpp | 12 +- src/pair_lj_cut.cpp | 20 +- src/pair_lj_cut_coul_cut.cpp | 22 +- src/pair_lj_cut_coul_debye.cpp | 10 +- src/pair_lj_cut_coul_dsf.cpp | 22 +- src/pair_lj_cut_coul_wolf.cpp | 20 +- src/pair_lj_expand.cpp | 20 +- src/pair_lj_gromacs.cpp | 18 +- src/pair_lj_gromacs_coul_gromacs.cpp | 18 +- src/pair_lj_smooth.cpp | 18 +- src/pair_lj_smooth_linear.cpp | 12 +- src/pair_mie_cut.cpp | 26 +- src/pair_morse.cpp | 18 +- src/pair_soft.cpp | 12 +- src/pair_table.cpp | 32 +- src/pair_ufm.cpp | 18 +- src/pair_yukawa.cpp | 14 +- src/pair_zbl.cpp | 14 +- src/pair_zero.cpp | 8 +- src/procmap.cpp | 18 +- src/random_mars.cpp | 2 +- src/rcb.cpp | 28 +- src/read_data.cpp | 120 +++---- src/read_dump.cpp | 28 +- src/read_restart.cpp | 52 +-- src/reader.cpp | 10 +- src/reader_native.cpp | 12 +- src/reader_xyz.cpp | 12 +- src/region.cpp | 8 +- src/region_cylinder.cpp | 2 +- src/region_intersect.cpp | 2 +- src/region_sphere.cpp | 2 +- src/region_union.cpp | 2 +- src/replicate.cpp | 2 +- src/rerun.cpp | 4 +- src/reset_mol_ids.cpp | 4 +- src/respa.cpp | 4 +- src/run.cpp | 4 +- src/set.cpp | 6 +- src/special.cpp | 2 +- src/thermo.cpp | 32 +- src/universe.cpp | 14 +- src/update.cpp | 10 +- src/utils.cpp | 20 +- src/utils.h | 10 +- src/variable.cpp | 274 +++++++-------- src/variable.h | 4 +- src/velocity.cpp | 32 +- src/write_coeff.cpp | 14 +- src/write_data.cpp | 12 +- src/write_dump.cpp | 2 +- src/write_restart.cpp | 14 +- 1217 files changed, 8605 insertions(+), 8605 deletions(-) diff --git a/lib/atc/ATC_Coupling.cpp b/lib/atc/ATC_Coupling.cpp index db72b0cb0c..552bb9bb37 100644 --- a/lib/atc/ATC_Coupling.cpp +++ b/lib/atc/ATC_Coupling.cpp @@ -30,26 +30,26 @@ namespace ATC { useFeMdMassMatrix_(false), trackCharge_(false), temperatureDef_(NONE), - prescribedDataMgr_(NULL), - physicsModel_(NULL), + prescribedDataMgr_(nullptr), + physicsModel_(nullptr), extrinsicModelManager_(this), - atomicRegulator_(NULL), + atomicRegulator_(nullptr), atomQuadForInternal_(true), - elementMask_(NULL), - elementMaskMass_(NULL), - elementMaskMassMd_(NULL), - nodalAtomicMass_(NULL), - nodalAtomicCount_(NULL), - nodalAtomicHeatCapacity_(NULL), - internalToMask_(NULL), - internalElement_(NULL), - ghostElement_(NULL), - nodalGeometryType_(NULL), + elementMask_(nullptr), + elementMaskMass_(nullptr), + elementMaskMassMd_(nullptr), + nodalAtomicMass_(nullptr), + nodalAtomicCount_(nullptr), + nodalAtomicHeatCapacity_(nullptr), + internalToMask_(nullptr), + internalElement_(nullptr), + ghostElement_(nullptr), + nodalGeometryType_(nullptr), bndyIntType_(NO_QUADRATURE), - bndyFaceSet_(NULL), - atomicWeightsMask_(NULL), - shpFcnMask_(NULL), - shpFcnDerivsMask_(NULL), + bndyFaceSet_(nullptr), + atomicWeightsMask_(nullptr), + shpFcnMask_(nullptr), + shpFcnDerivsMask_(nullptr), sourceIntegration_(FULL_DOMAIN) { // size the field mask @@ -68,7 +68,7 @@ namespace ATC { ATC_Coupling::~ATC_Coupling() { interscaleManager_.clear(); - if (feEngine_) { delete feEngine_; feEngine_ = NULL; } + if (feEngine_) { delete feEngine_; feEngine_ = nullptr; } if (physicsModel_) delete physicsModel_; if (atomicRegulator_) delete atomicRegulator_; if (prescribedDataMgr_) delete prescribedDataMgr_; @@ -127,7 +127,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -164,7 +164,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // fix current value if (narg == argIdx) { set nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName); @@ -258,7 +258,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string esetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { string a(arg[argIdx]); @@ -367,7 +367,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -529,7 +529,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - UXT_Function * f = NULL; + UXT_Function * f = nullptr; // parse linear if (narg == argIdx+2) { f = UXT_Function_Mgr::instance()->linear_function(atof(arg[argIdx]),atof(arg[argIdx+1])); @@ -760,7 +760,7 @@ namespace ATC { WeakEquation::PDE_Type ATC_Coupling::pde_type(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return WeakEquation::PROJECTION_PDE; + if (weakEq == nullptr) return WeakEquation::PROJECTION_PDE; return weakEq->type(); } //-------------------------------------------------- @@ -768,7 +768,7 @@ namespace ATC { bool ATC_Coupling::is_dynamic(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return false; + if (weakEq == nullptr) return false; return (physicsModel_->weak_equation(fieldName)->type() == WeakEquation::DYNAMIC_PDE); } diff --git a/lib/atc/ATC_Coupling.h b/lib/atc/ATC_Coupling.h index 9f406febbe..e119b68738 100644 --- a/lib/atc/ATC_Coupling.h +++ b/lib/atc/ATC_Coupling.h @@ -114,10 +114,10 @@ namespace ATC { FIELDS &rhs, const Array< std::set > atomMaterialGroups, const VectorDependencyManager * shpFcnDerivs, - const SPAR_MAN * shpFcn = NULL, - const DIAG_MAN * atomicWeights = NULL, - const MatrixDependencyManager * elementMask = NULL, - const SetDependencyManager * nodeSet = NULL); + const SPAR_MAN * shpFcn = nullptr, + const DIAG_MAN * atomicWeights = nullptr, + const MatrixDependencyManager * elementMask = nullptr, + const SetDependencyManager * nodeSet = nullptr); /** access to full right hand side / forcing vector */ FIELDS &rhs() {return rhs_;}; Array2D rhs_mask() const { @@ -152,14 +152,14 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, // = FULL_DOMAIN - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** wrapper for FE_Engine's compute_tangent_matrix */ void compute_rhs_tangent(const std::pair row_col, const RHS_MASK & rhsMask, const FIELDS & fields, SPAR_MAT & stiffness, const IntegrationDomainType integrationType, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); void tangent_matrix(const std::pair row_col, const RHS_MASK & rhsMask, const PhysicsModel * physicsModel, @@ -197,7 +197,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } else { @@ -206,7 +206,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } } @@ -233,7 +233,7 @@ namespace ATC { /** access to time integrator */ const TimeIntegrator * time_integrator(const FieldName & field) const { _ctiIt_ = timeIntegrators_.find(field); - if (_ctiIt_ == timeIntegrators_.end()) return NULL; + if (_ctiIt_ == timeIntegrators_.end()) return nullptr; return _ctiIt_->second; }; @@ -322,7 +322,7 @@ namespace ATC { void compute_flux(const Array2D & rhs_mask, const FIELDS &fields, GRAD_FIELD_MATS &flux, - const PhysicsModel * physicsModel=NULL, + const PhysicsModel * physicsModel=nullptr, const bool normalize = false); /** evaluate rhs on the atomic domain which is near the FE region */ void masked_atom_domain_rhs_integral(const Array2D & rhs_mask, @@ -334,7 +334,7 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** access to boundary fluxes */ DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();}; DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];}; @@ -352,7 +352,7 @@ namespace ATC { // mass matrix filtering void delete_mass_mat_time_filter(FieldName thisField); /** compute mass matrix for requested field */ - void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = NULL); + void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = nullptr); /** updates filtering of MD contributions */ void update_mass_matrix(FieldName thisField); /** compute the mass matrix components coming from MD integration */ diff --git a/lib/atc/ATC_CouplingEnergy.cpp b/lib/atc/ATC_CouplingEnergy.cpp index c3b07c242d..8fae1f0703 100644 --- a/lib/atc/ATC_CouplingEnergy.cpp +++ b/lib/atc/ATC_CouplingEnergy.cpp @@ -30,8 +30,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL) + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr) { // Allocate PhysicsModel create_physics_model(THERMAL, matParamFile); @@ -103,7 +103,7 @@ namespace ATC { // always need kinetic energy AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_CouplingMomentumEnergy.cpp b/lib/atc/ATC_CouplingMomentumEnergy.cpp index 1fc2931977..32df5fd7b9 100644 --- a/lib/atc/ATC_CouplingMomentumEnergy.cpp +++ b/lib/atc/ATC_CouplingMomentumEnergy.cpp @@ -32,8 +32,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL), + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr), refPE_(0) { // Allocate PhysicsModel @@ -190,7 +190,7 @@ namespace ATC { FieldManager fieldManager(this); PerAtomQuantity * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_Method.cpp b/lib/atc/ATC_Method.cpp index f2173e9575..113d175e26 100644 --- a/lib/atc/ATC_Method.cpp +++ b/lib/atc/ATC_Method.cpp @@ -35,37 +35,37 @@ using std::pair; namespace ATC { ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) : - nodalAtomicVolume_(NULL), + nodalAtomicVolume_(nullptr), needReset_(true), lammpsInterface_(LammpsInterface::instance()), interscaleManager_(this), timeFilterManager_(this), integrateInternalAtoms_(false), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), ghostManager_(this), - feEngine_(NULL), + feEngine_(nullptr), initialized_(false), meshDataInitialized_(false), localStep_(0), sizeComm_(8), // 3 positions + 1 material id * 2 for output - atomCoarseGrainingPositions_(NULL), - atomGhostCoarseGrainingPositions_(NULL), - atomProcGhostCoarseGrainingPositions_(NULL), - atomReferencePositions_(NULL), + atomCoarseGrainingPositions_(nullptr), + atomGhostCoarseGrainingPositions_(nullptr), + atomProcGhostCoarseGrainingPositions_(nullptr), + atomReferencePositions_(nullptr), nNodes_(0), nsd_(lammpsInterface_->dimension()), - xref_(NULL), + xref_(nullptr), readXref_(false), needXrefProcessorGhosts_(false), trackDisplacement_(false), needsAtomToElementMap_(true), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalElementSet_(""), - atomMasses_(NULL), - atomPositions_(NULL), - atomVelocities_(NULL), - atomForces_(NULL), + atomMasses_(nullptr), + atomPositions_(nullptr), + atomVelocities_(nullptr), + atomForces_(nullptr), parallelConsistency_(true), outputNow_(false), outputTime_(true), @@ -79,13 +79,13 @@ namespace ATC { sizeVector_(0), scalarVectorFreq_(0), sizePerAtomCols_(4), - perAtomOutput_(NULL), + perAtomOutput_(nullptr), perAtomArray_(perAtomArray), extScalar_(0), extVector_(0), - extList_(NULL), + extList_(nullptr), thermoEnergyFlag_(0), - atomVolume_(NULL), + atomVolume_(nullptr), atomicWeightsWriteFlag_(false), atomicWeightsWriteFrequency_(0), atomWeightType_(LATTICE), @@ -103,12 +103,12 @@ namespace ATC { mdMassNormalization_(false), kernelBased_(false), kernelOnTheFly_(false), - kernelFunction_(NULL), + kernelFunction_(nullptr), bondOnTheFly_(false), - accumulant_(NULL), - accumulantMol_(NULL), - accumulantMolGrad_(NULL), - accumulantWeights_(NULL), + accumulant_(nullptr), + accumulantMol_(nullptr), + accumulantMolGrad_(nullptr), + accumulantWeights_(nullptr), accumulantInverseVolumes_(&invNodeVolumes_), accumulantBandwidth_(0), useRestart_(false), @@ -117,7 +117,7 @@ namespace ATC { setRefPEvalue_(false), refPEvalue_(0.), readRefPE_(false), - nodalRefPotentialEnergy_(NULL), + nodalRefPotentialEnergy_(nullptr), simTime_(0.0), stepCounter_(0) { @@ -1122,7 +1122,7 @@ pecified FieldName & thisField, int & thisIndex) { string thisName = args[argIdx++]; - if (args[argIdx] == NULL) { + if (args[argIdx] == nullptr) { throw ATC_Error("Need to give field '"+thisName+"' more args"); } thisField = string_to_field(thisName); @@ -1282,7 +1282,7 @@ pecified if (this->reset_methods()) { // clear memory manager interscaleManager_.clear_temporary_data(); - atomVolume_ = NULL; + atomVolume_ = nullptr; // reference positions and energy if (!initialized_) { @@ -1517,7 +1517,7 @@ pecified } else { // set variables to compute atomic weights - DENS_MAN * nodalVolume(NULL); + DENS_MAN * nodalVolume(nullptr); switch (atomWeightType_) { case USER: atomVolume_ = new AtomVolumeUser(this,Valpha_); diff --git a/lib/atc/ATC_Method.h b/lib/atc/ATC_Method.h index e356243e03..0779990a99 100644 --- a/lib/atc/ATC_Method.h +++ b/lib/atc/ATC_Method.h @@ -423,7 +423,7 @@ namespace ATC { bool use_md_mass_normalization() const { return mdMassNormalization_;} bool kernel_based() { return kernelBased_; } bool kernel_on_the_fly() const { return kernelOnTheFly_;} - bool has_kernel_function() { return kernelFunction_ != NULL; } + bool has_kernel_function() { return kernelFunction_ != nullptr; } KernelFunction * kernel_function() { return kernelFunction_; } std::vector & type_list() { return typeList_; } std::vector & group_list() { return groupList_; } diff --git a/lib/atc/ATC_Transfer.cpp b/lib/atc/ATC_Transfer.cpp index 833e1d1f27..a9e87e3ff9 100644 --- a/lib/atc/ATC_Transfer.cpp +++ b/lib/atc/ATC_Transfer.cpp @@ -68,19 +68,19 @@ namespace ATC { LAMMPS_NS::Fix * thisFix, string matParamFile) : ATC_Method(groupName,perAtomArray,thisFix), - xPointer_(NULL), + xPointer_(nullptr), outputStepZero_(true), neighborReset_(false), - pairMap_(NULL), - bondMatrix_(NULL), - pairVirial_(NULL), - pairHeatFlux_(NULL), + pairMap_(nullptr), + bondMatrix_(nullptr), + pairVirial_(nullptr), + pairHeatFlux_(nullptr), nComputes_(0), hasPairs_(true), hasBonds_(false), resetKernelFunction_(false), dxaExactMode_(true), - cauchyBornStress_(NULL) + cauchyBornStress_(nullptr) { nTypes_ = lammpsInterface_->ntypes(); @@ -114,7 +114,7 @@ namespace ATC { rateFlags_ = false; outputFields_.resize(NUM_TOTAL_FIELDS); - for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = NULL; } + for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; } // Hardy requires ref positions for processor ghosts for bond list @@ -491,7 +491,7 @@ namespace ATC { ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag); interscaleManager_.add_per_atom_quantity(c,tag); int projection = iter->second; - DIAG_MAN * w = NULL; + DIAG_MAN * w = nullptr; if (projection == VOLUME_NORMALIZATION ) { w = accumulantInverseVolumes_; } else if (projection == NUMBER_NORMALIZATION ) @@ -976,7 +976,7 @@ namespace ATC { DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity(); DENS_MAT E(H.nRows(),1); ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); //DENS_MAT & T = hardyData_["temperature"]; //cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"]; cauchy_born_energy(H, E, temp); @@ -988,14 +988,14 @@ namespace ATC { // compute: cauchy born stress if (fieldFlags_(CAUCHY_BORN_STRESS)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_stress(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_stress"].set_quantity(), temp); } // compute: cauchy born energy if (fieldFlags_(CAUCHY_BORN_ENERGY)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_energy(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_energy"].set_quantity(), temp); } diff --git a/lib/atc/Array.h b/lib/atc/Array.h index 21e66a9551..c29729d320 100644 --- a/lib/atc/Array.h +++ b/lib/atc/Array.h @@ -78,7 +78,7 @@ protected: template Array::Array(void) { len_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -90,8 +90,8 @@ Array::Array(int len) { template Array::Array(const Array& A) { len_ = A.len_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[len_]; for(int i=0;i::Array(const Array& A) { template Array::~Array() { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; } template @@ -111,12 +111,12 @@ void Array::reset(int len) { } else { // size change, realloc memory len_ = len; - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; if (len_ > 0) data_ = new T[len_]; else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -130,7 +130,7 @@ void Array::resize(int len, bool copy) { else { // size change, realloc memory len_ = len; if (len_ > 0) { - if (copy && data_ != NULL) { + if (copy && data_ != nullptr) { Array temp(*this); delete[] data_; data_ = new T[len_]; @@ -140,12 +140,12 @@ void Array::resize(int len, bool copy) { } } else { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; data_ = new T[len_]; } } else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -158,10 +158,10 @@ T& Array::operator() (int i) { template Array& Array::operator= (const Array &other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS len_ = other.len_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[len_]; } @@ -250,7 +250,7 @@ T* Array::ptr() const { template void Array::print(std::string name) const { std::cout << "------- Begin "<::AliasArray(const Array& A) { template AliasArray::~AliasArray(void) { len_ = 0; - data_ = NULL; // trick base class into not deleting parent data + data_ = nullptr; // trick base class into not deleting parent data } template diff --git a/lib/atc/Array2D.h b/lib/atc/Array2D.h index 25f895f72c..37b7dcb3c9 100644 --- a/lib/atc/Array2D.h +++ b/lib/atc/Array2D.h @@ -57,7 +57,7 @@ template Array2D::Array2D() { nrows_ = 0; ncols_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -71,8 +71,8 @@ template Array2D::Array2D(const Array2D& A) { nrows_ = A.nrows_; ncols_ = A.ncols_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[nrows_ * ncols_]; for(int i=0;i::reset(int nrows, int ncols) { else { // size changed; realloc memory nrows_ = nrows; ncols_ = ncols; - if (data_ != NULL) + if (data_ != nullptr) delete [] data_; if (ncols_ > 0 && nrows_ > 0) data_ = new T[nrows_ * ncols_]; else { - data_ = NULL; + data_ = nullptr; nrows_ = 0; ncols_ = 0; } @@ -120,11 +120,11 @@ AliasArray Array2D::column(int col) const { template Array2D& Array2D::operator= (const Array2D& other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS nrows_ = other.nrows_; ncols_ = other.ncols_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[nrows_ * ncols_]; } @@ -170,14 +170,14 @@ void Array2D::write_restart(FILE *f) const { template Array2D::~Array2D() { - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; } template void Array2D::print(std::string name) const { std::cout << "------- Begin "< >::iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { data = new DENS_MAN(nNodes_,nCols); @@ -115,14 +115,14 @@ namespace ATC { //-------------------------------------------------------- // get_regulator_data: - // gets a pointer to the requested data, or NULL if + // gets a pointer to the requested data, or nullptr if // if doesn't exist //-------------------------------------------------------- const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const { map >::const_iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { - return NULL; + return nullptr; } else { return const_cast((it->second).second); @@ -521,7 +521,7 @@ namespace ATC { fieldMask_(NUM_FIELDS,NUM_FLUX), nNodes_(atomicRegulator_->num_nodes()), regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix), - shpFcnDerivs_(NULL) + shpFcnDerivs_(nullptr) { fieldMask_ = false; } @@ -552,21 +552,21 @@ namespace ATC { RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator, const string & regulatorPrefix) : RegulatorMethod(atomicRegulator,regulatorPrefix), - lambda_(NULL), - atomLambdas_(NULL), - shapeFunctionMatrix_(NULL), + lambda_(nullptr), + atomLambdas_(nullptr), + shapeFunctionMatrix_(nullptr), linearSolverType_(AtomicRegulator::NO_SOLVE), maxIterations_(atomicRegulator->max_iterations()), tolerance_(atomicRegulator->tolerance()), - matrixSolver_(NULL), - regulatedNodes_(NULL), - applicationNodes_(NULL), - boundaryNodes_(NULL), - shpFcn_(NULL), - atomicWeights_(NULL), - elementMask_(NULL), - lambdaAtomMap_(NULL), - weights_(NULL), + matrixSolver_(nullptr), + regulatedNodes_(nullptr), + applicationNodes_(nullptr), + boundaryNodes_(nullptr), + shpFcn_(nullptr), + atomicWeights_(nullptr), + elementMask_(nullptr), + lambdaAtomMap_(nullptr), + weights_(nullptr), nsd_(atomicRegulator_->nsd()), nLocal_(atomicRegulator_->nlocal()) { diff --git a/lib/atc/AtomicRegulator.h b/lib/atc/AtomicRegulator.h index b9fccb902c..360af3a4f6 100644 --- a/lib/atc/AtomicRegulator.h +++ b/lib/atc/AtomicRegulator.h @@ -143,7 +143,7 @@ namespace ATC { /** can externally set regulator dynamic contributions */ virtual void reset_lambda_contribution(const DENS_MAT & /* target */, const FieldName /* field */) {}; virtual void reset_lambda_contribution(const DENS_MAT & target) { reset_lambda_contribution(target,NUM_TOTAL_FIELDS); } - /** returns a const pointer to the DENS_MAN associated with the tag, or NULL */ + /** returns a const pointer to the DENS_MAN associated with the tag, or nullptr */ const DENS_MAN * regulator_data(const std::string tag) const; /** return the maximum number of iterations */ int max_iterations() {return maxIterations_;}; diff --git a/lib/atc/CauchyBorn.cpp b/lib/atc/CauchyBorn.cpp index 85b100ca64..81f7b4e1a8 100644 --- a/lib/atc/CauchyBorn.cpp +++ b/lib/atc/CauchyBorn.cpp @@ -426,7 +426,7 @@ namespace ATC { for (INDEX j=i; j<3; j++) s(i,j) += factor * dd(i,j); - // If f_W is not NULL then append thermal contribution. + // If f_W is not nullptr then append thermal contribution. if (F_w) *F_w += 0.5*kb*T*log(detD); } //============================================================================ diff --git a/lib/atc/ChargeRegulator.cpp b/lib/atc/ChargeRegulator.cpp index bae78a7613..972530829c 100644 --- a/lib/atc/ChargeRegulator.cpp +++ b/lib/atc/ChargeRegulator.cpp @@ -164,7 +164,7 @@ namespace ATC { chargeRegulator_(chargeRegulator), lammpsInterface_(LammpsInterface::instance()), rC_(0), rCsq_(0), - targetValue_(NULL), + targetValue_(nullptr), targetPhi_(p.value), surface_(p.faceset), atomGroupBit_(p.groupBit), diff --git a/lib/atc/CloneVector.h b/lib/atc/CloneVector.h index 02db700f27..63d11636b3 100644 --- a/lib/atc/CloneVector.h +++ b/lib/atc/CloneVector.h @@ -52,7 +52,7 @@ private: //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Vector &c) - : Vector(), _baseV(const_cast*>(&c)), _baseM(NULL) + : Vector(), _baseV(const_cast*>(&c)), _baseM(nullptr) {} //----------------------------------------------------------------------------- // Construct from a matrix, the const_cast isn't pretty @@ -65,7 +65,7 @@ CloneVector::CloneVector(const Vector &c) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(dim), _idx(idx) {} //----------------------------------------------------------------------------- @@ -73,7 +73,7 @@ CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const DiagonalMatrix &c, INDEX /* idx */) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(CLONE_DIAG), _idx(0) {} //----------------------------------------------------------------------------- diff --git a/lib/atc/ConcentrationRegulator.cpp b/lib/atc/ConcentrationRegulator.cpp index 4255b919b9..499a5501c1 100644 --- a/lib/atc/ConcentrationRegulator.cpp +++ b/lib/atc/ConcentrationRegulator.cpp @@ -186,14 +186,14 @@ const double kMinScale_ = 10000.; ConcentrationRegulator::ConcentrationRegulatorParameters & p) : ConcentrationRegulatorMethod(concReg), concentrationRegulator_(concReg), - interscaleManager_(NULL), + interscaleManager_(nullptr), lammpsInterface_(LammpsInterface::instance()), - list_(NULL), + list_(nullptr), targetConcentration_(p.value), targetCount_(0), elemset_(p.elemset), - p_(NULL), - randomNumberGenerator_(NULL), + p_(nullptr), + randomNumberGenerator_(nullptr), q0_(0), controlType_(p.type), controlIndex_(0), diff --git a/lib/atc/DenseMatrix.h b/lib/atc/DenseMatrix.h index e585289aaa..e4759f02d4 100644 --- a/lib/atc/DenseMatrix.h +++ b/lib/atc/DenseMatrix.h @@ -16,10 +16,10 @@ template class DenseMatrix : public Matrix { public: - DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(NULL){ _create(rows, cols, z); } - DenseMatrix(const DenseMatrix& c) : Matrix(), _data(NULL){ _copy(c); } - DenseMatrix(const SparseMatrix& c): Matrix(), _data(NULL){ c.dense_copy(*this);} - DenseMatrix(const Matrix& c) : Matrix(), _data(NULL){ _copy(c); } + DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(nullptr){ _create(rows, cols, z); } + DenseMatrix(const DenseMatrix& c) : Matrix(), _data(nullptr){ _copy(c); } + DenseMatrix(const SparseMatrix& c): Matrix(), _data(nullptr){ c.dense_copy(*this);} + DenseMatrix(const Matrix& c) : Matrix(), _data(nullptr){ _copy(c); } // const SparseMatrix * p = sparse_cast(&c); // (p) ? p->dense_copy(*this) : _copy(c); } ~DenseMatrix() { _delete();} @@ -261,7 +261,7 @@ void DenseMatrix::_delete() _nRows = _nCols = 0; if (_data){ delete [] _data; - _data = NULL; + _data = nullptr; } } //---------------------------------------------------------------------------- @@ -273,7 +273,7 @@ void DenseMatrix::_create(INDEX rows, INDEX cols, bool zero) _nRows=rows; _nCols=cols; - _data = (this->size() ? new T [_nCols*_nRows] : NULL); + _data = (this->size() ? new T [_nCols*_nRows] : nullptr); if (zero) this->zero(); } //---------------------------------------------------------------------------- diff --git a/lib/atc/DenseVector.h b/lib/atc/DenseVector.h index 38ed68f937..bab90bf3ff 100644 --- a/lib/atc/DenseVector.h +++ b/lib/atc/DenseVector.h @@ -16,9 +16,9 @@ class DenseVector : public Vector { public: explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); } - DenseVector(const DenseVector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const Vector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(NULL) { copy(ptr,nrows); } + DenseVector(const DenseVector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const Vector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(nullptr) { copy(ptr,nrows); } virtual ~DenseVector() { _delete(); } //* resizes the Vector, ignores nCols, optionally copys what fits @@ -123,7 +123,7 @@ template inline void DenseVector::_create(INDEX n, bool zero) { _size=n; - _data = _size ? new T [_size] : NULL ; + _data = _size ? new T [_size] : nullptr ; if (zero) this->zero(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/lib/atc/DiagonalMatrix.h b/lib/atc/DiagonalMatrix.h index ca3001f225..b24e19dd4e 100644 --- a/lib/atc/DiagonalMatrix.h +++ b/lib/atc/DiagonalMatrix.h @@ -205,7 +205,7 @@ DiagonalMatrix operator-(const DiagonalMatrix &A, const DiagonalMatrix //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) - : _data(NULL) + : _data(nullptr) { reset(rows, zero); } @@ -214,7 +214,7 @@ DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(c); } @@ -223,7 +223,7 @@ DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const Vector& v) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(v); } diff --git a/lib/atc/DislocationExtractor.h b/lib/atc/DislocationExtractor.h index c2bfe27e04..a0ba3aa995 100644 --- a/lib/atc/DislocationExtractor.h +++ b/lib/atc/DislocationExtractor.h @@ -197,7 +197,7 @@ protected: a.pos.Y = atom->x[i][1]; a.pos.Z = atom->x[i][2]; a.flags = 0; - a.cluster = NULL; + a.cluster = nullptr; a.numNeighbors = 0; a.setFlag(ATOM_IS_LOCAL_ATOM); } @@ -290,7 +290,7 @@ protected: currentAtom->pos.Y = atom->x[i][1]; currentAtom->pos.Z = atom->x[i][2]; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -302,7 +302,7 @@ protected: // Receive atoms from other processors. for(int iproc = 1; iproc < comm->nprocs; iproc++) { MPI_Status status; - MPI_Recv(buffer.empty() ? NULL : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); + MPI_Recv(buffer.empty() ? nullptr : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); int ndoubles; MPI_Get_count(&status, MPI_DOUBLE, &ndoubles); int nReceived = ndoubles / 3; @@ -314,7 +314,7 @@ protected: currentAtom->pos.Y = *data++; currentAtom->pos.Z = *data++; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -332,11 +332,11 @@ protected: *data++ = atom->x[i][2]; } // Send local atom coordinates to master proc. - MPI_Send(buffer.empty() ? NULL : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); + MPI_Send(buffer.empty() ? nullptr : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); } // Make sure all input atoms are wrapped at periodic boundary conditions. - wrapInputAtoms(NULL_VECTOR); + wrapInputAtoms(nullptr_VECTOR); // Build nearest neighbor lists. buildNearestNeighborLists(); @@ -376,7 +376,7 @@ protected: } } // Broadcast segments. - MPI_Bcast(segmentBuffer.empty() ? NULL : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(segmentBuffer.empty() ? nullptr : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract segments from receive buffer. @@ -402,7 +402,7 @@ protected: DISLOCATIONS_ASSERT(sendItem == pointBuffer.end()); } // Broadcast segments. - MPI_Bcast(pointBuffer.empty() ? NULL : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(pointBuffer.empty() ? nullptr : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract points from receive buffer. diff --git a/lib/atc/ElasticTimeIntegrator.cpp b/lib/atc/ElasticTimeIntegrator.cpp index 5e11f1584c..785568cbb2 100644 --- a/lib/atc/ElasticTimeIntegrator.cpp +++ b/lib/atc/ElasticTimeIntegrator.cpp @@ -184,8 +184,8 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicDisplacement_(NULL), - nodalAtomicForce_(NULL) + nodalAtomicDisplacement_(nullptr), + nodalAtomicForce_(nullptr) { // do nothing } @@ -410,9 +410,9 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), - nodalAtomicDisplacement_(NULL), + nodalAtomicDisplacement_(nullptr), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd()) { @@ -633,7 +633,7 @@ namespace ATC { FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) : MomentumIntegrationMethod(momentumTimeIntegrator), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), diff --git a/lib/atc/ElectronHeatFlux.h b/lib/atc/ElectronHeatFlux.h index d0bc2a44f2..4c5b6200d3 100644 --- a/lib/atc/ElectronHeatFlux.h +++ b/lib/atc/ElectronHeatFlux.h @@ -17,7 +17,7 @@ namespace ATC { class ElectronHeatFlux { public: - ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFlux() {}; /** computes heat flux */ virtual void electron_heat_flux(const FIELD_MATS &fields, @@ -68,7 +68,7 @@ namespace ATC { { public: ElectronHeatFluxLinear(std::fstream &matfile,std::map & parameters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxLinear() {}; virtual void electron_heat_flux(const FIELD_MATS & /* fields */, const GRAD_FIELD_MATS &gradFields, @@ -95,7 +95,7 @@ namespace ATC { { public: ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map ¶meters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxPowerLaw() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, @@ -134,8 +134,8 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t public: ElectronHeatFluxThermopower(std::fstream &matfile, std::map & parameters, - /*const*/ ElectronFlux * electronFlux = NULL, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronFlux * electronFlux = nullptr, + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxThermopower() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, diff --git a/lib/atc/ExtrinsicModel.cpp b/lib/atc/ExtrinsicModel.cpp index b20b2a26d1..8e0079d965 100644 --- a/lib/atc/ExtrinsicModel.cpp +++ b/lib/atc/ExtrinsicModel.cpp @@ -114,7 +114,7 @@ namespace ATC { ATC::LammpsInterface::instance()->print_msg_once(ss.str()); myModel = new ExtrinsicModelElectrostatic (this,modelType,matFileName); - } else myModel = NULL; + } else myModel = nullptr; extrinsicModels_.push_back(myModel); // add new fields to fields data @@ -157,7 +157,7 @@ namespace ATC { for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) { if ((*imodel)->model_type()==type) return *imodel; } - return NULL; + return nullptr; } @@ -343,7 +343,7 @@ namespace ATC { atc_(modelManager->atc()), modelManager_(modelManager), modelType_(modelType), - physicsModel_(NULL) + physicsModel_(nullptr) { rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX); rhsMaskIntrinsic_ = false; diff --git a/lib/atc/ExtrinsicModelDriftDiffusion.cpp b/lib/atc/ExtrinsicModelDriftDiffusion.cpp index f9b93a147a..a9d8f27604 100644 --- a/lib/atc/ExtrinsicModelDriftDiffusion.cpp +++ b/lib/atc/ExtrinsicModelDriftDiffusion.cpp @@ -38,17 +38,17 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName), - continuityIntegrator_(NULL), + continuityIntegrator_(nullptr), poissonSolverType_(DIRECT), // ITERATIVE | DIRECT - poissonSolver_(NULL), + poissonSolver_(nullptr), baseSize_(0), electronDensityEqn_(ELECTRON_CONTINUITY), fluxUpdateFreq_(1), schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT - schrodingerSolver_(NULL), + schrodingerSolver_(nullptr), schrodingerPoissonMgr_(), - schrodingerPoissonSolver_(NULL), + schrodingerPoissonSolver_(nullptr), maxConsistencyIter_(0), maxConstraintIter_(1), safe_dEf_(0.1), Ef_shift_(0.0), oneD_(false), oneDcoor_(0), oneDconserve_(0) @@ -351,7 +351,7 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName), - cddmPoissonSolver_(NULL), + cddmPoissonSolver_(nullptr), baseSize_(0) { // delete base class's version of the physics model diff --git a/lib/atc/ExtrinsicModelElectrostatic.cpp b/lib/atc/ExtrinsicModelElectrostatic.cpp index ef3aa52dee..d0aa56d67d 100644 --- a/lib/atc/ExtrinsicModelElectrostatic.cpp +++ b/lib/atc/ExtrinsicModelElectrostatic.cpp @@ -38,15 +38,15 @@ namespace ATC { poissonSolverType_(DIRECT), // ITERATIVE | DIRECT poissonSolverTol_(0), poissonSolverMaxIter_(0), - poissonSolver_(NULL), + poissonSolver_(nullptr), maxSolves_(0), baseSize_(0), - chargeRegulator_(NULL), + chargeRegulator_(nullptr), useSlab_(false), includeShortRange_(true), - atomForces_(NULL), - nodalAtomicCharge_(NULL), - nodalAtomicGhostCharge_(NULL) + atomForces_(nullptr), + nodalAtomicCharge_(nullptr), + nodalAtomicGhostCharge_(nullptr) { physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName); // set up correct masks for coupling diff --git a/lib/atc/ExtrinsicModelTwoTemperature.cpp b/lib/atc/ExtrinsicModelTwoTemperature.cpp index 2be6cfeb3c..35846fe496 100644 --- a/lib/atc/ExtrinsicModelTwoTemperature.cpp +++ b/lib/atc/ExtrinsicModelTwoTemperature.cpp @@ -26,7 +26,7 @@ namespace ATC { string matFileName) : ExtrinsicModel(modelManager,modelType,matFileName), electronTimeIntegration_(TimeIntegrator::IMPLICIT), - temperatureIntegrator_(NULL), + temperatureIntegrator_(nullptr), nsubcycle_(1), exchangeFlag_(true), baseSize_(0) @@ -164,7 +164,7 @@ namespace ATC { rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i); } if (electronTimeIntegration_ == TimeIntegrator::NONE) { - temperatureIntegrator_ = NULL; + temperatureIntegrator_ = nullptr; return; } if (temperatureIntegrator_) delete temperatureIntegrator_; diff --git a/lib/atc/FE_Element.cpp b/lib/atc/FE_Element.cpp index 0d2fc036c7..299b9f191d 100644 --- a/lib/atc/FE_Element.cpp +++ b/lib/atc/FE_Element.cpp @@ -36,7 +36,7 @@ static const double localCoordinatesTolerance = 1.e-09; tolerance_(localCoordinatesTolerance), projectionGuess_(COORDINATE_ALIGNED) { - feInterpolate_ = NULL; + feInterpolate_ = nullptr; } FE_Element::~FE_Element() diff --git a/lib/atc/FE_Engine.cpp b/lib/atc/FE_Engine.cpp index 5e01709b19..9e3c5180e2 100644 --- a/lib/atc/FE_Engine.cpp +++ b/lib/atc/FE_Engine.cpp @@ -32,7 +32,7 @@ namespace ATC{ //----------------------------------------------------------------- FE_Engine::FE_Engine(MPI_Comm comm) : communicator_(comm), - feMesh_(NULL), + feMesh_(nullptr), initialized_(false), outputManager_() { diff --git a/lib/atc/FE_Engine.h b/lib/atc/FE_Engine.h index eb59f04eef..ade7626f80 100644 --- a/lib/atc/FE_Engine.h +++ b/lib/atc/FE_Engine.h @@ -90,7 +90,7 @@ namespace ATC { /** write data: data is arrayed over _unique_ nodes and then mapped by the engine */ - void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=NULL); + void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr); void write_data(double time, OUTPUT_LIST *data); void write_restart_file(std::string fileName, RESTART_LIST *data) @@ -150,7 +150,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute tangent matrix for a pair of fields - given quadrature */ void compute_tangent_matrix(const RHS_MASK &rhsMask, @@ -162,7 +162,7 @@ namespace ATC { const SPAR_MAT &N, const SPAR_MAT_VEC &dN, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a consistent mass matrix for a field */ void compute_mass_matrix( @@ -171,7 +171,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, CON_MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a dimensionless mass matrix */ void compute_mass_matrix(SPAR_MAT &mass_matrix) const; @@ -191,7 +191,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute dimensional lumped mass matrix using given quadrature */ void compute_lumped_mass_matrix( @@ -212,7 +212,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, FIELD_MATS &energy, - const DenseMatrix *elementMask=NULL, + const DenseMatrix *elementMask=nullptr, const IntegrationDomainType domain=FULL_DOMAIN) const; /** compute residual or RHS of the dynamic weak eqn */ @@ -223,7 +223,7 @@ namespace ATC { const Array &elementMaterials, FIELDS &rhs, bool freeOnly=false, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute RHS for given quadrature */ void compute_rhs_vector(const RHS_MASK &rhsMask, @@ -251,7 +251,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, GRAD_FIELD_MATS &flux, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute the flux on the MD/FE boundary */ void compute_boundary_flux(const RHS_MASK &rhsMask, @@ -272,8 +272,8 @@ namespace ATC { const SPAR_MAT_VEC &dN, const DIAG_MAT &flux_mask, FIELDS &rhs, - const DenseMatrix *elementMask=NULL, - const std::set *nodeSet=NULL) const; + const DenseMatrix *elementMask=nullptr, + const std::set *nodeSet=nullptr) const; /** compute prescribed flux given an array of functions of x & t */ void add_fluxes(const Array &fieldMask, @@ -465,7 +465,7 @@ namespace ATC { int nsd() const { return feMesh_->num_spatial_dimensions(); } /** return if the FE mesh has been created */ - int has_mesh() const { return feMesh_!=NULL; } + int has_mesh() const { return feMesh_!=nullptr; } /** get nodal coordinates for a given element */ void element_coordinates(const int eltIdx, DENS_MAT &coords) diff --git a/lib/atc/FE_Mesh.cpp b/lib/atc/FE_Mesh.cpp index 4ea10a681a..6af29ee37e 100644 --- a/lib/atc/FE_Mesh.cpp +++ b/lib/atc/FE_Mesh.cpp @@ -46,7 +46,7 @@ namespace ATC { partitioned_(false), nNodes_(0), nNodesUnique_(0), - feElement_(NULL), + feElement_(nullptr), twoDimensional_(false), hasPlanarFaces_(false) @@ -1708,7 +1708,7 @@ namespace ATC { const Array< pair< string, set > > *nodeSets): FE_Mesh(), minEltSize_(0), - tree_(NULL) + tree_(nullptr) { // Pick which element class to make if (elementType == "HEX8") { @@ -1774,7 +1774,7 @@ namespace ATC { } // Insert nodes and elements into KD-tree for PIE search. - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); } @@ -2107,7 +2107,7 @@ namespace ATC { // use the KD tree for partitioning, getting more blocks than // processors - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); @@ -2519,7 +2519,7 @@ namespace ATC { const double zscale) : hx_(hx), hy_(hy), hz_(hz) { - tree_ = NULL; + tree_ = nullptr; hasPlanarFaces_ = true; xscale_ = xscale; yscale_ = yscale; @@ -2820,7 +2820,7 @@ namespace ATC { const double zscale) { hasPlanarFaces_ = true; - tree_ = NULL; + tree_ = nullptr; xscale_ = xscale; yscale_ = yscale; zscale_ = zscale; diff --git a/lib/atc/FieldEulerIntegrator.cpp b/lib/atc/FieldEulerIntegrator.cpp index 0abc71cbab..ba23af40c9 100644 --- a/lib/atc/FieldEulerIntegrator.cpp +++ b/lib/atc/FieldEulerIntegrator.cpp @@ -112,7 +112,7 @@ FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator( const Array2D< bool > & rhsMask, // copy const double alpha ) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask), - alpha_(alpha),solver_(NULL) + alpha_(alpha),solver_(nullptr) { rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0]; diff --git a/lib/atc/FieldManager.cpp b/lib/atc/FieldManager.cpp index 338f06acad..8a7fb0d50b 100644 --- a/lib/atc/FieldManager.cpp +++ b/lib/atc/FieldManager.cpp @@ -271,7 +271,7 @@ typedef PerAtomQuantity PAQ; u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY); } else { - DENS_MAN * q = NULL; + DENS_MAN * q = nullptr; if (atc_->kernel_on_the_fly()) { if (atc_->kernel_based()) { q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic, diff --git a/lib/atc/FieldManager.h b/lib/atc/FieldManager.h index 9a98676417..b12db230c5 100644 --- a/lib/atc/FieldManager.h +++ b/lib/atc/FieldManager.h @@ -47,7 +47,7 @@ namespace ATC { case SPECIES_FLUX: return species_flux(name); case INTERNAL_ENERGY: return internal_energy(name); case ENERGY: return energy(name); - default: throw ATC_Error("FieldManager:: unknown field"); return NULL; + default: throw ATC_Error("FieldManager:: unknown field"); return nullptr; } } CanonicalName string_to_canonical_name(std::string name){ @@ -83,11 +83,11 @@ namespace ATC { case PROLONGED_VELOCITY: return prolonged_field(VELOCITY); default: - throw ATC_Error("FieldManager:: unknown PAQ"); return NULL; + throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr; } } /** this function returns a restriction of atomic data */ - DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = NULL); + DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = nullptr); protected: ATC_Method * atc_; InterscaleManager & interscaleManager_; @@ -120,10 +120,10 @@ namespace ATC { PAQ * atomic_species_vector(); // internal functions - DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = NULL); - DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = NULL); - DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = NULL); - DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return NULL;}; + DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = nullptr); + DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = nullptr); + DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = nullptr); + DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return nullptr;}; PAQ * prolonged_field(FieldName field); private: FieldManager(void); diff --git a/lib/atc/Function.cpp b/lib/atc/Function.cpp index 062cbcb9b2..e73d64aaea 100644 --- a/lib/atc/Function.cpp +++ b/lib/atc/Function.cpp @@ -26,13 +26,13 @@ namespace ATC { //==================================================================== // UXT_Function_Mgr //==================================================================== - UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = NULL; + UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- UXT_Function_Mgr * UXT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new UXT_Function_Mgr(); } return myInstance_; @@ -90,7 +90,7 @@ namespace ATC { { string tag = other->tag(); - UXT_Function * returnFunction = NULL; + UXT_Function * returnFunction = nullptr; if (tag=="linear") { ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other; returnFunction = new ScalarLinearFunction(*other_cast); @@ -144,14 +144,14 @@ namespace ATC { // XT_Function_Mgr //-------------------------------------------------------------------- //-------------------------------------------------------------------- -XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; +XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- XT_Function_Mgr * XT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new XT_Function_Mgr(); } return myInstance_; @@ -227,7 +227,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; { string tag = other->tag(); - XT_Function * returnFunction = NULL; + XT_Function * returnFunction = nullptr; if (tag=="linear") { LinearFunction * other_cast = (LinearFunction*) other; returnFunction = new LinearFunction(*other_cast); diff --git a/lib/atc/FundamentalAtomicQuantity.cpp b/lib/atc/FundamentalAtomicQuantity.cpp index 0ebb54e168..63824bd0dd 100644 --- a/lib/atc/FundamentalAtomicQuantity.cpp +++ b/lib/atc/FundamentalAtomicQuantity.cpp @@ -126,7 +126,7 @@ namespace ATC { double unitsConversion, AtomType atomType) : ShallowAtomQuantity(atc,0,atomType), - computePointer_(NULL), + computePointer_(nullptr), computeTag_(tag), unitsConversion_(unitsConversion) { diff --git a/lib/atc/FundamentalAtomicQuantity.h b/lib/atc/FundamentalAtomicQuantity.h index 5fb525cd6f..d5cf9f8a21 100644 --- a/lib/atc/FundamentalAtomicQuantity.h +++ b/lib/atc/FundamentalAtomicQuantity.h @@ -131,11 +131,11 @@ namespace ATC { /** gets appropriate pointer for lammps data */ virtual double * lammps_scalar() const - {return NULL;}; + {return nullptr;}; /** gets appropriate pointer for lammps data */ virtual double ** lammps_vector() const - {return NULL;}; + {return nullptr;}; private: diff --git a/lib/atc/GhostManager.cpp b/lib/atc/GhostManager.cpp index 77594ec406..1482a5a47d 100644 --- a/lib/atc/GhostManager.cpp +++ b/lib/atc/GhostManager.cpp @@ -23,7 +23,7 @@ namespace ATC { // Constructor //-------------------------------------------------------- GhostManager::GhostManager(ATC_Method * atc) : - ghostModifier_(NULL), + ghostModifier_(nullptr), atc_(atc), boundaryDynamics_(NO_BOUNDARY_DYNAMICS), needReset_(true) @@ -116,7 +116,7 @@ namespace ATC { { if (ghostModifier_) { delete ghostModifier_; - ghostModifier_ = NULL; + ghostModifier_ = nullptr; } if (!atc_->groupbit_ghost()) { @@ -252,7 +252,7 @@ namespace ATC { //-------------------------------------------------------- GhostModifier::GhostModifier(GhostManager * ghostManager) : ghostManager_(ghostManager), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), integrateAtoms_(false) { // do nothing @@ -321,9 +321,9 @@ namespace ATC { //-------------------------------------------------------- GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) : GhostModifier(ghostManager), - atomPositions_(NULL), - atomFeDisplacement_(NULL), - atomRefPositions_(NULL) + atomPositions_(nullptr), + atomFeDisplacement_(nullptr), + atomRefPositions_(nullptr) { // do nothing } @@ -382,9 +382,9 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierPrescribed(ghostManager), - atomVelocities_(NULL), - atomFeVelocity_(NULL), - atomForces_(NULL), + atomVelocities_(nullptr), + atomFeVelocity_(nullptr), + atomForces_(nullptr), kappa_(kappa), gamma_(gamma), mu_(mu) @@ -486,8 +486,8 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu), - ghostToBoundaryDistance_(NULL), - layerId_(NULL) + ghostToBoundaryDistance_(nullptr), + layerId_(nullptr) { // do nothing @@ -731,8 +731,8 @@ namespace ATC { GhostModifier(ghostManager), lammpsInterface_(LammpsInterface::instance()), elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalToAtom_((ghostManager_->atc())->internal_to_atom_map()), ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()), groupbit_((ghostManager_->atc())->groupbit()), diff --git a/lib/atc/InterscaleOperators.cpp b/lib/atc/InterscaleOperators.cpp index f1e5607b6e..eeac14adf8 100644 --- a/lib/atc/InterscaleOperators.cpp +++ b/lib/atc/InterscaleOperators.cpp @@ -30,7 +30,7 @@ namespace ATC{ for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) { fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES); for (unsigned int j = 0; j < LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES; j++) - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } @@ -126,7 +126,7 @@ namespace ATC{ if (fundamentalAtomQuantities_[i][j]) { index = dfs_visit(fundamentalAtomQuantities_[i][j],index); if ((fundamentalAtomQuantities_[i][j])->memory_type()==TEMPORARY) { - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } } @@ -453,7 +453,7 @@ namespace ATC{ DependencyManager * InterscaleManager::find(const string & tag) { // REFACTOR add check for duplicate entries - DependencyManager * quantity = NULL; + DependencyManager * quantity = nullptr; quantity = find_in_list(perAtomQuantities_,tag); if (quantity) return quantity; @@ -482,7 +482,7 @@ namespace ATC{ quantity = find_in_list(smallMoleculeSets_,tag); if (quantity) return quantity; - return NULL; + return nullptr; } //-------------------------------------------------------- diff --git a/lib/atc/InterscaleOperators.h b/lib/atc/InterscaleOperators.h index 3a4d81212e..40c5144bf8 100644 --- a/lib/atc/InterscaleOperators.h +++ b/lib/atc/InterscaleOperators.h @@ -277,7 +277,7 @@ namespace ATC { data * return_quantity(std::map & list, const std::string & tag) { typename std::map::iterator it = list.find(tag); - if (it==list.end()) return NULL; + if (it==list.end()) return nullptr; return it->second; } @@ -310,7 +310,7 @@ namespace ATC { { typename std::map::iterator it = list.find(tag); if (it!=list.end()) return it->second; - return NULL; + return nullptr; } /** helper function to force the reset of all data in a list */ diff --git a/lib/atc/KD_Tree.cpp b/lib/atc/KD_Tree.cpp index 1432663e80..181be27dc5 100644 --- a/lib/atc/KD_Tree.cpp +++ b/lib/atc/KD_Tree.cpp @@ -83,17 +83,17 @@ KD_Tree::KD_Tree(vector *points, vector *elements, if (foundElemRight) rightElems->push_back(*elit); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - leftElems->size() < 4 || leftElems->size() == 0) { - leftChild_ = NULL; + leftChild_ = nullptr; delete leftPts; delete leftElems; } else { leftChild_ = new KD_Tree(leftPts, leftElems, (dimension+1) % 3); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - rightElems->size() < 4 || rightElems->size() == 0) { - rightChild_ = NULL; + rightChild_ = nullptr; delete rightPts; delete rightElems; } else { @@ -109,7 +109,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { // tree, either recurse to the left or return this node's elements // if there is no left child. if (query.lessThanInDimension(value_, dimension)) { - if (leftChild_ == NULL) { + if (leftChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -119,7 +119,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { } return leftChild_->find_nearest_elements(query, (dimension+1) % 3); } else { - if (rightChild_ == NULL) { + if (rightChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -147,7 +147,7 @@ vector > KD_Tree::getElemIDs(int depth) { sort(candElemIDs.begin(), candElemIDs.end()); result.push_back(candElemIDs); - } else if (leftChild_ == NULL || rightChild_ == NULL) { + } else if (leftChild_ == nullptr || rightChild_ == nullptr) { // Insert all nodes at this level once, // then insert a bunch of empty vectors. temp = this->getElemIDs(0); diff --git a/lib/atc/KernelFunction.cpp b/lib/atc/KernelFunction.cpp index 70a1616e01..6095c14284 100644 --- a/lib/atc/KernelFunction.cpp +++ b/lib/atc/KernelFunction.cpp @@ -20,13 +20,13 @@ namespace ATC { //======================================================================== // KernelFunctionMgr //======================================================================== - KernelFunctionMgr * KernelFunctionMgr::myInstance_ = NULL; + KernelFunctionMgr * KernelFunctionMgr::myInstance_ = nullptr; //------------------------------------------------------------------------ // instance //------------------------------------------------------------------------ KernelFunctionMgr * KernelFunctionMgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new KernelFunctionMgr(); } return myInstance_; @@ -65,7 +65,7 @@ namespace ATC { No default */ int argIdx = 0; - KernelFunction * ptr = NULL; + KernelFunction * ptr = nullptr; char* type = arg[argIdx++]; if (strcmp(type,"step")==0) { double parameters[1] = {atof(arg[argIdx])}; // cutoff radius diff --git a/lib/atc/KinetoThermostat.cpp b/lib/atc/KinetoThermostat.cpp index c10f7eb458..89d598c102 100644 --- a/lib/atc/KinetoThermostat.cpp +++ b/lib/atc/KinetoThermostat.cpp @@ -151,7 +151,7 @@ namespace ATC { VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) : VelocityGlc(kinetostat), velocity_(atc_->field(VELOCITY)), - thermostatCorrection_(NULL) + thermostatCorrection_(nullptr) { // do nothing } @@ -188,7 +188,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -226,14 +226,14 @@ namespace ATC { KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat, int couplingMaxIterations) : KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations), - atomVelocities_(NULL), + atomVelocities_(nullptr), nodalVelocities_(atc_->field(VELOCITY)), - lambdaMomentum_(NULL), - lambdaEnergy_(NULL), - atomicFluctuatingVelocityRescaled_(NULL), - atomicStreamingVelocity_(NULL), - thermostat_(NULL), - kinetostat_(NULL) + lambdaMomentum_(nullptr), + lambdaEnergy_(nullptr), + atomicFluctuatingVelocityRescaled_(nullptr), + atomicStreamingVelocity_(nullptr), + thermostat_(nullptr), + kinetostat_(nullptr) { thermostat_ = this->construct_rescale_thermostat(); kinetostat_ = new VelocityRescaleCombined(kinetoThermostat); @@ -389,7 +389,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) : ThermostatRescaleMixedKePe(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -458,21 +458,21 @@ namespace ATC { velocity_(atc_->field(VELOCITY)), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomRegulatorForces_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), - atomVelocities_(NULL), + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomRegulatorForces_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), + atomVelocities_(nullptr), isFirstTimestep_(true), - nodalAtomicMomentum_(NULL), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL), + nodalAtomicMomentum_(nullptr), + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr), dtFactor_(0.) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize diff --git a/lib/atc/Kinetostat.cpp b/lib/atc/Kinetostat.cpp index 7f95398dcb..676896a2f9 100644 --- a/lib/atc/Kinetostat.cpp +++ b/lib/atc/Kinetostat.cpp @@ -307,11 +307,11 @@ namespace ATC { RegulatorShapeFunction(kinetostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - atomKinetostatForce_(NULL), - atomVelocities_(NULL), - atomMasses_(NULL) + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + atomKinetostatForce_(nullptr), + atomVelocities_(nullptr), + atomMasses_(nullptr) { // data associated with stage 3 in ATC_Method::initialize lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_); @@ -376,7 +376,7 @@ namespace ATC { //-------------------------------------------------------- GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) : KinetostatShapeFunction(kinetostat), - atomPositions_(NULL) + atomPositions_(nullptr) { // do nothing } @@ -462,7 +462,7 @@ namespace ATC { //-------------------------------------------------------- DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMassWeightedDisplacement_(NULL), + nodalAtomicMassWeightedDisplacement_(nullptr), nodalDisplacements_(atc_->field(DISPLACEMENT)) { // do nothing @@ -763,7 +763,7 @@ namespace ATC { //-------------------------------------------------------- VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalVelocities_(atc_->field(VELOCITY)) { // do nothing @@ -1095,8 +1095,8 @@ namespace ATC { StressFlux::StressFlux(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), nodalForce_(atc_->field_rhs(VELOCITY)), - nodalAtomicForce_(NULL), - nodalGhostForce_(NULL), + nodalAtomicForce_(nullptr), + nodalGhostForce_(nullptr), momentumSource_(atc_->atomic_source(VELOCITY)) { // flag for performing boundary flux calculation @@ -1540,14 +1540,14 @@ namespace ATC { KinetostatShapeFunction(kinetostat,regulatorPrefix), velocity_(atc_->field(VELOCITY)), //timeFilter_(atomicRegulator_->time_filter()), - //nodalAtomicLambdaForce_(NULL), - //lambdaPowerFiltered_(NULL), - //atomKinetostatForces_(NULL), - //atomMasses_(NULL), - nodalAtomicMomentum_(NULL), + //nodalAtomicLambdaForce_(nullptr), + //lambdaPowerFiltered_(nullptr), + //atomKinetostatForces_(nullptr), + //atomMasses_(nullptr), + nodalAtomicMomentum_(nullptr), isFirstTimestep_(true), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), dtFactor_(0.) { // constuct/obtain data corresponding to stage 3 of ATC_Method::initialize @@ -1796,8 +1796,8 @@ namespace ATC { const string & regulatorPrefix) : KinetostatGlcFs(kinetostat,regulatorPrefix), momentumSource_(atc_->atomic_source(VELOCITY)), - nodalGhostForce_(NULL), - nodalGhostForceFiltered_(NULL) + nodalGhostForce_(nullptr), + nodalGhostForceFiltered_(nullptr) { // flag for performing boundary flux calculation fieldMask_(VELOCITY,FLUX) = true; @@ -2403,9 +2403,9 @@ namespace ATC { KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat, bool constructKinetostats) : RegulatorMethod(kinetostat), - kinetostatFlux_(NULL), - kinetostatFixed_(NULL), - kinetostatBcs_(NULL) + kinetostatFlux_(nullptr), + kinetostatFixed_(nullptr), + kinetostatBcs_(nullptr) { if (constructKinetostats) { if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) { diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 9964a1c4bb..5727af1904 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -58,14 +58,14 @@ const static int MAX_GROUP_BIT = 2147483647; //4294967295; // pow(2,31)-1; double norm(double * v) {return sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); } -LammpsInterface * LammpsInterface::myInstance_ = NULL; +LammpsInterface * LammpsInterface::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- LammpsInterface * LammpsInterface::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new LammpsInterface(); } return myInstance_; @@ -77,7 +77,7 @@ LammpsInterface * LammpsInterface::instance() void LammpsInterface::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } @@ -85,13 +85,13 @@ void LammpsInterface::Destroy() // constructor // ----------------------------------------------------------------- LammpsInterface::LammpsInterface() - : lammps_(NULL), - fixPointer_(NULL), + : lammps_(nullptr), + fixPointer_(nullptr), commRank_(0), - atomPE_(NULL), + atomPE_(nullptr), refBoxIsSet_(false), - random_(NULL), - globalrandom_(NULL) + random_(nullptr), + globalrandom_(nullptr) { } @@ -225,7 +225,7 @@ void LammpsInterface::sparse_allsum(SparseMatrix &toShare) const std::string LammpsInterface::read_file(std::string filename) const { - FILE *fp = NULL; + FILE *fp = nullptr; if (! comm_rank()) { fp = fopen(filename.c_str(),"r"); if (!fp) throw ATC_Error("can't open file: "+filename); @@ -343,7 +343,7 @@ double * LammpsInterface::atom_scalar(FundamentalAtomQuantity quantityType) cons } else throw ATC_Error("BAD type requested in atom_scalar"); - return NULL; + return nullptr; } double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const @@ -356,7 +356,7 @@ double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) con return fatom(); else throw ATC_Error("BAD type requested in atom_vector"); - return NULL; + return nullptr; } int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const @@ -948,10 +948,10 @@ POTENTIAL LammpsInterface::potential() const "lj/cut/coul/long", "lj/cut/coul/cut", "lj/charmm/coul/long"}; - LAMMPS_NS::Pair *pair = NULL; + LAMMPS_NS::Pair *pair = nullptr; for (int i = 0; i < nStyles; i++){ pair = lammps_->force->pair_match(pairStyles[i].c_str(),1); - if (pair != NULL) break; + if (pair != nullptr) break; } return pair; } @@ -979,8 +979,8 @@ bool LammpsInterface::epsilons(int itype, POTENTIAL pair, double * epsilon0) con int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); int i1,i2; for (int i=1; i < ntypes()+1; i++) { if (i < itype) { i1 = i; i2 = itype; } @@ -998,8 +998,8 @@ bool LammpsInterface::set_epsilons(int itype, POTENTIAL pair, double * epsilon) int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); // scale interactions int i1,i2; for (int i = 1; i < ntypes()+1; i++) { @@ -1498,7 +1498,7 @@ double * LammpsInterface::compute_pe_peratom(void) const return atomPE_->vector_atom; } else { - return NULL; + return nullptr; } } @@ -1542,7 +1542,7 @@ LAMMPS_NS::PairEAM* LammpsInterface::pair_eam() const // return lammps_->force->pair; //} LAMMPS_NS::PairEAM* pair_eam = dynamic_cast (lammps_->force->pair); - if (pair_eam != NULL) { + if (pair_eam != nullptr) { return pair_eam; } else { diff --git a/lib/atc/LammpsInterface.h b/lib/atc/LammpsInterface.h index 2032571da5..6883a9ca0b 100644 --- a/lib/atc/LammpsInterface.h +++ b/lib/atc/LammpsInterface.h @@ -534,7 +534,7 @@ class LammpsInterface { /** Dulong-Petit heat capacity per volume in M,L,T,t units */ double heat_capacity(void) const; /** mass per volume in reference configuraturation in M,L units */ - double mass_density(int* numPerType=NULL) const; + double mass_density(int* numPerType=nullptr) const; /** permittivity of free space, converts from LAMMPS potential units implied by the electric field units to LAMMPS charge units/LAMMPS length units (e.g., V to elemental charge/A) */ double epsilon0(void) const; double coulomb_constant(void) const; diff --git a/lib/atc/LinearSolver.cpp b/lib/atc/LinearSolver.cpp index 655d6130c4..0204ddd938 100644 --- a/lib/atc/LinearSolver.cpp +++ b/lib/atc/LinearSolver.cpp @@ -35,9 +35,9 @@ LinearSolver::LinearSolver( allowReinitialization_(false), homogeneousBCs_(false), bcs_(&bcs), - rhs_(NULL), + rhs_(nullptr), rhsDense_(), - b_(NULL), + b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -65,9 +65,9 @@ LinearSolver::LinearSolver( matrixModified_(false), allowReinitialization_(false), homogeneousBCs_(false), - bcs_(NULL), // null implies no constraints will be added later - rhs_(NULL), - rhsDense_(), b_(NULL), + bcs_(nullptr), // null implies no constraints will be added later + rhs_(nullptr), + rhsDense_(), b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -343,7 +343,7 @@ void LinearSolver::set_fixed_values(VECTOR & X) void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, const DENS_MAT * M) /* const */ { initialize_matrix(); // no inverse needed - const DENS_MAT * Kp = NULL; + const DENS_MAT * Kp = nullptr; const DENS_MAT * Mp =M; DENS_MAT MM; DENS_MAT KM; @@ -388,7 +388,7 @@ void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors bool LinearSolver::solve(VECTOR & x, const VECTOR & b) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; rhs_ = &b; initialized_ = false; @@ -479,7 +479,7 @@ bool LinearSolver::solve(VECTOR & x, const VECTOR & b) void LinearSolver::greens_function(int I, VECTOR & G_I) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; diff --git a/lib/atc/LinearSolver.h b/lib/atc/LinearSolver.h index 5f456b9a1d..1d429d8816 100644 --- a/lib/atc/LinearSolver.h +++ b/lib/atc/LinearSolver.h @@ -64,7 +64,7 @@ class LinearSolver { allow_reinitialization must be called before first solve, etc */ void allow_reinitialization(void); // depending on method save a copy of A void set_homogeneous_bcs(void) { homogeneousBCs_ = true;} // for nonlinear solver, solve for increment - void initialize(const BC_SET * bcs = NULL); + void initialize(const BC_SET * bcs = nullptr); /** solve - solves A x = b @@ -80,7 +80,7 @@ class LinearSolver { - returns the e-values & e-vectors for constrained system Ax + v x = 0 - if M is provided the eval problem : ( A + v M ) x = 0 is solved*/ void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, - const DENS_MAT * M = NULL); + const DENS_MAT * M = nullptr); /** access to penalty coefficient - if a penalty method is not being used this returns zero */ diff --git a/lib/atc/Material.cpp b/lib/atc/Material.cpp index 676a87524f..64673d7993 100644 --- a/lib/atc/Material.cpp +++ b/lib/atc/Material.cpp @@ -28,21 +28,21 @@ namespace ATC { Material::Material() : rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { } //-------------------------------------------------------------- @@ -70,21 +70,21 @@ namespace ATC { : tag_(tag), rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { /*! \page man_material material \section syntax diff --git a/lib/atc/MoleculeSet.h b/lib/atc/MoleculeSet.h index cffafd950d..763f08ef4d 100644 --- a/lib/atc/MoleculeSet.h +++ b/lib/atc/MoleculeSet.h @@ -33,7 +33,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** reset the number of atoms/molecules on this processor */ void reset_nlocal() {this->set_reset();}; @@ -108,8 +108,8 @@ namespace ATC { public: SmallMoleculeSet(ATC_Method * atc, int groupBit, - PerAtomQuantity * bondList = NULL, - PerAtomQuantity * numBond = NULL); + PerAtomQuantity * bondList = nullptr, + PerAtomQuantity * numBond = nullptr); virtual ~SmallMoleculeSet(); @@ -117,7 +117,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** access molecule atoms by lammps id */ std::set atoms_by_global_molecule(int id) const; diff --git a/lib/atc/NonLinearSolver.h b/lib/atc/NonLinearSolver.h index 010e3ee72e..299408c4c3 100644 --- a/lib/atc/NonLinearSolver.h +++ b/lib/atc/NonLinearSolver.h @@ -43,7 +43,7 @@ class NonLinearSolver { /** Constructor */ NonLinearSolver( TangentOperator * f, // provides f and f' at x, pointer for polymorphism - const BC_SET * bcs = NULL, + const BC_SET * bcs = nullptr, const int dof = 0, bool parallel = false ); diff --git a/lib/atc/OutputManager.cpp b/lib/atc/OutputManager.cpp index 066c240cab..83257a3d21 100644 --- a/lib/atc/OutputManager.cpp +++ b/lib/atc/OutputManager.cpp @@ -48,8 +48,8 @@ OutputManager::OutputManager(string outputPrefix, set & otypes) firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_(outputPrefix), ensightOutput_(otypes.count(ENSIGHT)), @@ -68,8 +68,8 @@ OutputManager::OutputManager() firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_("NULL"), ensightOutput_(true), @@ -132,7 +132,7 @@ void OutputManager::print_custom_names() { // Dump text-based fields to disk for later restart void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"wb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -153,7 +153,7 @@ void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) void OutputManager::read_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"rb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -230,7 +230,7 @@ void OutputManager::write_geometry_ensight(void) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; + FILE * fp=nullptr; char buffer[80]; if ( ! initialized_ ) { fp=fopen(geom_file_name.c_str(),"wb"); // open @@ -240,7 +240,7 @@ void OutputManager::write_geometry_ensight(void) else { fp=fopen(geom_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight geometry file"); } @@ -491,14 +491,14 @@ void OutputManager::write_data_ensight(string field_name, const MATRIX *field_da // open or append data file string data_file_name = filenames[ifile]; - FILE * fp=NULL; + FILE * fp=nullptr; if ( outputTimes_.size() == 1 ) { fp=fopen(data_file_name.c_str(),"wb"); // open } else { fp=fopen(data_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight data file: "+data_file_name); } @@ -799,8 +799,8 @@ void OutputManager::write_dictionary(double /* time */, OUTPUT_LIST *data) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; - if ((fp=fopen(dict_file_name.c_str(),"w")) == NULL) + FILE * fp=nullptr; + if ((fp=fopen(dict_file_name.c_str(),"w")) == nullptr) { throw ATC_Error("can not create Ensight case file"); } diff --git a/lib/atc/OutputManager.h b/lib/atc/OutputManager.h index c5a901e9f4..4454d65265 100644 --- a/lib/atc/OutputManager.h +++ b/lib/atc/OutputManager.h @@ -52,13 +52,13 @@ namespace ATC { coordinates : num _total_ points/nodes X num spatial dim connectivities : num elements X num nodes per element*/ void write_geometry(const MATRIX *coordinates, - const Array2D *connectivity=NULL); + const Array2D *connectivity=nullptr); /** write data from a time step specify node_map to handle periodic soln & data */ - void write_data(double time, OUTPUT_LIST *data, const int *node_map=NULL); + void write_data(double time, OUTPUT_LIST *data, const int *node_map=nullptr); void write_data(double time, FIELDS *soln, OUTPUT_LIST *data, - const int *node_map=NULL); + const int *node_map=nullptr); /** add custom names for any field */ void add_field_names(const std::string& name, const std::vector& list) { diff --git a/lib/atc/PaqAtcUtility.cpp b/lib/atc/PaqAtcUtility.cpp index b6a2ed2871..bdcf269626 100644 --- a/lib/atc/PaqAtcUtility.cpp +++ b/lib/atc/PaqAtcUtility.cpp @@ -18,7 +18,7 @@ namespace ATC { AtomType atomType) : atc_(atc), atomType_(atomType), - myNlocal(NULL) + myNlocal(nullptr) { switch (atomType_) { case ALL: diff --git a/lib/atc/ParDenseMatrix.h b/lib/atc/ParDenseMatrix.h index 1c9e75f171..873bf0f410 100644 --- a/lib/atc/ParDenseMatrix.h +++ b/lib/atc/ParDenseMatrix.h @@ -148,7 +148,7 @@ namespace ATC_matrix { #endif // Clear out the local matrix's pointer so we don't double-free - A_local._data = NULL; + A_local._data = nullptr; delete [] majorCounts; delete [] offsets; diff --git a/lib/atc/ParSparseMatrix.cpp b/lib/atc/ParSparseMatrix.cpp index 69ab2453e1..77c8eb33d5 100644 --- a/lib/atc/ParSparseMatrix.cpp +++ b/lib/atc/ParSparseMatrix.cpp @@ -233,8 +233,8 @@ DenseMatrix ParSparseMatrix::transMat( SparseMatrix C_local = ((SparseMatrix)A_local) * B; // destroy newA intelligently - A_local._val = NULL; - A_local._ja = NULL; + A_local._val = nullptr; + A_local._ja = nullptr; // Add all the result vectors together on each processor. sumSparse(C_local, C); @@ -285,8 +285,8 @@ void ParSparseMatrix::partition( // Prepare an A_local matrix for deletion after it has been loaded with // data members from another matrix. void ParSparseMatrix::finalize() { - _val = NULL; - _ja = NULL; + _val = nullptr; + _ja = nullptr; } void ParSparseMatrix::operator=(const SparseMatrix &source) diff --git a/lib/atc/ParSparseMatrix.h b/lib/atc/ParSparseMatrix.h index 0985115d07..b2642e87be 100644 --- a/lib/atc/ParSparseMatrix.h +++ b/lib/atc/ParSparseMatrix.h @@ -135,9 +135,9 @@ namespace ATC_matrix { Avar.hasTemplate_ = Ap.hasTemplate_; // Avoid catastrophe - Ap._val = NULL; - Ap._ja = NULL; - Ap._ia = NULL; + Ap._val = nullptr; + Ap._ja = nullptr; + Ap._ia = nullptr; } diff --git a/lib/atc/PerAtomQuantity-inl.h b/lib/atc/PerAtomQuantity-inl.h index f95e5d306d..b570e7645b 100644 --- a/lib/atc/PerAtomQuantity-inl.h +++ b/lib/atc/PerAtomQuantity-inl.h @@ -24,8 +24,8 @@ namespace ATC { atomType_(atomType), nCols_(nCols), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL), - lammpsVector_(NULL) + lammpsScalar_(nullptr), + lammpsVector_(nullptr) { // do nothing } @@ -452,7 +452,7 @@ namespace ATC { lammpsInterface_(LammpsInterface::instance()), atomType_(atomType), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL) + lammpsScalar_(nullptr) { // do nothing } @@ -610,8 +610,8 @@ namespace ATC { nCols_(nCols), maxEntriesPerRow_(maxEntriesPerRow), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsVector_(NULL), - lammpsColIndices_(NULL) + lammpsVector_(nullptr), + lammpsColIndices_(nullptr) { // do nothing } diff --git a/lib/atc/PerAtomQuantity.h b/lib/atc/PerAtomQuantity.h index e6cb19981a..a822b6a9b6 100644 --- a/lib/atc/PerAtomQuantity.h +++ b/lib/atc/PerAtomQuantity.h @@ -441,10 +441,10 @@ namespace ATC { virtual void set_lammps_to_quantity() const {}; /** gets appropriate pointer for lammps data */ - virtual T * lammps_scalar() const {return NULL;}; + virtual T * lammps_scalar() const {return nullptr;}; /** gets appropriate pointer for lammps data */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; private: @@ -1452,10 +1452,10 @@ namespace ATC { virtual void set_quantity_to_lammps() const {}; /** gets appropriate data for lammps pointer */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; /** gets appropriate data for lammps pointer to column indices */ - virtual int ** lammps_column_indices() const {return NULL;}; + virtual int ** lammps_column_indices() const {return nullptr;}; private: diff --git a/lib/atc/PerAtomQuantityLibrary.h b/lib/atc/PerAtomQuantityLibrary.h index 0089df7855..3e3cb78e95 100644 --- a/lib/atc/PerAtomQuantityLibrary.h +++ b/lib/atc/PerAtomQuantityLibrary.h @@ -125,7 +125,7 @@ namespace ATC { // constructor AtomToElementMap(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -304,7 +304,7 @@ namespace ATC { // constructor AtomVolumeElement(ATC_Method * atc, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -349,7 +349,7 @@ namespace ATC { // constructor AtomVolumeRegion(ATC_Method * atc, - DENS_MAN * atomCoarseGrainingPositions = NULL, + DENS_MAN * atomCoarseGrainingPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -422,9 +422,9 @@ namespace ATC { // constructor AtomicMassWeightedDisplacement(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomReferencePositions = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomReferencePositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -462,8 +462,8 @@ namespace ATC { // constructor FluctuatingVelocity(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -497,8 +497,8 @@ namespace ATC { // constructor ChargeVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - FundamentalAtomQuantity * atomCharges = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + FundamentalAtomQuantity * atomCharges = nullptr, AtomType atomType = INTERNAL); // destructor @@ -532,8 +532,8 @@ namespace ATC { // constructor SpeciesVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - PerAtomQuantity * atomTypeVector = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + PerAtomQuantity * atomTypeVector = nullptr, AtomType atomType = INTERNAL); // destructor @@ -567,8 +567,8 @@ namespace ATC { // constructor AtomicMomentum(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -631,8 +631,8 @@ namespace ATC { // constructor TwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -670,8 +670,8 @@ namespace ATC { // constructor KineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -707,9 +707,9 @@ namespace ATC { // constructor FluctuatingKineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -747,9 +747,9 @@ namespace ATC { // constructor TwiceFluctuatingKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -793,8 +793,8 @@ namespace ATC { MixedKePeEnergy(ATC_Method * atc, double keMultiplier, double peMultiplier, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -838,8 +838,8 @@ namespace ATC { // constructor TotalEnergy(ATC_Method * atc, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -871,8 +871,8 @@ namespace ATC { // constructor FluctuatingPotentialEnergy(ATC_Method * atc, - PerAtomQuantity * potentialEnergy = NULL, - PerAtomQuantity * referencePotential = NULL, + PerAtomQuantity * potentialEnergy = nullptr, + PerAtomQuantity * referencePotential = nullptr, AtomType atomType = INTERNAL); // destructor @@ -911,8 +911,8 @@ namespace ATC { // constructor DotTwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomForces = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomForces = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -948,7 +948,7 @@ namespace ATC { // constructor VelocitySquared(ATC_Method *atc, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -981,9 +981,9 @@ namespace ATC { // constructor LambdaSquared(ATC_Method *atc, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1149,7 +1149,7 @@ namespace ATC { // constructor AtomToNodeset(ATC_Method * atc, SetDependencyManager * subsetNodes, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1194,7 +1194,7 @@ namespace ATC { // constructor AtomToElementset(ATC_Method * atc, MatrixDependencyManager * elementMask, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1273,7 +1273,7 @@ namespace ATC { // constructor VelocitySquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1307,9 +1307,9 @@ namespace ATC { // constructor LambdaSquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1371,7 +1371,7 @@ namespace ATC { // constructor AtomicVelocityRescaleFactor(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1403,8 +1403,8 @@ namespace ATC { // constructor AtomicFluctuatingVelocityRescaled(ATC_Method * atc, - PerAtomQuantity * atomRescaleFactor = NULL, - PerAtomQuantity * atomFluctuatingVelocity = NULL, + PerAtomQuantity * atomRescaleFactor = nullptr, + PerAtomQuantity * atomFluctuatingVelocity = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1439,10 +1439,10 @@ namespace ATC { // constructor AtomicCombinedRescaleThermostatError(ATC_Method * atc, - PerAtomQuantity * atomFluctuatingMomentumRescaled = NULL, - PerAtomQuantity * atomMeanVelocity = NULL, - PerAtomQuantity * atomStreamingVelocity = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomFluctuatingMomentumRescaled = nullptr, + PerAtomQuantity * atomMeanVelocity = nullptr, + PerAtomQuantity * atomStreamingVelocity = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1483,8 +1483,8 @@ namespace ATC { // constructor AtomicThermostatForce(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomLambdas = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1519,8 +1519,8 @@ namespace ATC { // constructor AtomicKinetostatForceDisplacement(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1558,8 +1558,8 @@ namespace ATC { // constructor AtomicKinetostatForceVelocity(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL) : AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {}; @@ -1589,7 +1589,7 @@ namespace ATC { // constructor AtomicKinetostatForceStress(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, + PerAtomQuantity * atomLambda = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1621,7 +1621,7 @@ namespace ATC { // constructor PerAtomKernelFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1656,8 +1656,8 @@ namespace ATC { // constructor PerAtomShapeFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomElements = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomElements = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1695,8 +1695,8 @@ namespace ATC { // constructor LambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LambdaCouplingMatrix() { @@ -1734,9 +1734,9 @@ namespace ATC { // constructor LocalLambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * lambdaAtomMap = NULL, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * lambdaAtomMap = nullptr, + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LocalLambdaCouplingMatrix() { @@ -1771,7 +1771,7 @@ namespace ATC { GhostCouplingMatrix(ATC_Method * atc, SPAR_MAN * shapeFunction, SetDependencyManager * subsetNodes, - MatrixDependencyManager * nodeToOverlapMap = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr); // destructor virtual ~GhostCouplingMatrix() { diff --git a/lib/atc/PerPairQuantity.cpp b/lib/atc/PerPairQuantity.cpp index 3632a87aa9..01308e4b39 100644 --- a/lib/atc/PerPairQuantity.cpp +++ b/lib/atc/PerPairQuantity.cpp @@ -272,7 +272,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface, BondMatrix(lammpsInterface,pairMap,x,feMesh), kernelFunction_(kernelFunction) { - if (kernelFunction_ == NULL) + if (kernelFunction_ == nullptr) throw ATC_Error("No AtC kernel function initialized"); }; void BondMatrixKernel::reset(void) const diff --git a/lib/atc/PhysicsModel.h b/lib/atc/PhysicsModel.h index 50b327ce0b..8479727a89 100644 --- a/lib/atc/PhysicsModel.h +++ b/lib/atc/PhysicsModel.h @@ -105,7 +105,7 @@ namespace ATC const WeakEquation * weak_equation(FieldName field) const { std::map::const_iterator itr = weakEqns_.find(field); - if (itr == weakEqns_.end()) return NULL; + if (itr == weakEqns_.end()) return nullptr; return (weakEqns_.find(field))->second; } diff --git a/lib/atc/PoissonSolver.cpp b/lib/atc/PoissonSolver.cpp index 86670ae218..52909fc454 100644 --- a/lib/atc/PoissonSolver.cpp +++ b/lib/atc/PoissonSolver.cpp @@ -33,9 +33,9 @@ PoissonSolver::PoissonSolver( fieldName_(fieldName), rhsMask_(rhsMask), linear_(false), - solver_(NULL), - solverNL_(NULL), - tangent_(NULL), + solver_(nullptr), + solverNL_(nullptr), + tangent_(nullptr), solverType_(solverType), solverTol_(0), solverMaxIter_(0), diff --git a/lib/atc/PrescribedDataManager.cpp b/lib/atc/PrescribedDataManager.cpp index bd649c8ace..947191a0e4 100644 --- a/lib/atc/PrescribedDataManager.cpp +++ b/lib/atc/PrescribedDataManager.cpp @@ -34,8 +34,8 @@ namespace ATC { bcs_[thisField].reset(nNodes_,thisSize); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < thisSize ; ++idof) { - ics_[thisField](inode,idof) = NULL; - bcs_[thisField](inode,idof) = NULL; + ics_[thisField](inode,idof) = nullptr; + bcs_[thisField](inode,idof) = nullptr; } } // compact inode, value lists @@ -44,7 +44,7 @@ namespace ATC { elementSources_[thisField].reset(nElems_,thisSize); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < thisSize ; ++idof) { - elementSources_[thisField](ielem,idof) = NULL; + elementSources_[thisField](ielem,idof) = nullptr; } } // node based sources @@ -76,8 +76,8 @@ namespace ATC { bcs_[fieldName].reset(nNodes_,size); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < size ; ++idof) { - ics_[fieldName](inode,idof) = NULL; - bcs_[fieldName](inode,idof) = NULL; + ics_[fieldName](inode,idof) = nullptr; + bcs_[fieldName](inode,idof) = nullptr; } } @@ -85,7 +85,7 @@ namespace ATC { elementSources_[fieldName].reset(nElems_,size); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < size ; ++idof) { - elementSources_[fieldName](ielem,idof) = NULL; + elementSources_[fieldName](ielem,idof) = nullptr; } } } @@ -159,7 +159,7 @@ namespace ATC { set::const_iterator iset; for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) { int inode = *iset; - bcs_[thisField](inode,thisIndex) = NULL; + bcs_[thisField](inode,thisIndex) = nullptr; } } @@ -182,7 +182,7 @@ namespace ATC { const FieldName thisField, const int thisIndex) { - bcs_[thisField](nodeId,thisIndex) = NULL; + bcs_[thisField](nodeId,thisIndex) = nullptr; } //------------------------------------------------------------------------- // fix_flux @@ -203,7 +203,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (XT_Function*) f; } @@ -222,7 +222,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < XT_Function * > & dof = faceSources_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -244,7 +244,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (UXT_Function*) f; } @@ -263,7 +263,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -342,7 +342,7 @@ namespace ATC { set::const_iterator iset; for (iset = elemSet.begin(); iset != elemSet.end(); iset++) { int ielem = *iset; - elementSources_[thisField](ielem,thisIndex) = NULL; + elementSources_[thisField](ielem,thisIndex) = nullptr; } } //------------------------------------------------------------------------- diff --git a/lib/atc/Quadrature.cpp b/lib/atc/Quadrature.cpp index 8efe0e2969..94fe4a701c 100644 --- a/lib/atc/Quadrature.cpp +++ b/lib/atc/Quadrature.cpp @@ -5,14 +5,14 @@ using namespace std; namespace ATC { -Quadrature * Quadrature::myInstance_ = NULL; +Quadrature * Quadrature::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- Quadrature * Quadrature::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new Quadrature(); } return myInstance_; @@ -24,7 +24,7 @@ Quadrature * Quadrature::instance() void Quadrature::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } diff --git a/lib/atc/SchrodingerSolver.cpp b/lib/atc/SchrodingerSolver.cpp index d79fa85595..3819562a70 100644 --- a/lib/atc/SchrodingerSolver.cpp +++ b/lib/atc/SchrodingerSolver.cpp @@ -646,7 +646,7 @@ double fermi_dirac(const double E, const double T) double mu, double D ) : SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0), - solver_(NULL), + solver_(nullptr), mobility_(mu),diffusivity_(D) { Ef0_ = Ef0; diff --git a/lib/atc/SparseMatrix-inl.h b/lib/atc/SparseMatrix-inl.h index 36867ad8de..2923d6daa5 100644 --- a/lib/atc/SparseMatrix-inl.h +++ b/lib/atc/SparseMatrix-inl.h @@ -17,14 +17,14 @@ TRI_COORD::TRI_COORD(INDEX row, INDEX col, T val, bool add_to) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(INDEX rows, INDEX cols) - : _val(NULL), _ia(NULL), _ja(NULL), _size(0), _nRowsCRS(0), hasTemplate_(false), + : _val(nullptr), _ia(nullptr), _ja(nullptr), _size(0), _nRowsCRS(0), hasTemplate_(false), _nRows(rows),_nCols(cols) {} //----------------------------------------------------------------------------- // copy constructor //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const SparseMatrix& C) - : Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) + : Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { _copy(C); } @@ -33,7 +33,7 @@ SparseMatrix::SparseMatrix(const SparseMatrix& C) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const DenseMatrix& C) -: Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) +: Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { reset(C); } @@ -67,9 +67,9 @@ void SparseMatrix::_create(INDEX size, INDEX nrows) // assign memory to hold matrix try { - _val = (_size && nrows) ? new T [_size] : NULL; - _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : NULL; - _ja = (_size && nrows) ? new INDEX [_size] : NULL; + _val = (_size && nrows) ? new T [_size] : nullptr; + _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : nullptr; + _ja = (_size && nrows) ? new INDEX [_size] : nullptr; } catch (std::exception &e) { @@ -94,8 +94,8 @@ void SparseMatrix::_delete() if (_ia) delete [] _ia; if (_ja) delete [] _ja; _size = _nRowsCRS = 0; - _val = NULL; - _ia = _ja = NULL; + _val = nullptr; + _ia = _ja = nullptr; } //----------------------------------------------------------------------------- // full memory copy of C into this diff --git a/lib/atc/SparseVector.h b/lib/atc/SparseVector.h index 5cb16af527..d387b45b66 100644 --- a/lib/atc/SparseVector.h +++ b/lib/atc/SparseVector.h @@ -88,7 +88,7 @@ protected: //@{ SparseVector(const Matrix &c); SparseVector& operator=(Matrix &c); - T* ptr() const {return NULL; } + T* ptr() const {return nullptr; } //@} STORE data_; //*> sparse data structure diff --git a/lib/atc/SpeciesTimeIntegrator.cpp b/lib/atc/SpeciesTimeIntegrator.cpp index 3a196e745a..3215b159f8 100644 --- a/lib/atc/SpeciesTimeIntegrator.cpp +++ b/lib/atc/SpeciesTimeIntegrator.cpp @@ -108,9 +108,9 @@ namespace ATC { timeFilter_(speciesTimeIntegrator->time_filter()), massDensity_(atc_->field(MASS_DENSITY)), nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)), - nodalAtomicMassDensity_(NULL), + nodalAtomicMassDensity_(nullptr), speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)), - nodalAtomicSpeciesConcentration_(NULL), + nodalAtomicSpeciesConcentration_(nullptr), nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()), moleculeIds_(moleculeIds) { diff --git a/lib/atc/SpeciesTimeIntegrator.h b/lib/atc/SpeciesTimeIntegrator.h index c8fbe97c5e..64cc07022c 100644 --- a/lib/atc/SpeciesTimeIntegrator.h +++ b/lib/atc/SpeciesTimeIntegrator.h @@ -71,7 +71,7 @@ namespace ATC { const std::map > & moleculeIds); // destructor - virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=NULL;}; + virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=nullptr;}; /** create and get necessary transfer operators */ virtual void construct_transfers(); diff --git a/lib/atc/Stress.cpp b/lib/atc/Stress.cpp index 72656c21ed..a1445bd8ea 100644 --- a/lib/atc/Stress.cpp +++ b/lib/atc/Stress.cpp @@ -299,10 +299,10 @@ void StressCubicElasticDamped::stress(const FIELD_MATS &fields, // cauchy born model //============================================================================== StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb) - : cblattice_(NULL), - potential_(NULL), + : cblattice_(nullptr), + potential_(nullptr), makeLinear_(false), - cubicMat_(NULL), + cubicMat_(nullptr), initialized_(false), fixed_temperature_(0.), cbdata_(cb) diff --git a/lib/atc/Stress.h b/lib/atc/Stress.h index 513cdb2d97..5a7c9e30a3 100644 --- a/lib/atc/Stress.h +++ b/lib/atc/Stress.h @@ -149,7 +149,7 @@ namespace ATC { DENS_VEC elasticity_tensor(const VECTOR &Fv, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; DENS_VEC elasticity_tensor(const MATRIX &F, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; protected: - void linearize(MATRIX *F=NULL); + void linearize(MATRIX *F=nullptr); CBLattice *cblattice_; //*> CbLattice -> makes atom clusters. CbPotential *potential_; //*> CbPotential -> interatomic forces. bool makeLinear_; diff --git a/lib/atc/ThermalTimeIntegrator.cpp b/lib/atc/ThermalTimeIntegrator.cpp index e74d46a20c..8c0b8d6dae 100644 --- a/lib/atc/ThermalTimeIntegrator.cpp +++ b/lib/atc/ThermalTimeIntegrator.cpp @@ -150,7 +150,7 @@ namespace ATC { temperatureRoc_(atc_->field_roc(TEMPERATURE)), temperature2Roc_(atc_->field_2roc(TEMPERATURE)), nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)), - nodalAtomicTemperature_(NULL), + nodalAtomicTemperature_(nullptr), temperatureRhs_(atc_->field_rhs(TEMPERATURE)), nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE)) { @@ -384,7 +384,7 @@ namespace ATC { nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()), nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()), atomicTemperatureDelta_(atc_->num_nodes(),1), - nodalAtomicEnergy_(NULL), + nodalAtomicEnergy_(nullptr), nodalAtomicEnergyOld_(atc_->num_nodes(),1), nodalAtomicTemperatureOld_(atc_->num_nodes(),1) { diff --git a/lib/atc/Thermostat.cpp b/lib/atc/Thermostat.cpp index a602105854..217f2394e2 100644 --- a/lib/atc/Thermostat.cpp +++ b/lib/atc/Thermostat.cpp @@ -367,7 +367,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL) + atomVelocities_(nullptr) { fieldMask_(TEMPERATURE,FLUX) = true; lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1); // data associated with stage 3 in ATC_Method::initialize @@ -425,7 +425,7 @@ namespace ATC { ThermostatRescale::ThermostatRescale(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), nodalTemperature_(atc_->field(TEMPERATURE)), - atomVelocityRescalings_(NULL) + atomVelocityRescalings_(nullptr) { // do nothing } @@ -535,7 +535,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - nodalAtomicFluctuatingPotentialEnergy_(NULL) + nodalAtomicFluctuatingPotentialEnergy_(nullptr) { // do nothing } @@ -607,7 +607,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), lambdaMaxIterations_(lambdaMaxIterations), - rhsLambdaSquared_(NULL), + rhsLambdaSquared_(nullptr), dtFactor_(1.) { fieldMask_(TEMPERATURE,FLUX) = true; @@ -741,21 +741,21 @@ namespace ATC { int /* lambdaMaxIterations */, const string & regulatorPrefix) : RegulatorMethod(thermostat,regulatorPrefix), - lambdaSolver_(NULL), + lambdaSolver_(nullptr), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL), + atomVelocities_(nullptr), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomLambdas_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomLambdas_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), isFirstTimestep_(true), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL) + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1); @@ -1389,7 +1389,7 @@ namespace ATC { int lambdaMaxIterations, const string & regulatorPrefix) : ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix), - atomThermostatForcesPredVel_(NULL), + atomThermostatForcesPredVel_(nullptr), filterCoefficient_(1.) { lambdaSolver_ = new ThermostatSolverFixed(thermostat, @@ -1887,9 +1887,9 @@ namespace ATC { int lambdaMaxIterations, bool constructThermostats) : RegulatorMethod(thermostat), - thermostatFlux_(NULL), - thermostatFixed_(NULL), - thermostatBcs_(NULL) + thermostatFlux_(nullptr), + thermostatFixed_(nullptr), + thermostatBcs_(nullptr) { if (constructThermostats) { thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux"); @@ -2022,10 +2022,10 @@ namespace ATC { ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), timeFilter_(atomicRegulator_->time_filter()), - lambdaPowerFiltered_(NULL), - atomThermostatForces_(NULL), + lambdaPowerFiltered_(nullptr), + atomThermostatForces_(nullptr), prescribedDataMgr_(atc_->prescribed_data_manager()), - atomMasses_(NULL) + atomMasses_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1); @@ -2080,8 +2080,8 @@ namespace ATC { ThermostatGlc(thermostat), nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)), heatSource_(atc_->atomic_source(TEMPERATURE)), - nodalAtomicPower_(NULL), - nodalAtomicLambdaPower_(NULL) + nodalAtomicPower_(nullptr), + nodalAtomicLambdaPower_(nullptr) { // do nothing } @@ -2287,8 +2287,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) : ThermostatPowerVerlet(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // set up data consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1); @@ -2505,8 +2505,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) : ThermostatPowerVerletFiltered(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1); diff --git a/lib/atc/TimeFilter.cpp b/lib/atc/TimeFilter.cpp index 08cb64c8fe..ece3429c86 100644 --- a/lib/atc/TimeFilter.cpp +++ b/lib/atc/TimeFilter.cpp @@ -210,7 +210,7 @@ namespace ATC { } else if (filterType_ == STEP_FILTER) { newTimeFilter = new TimeFilterStep(*this); - } else newTimeFilter = NULL; + } else newTimeFilter = nullptr; } else { // default to return base class newTimeFilter = new TimeFilter(*this); diff --git a/lib/atc/TimeIntegrator.cpp b/lib/atc/TimeIntegrator.cpp index 4e8dec8c62..f370d17170 100644 --- a/lib/atc/TimeIntegrator.cpp +++ b/lib/atc/TimeIntegrator.cpp @@ -17,10 +17,10 @@ namespace ATC { AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) : atc_(atc), atomType_(atomType), - mass_(NULL), - position_(NULL), - velocity_(NULL), - force_(NULL) + mass_(nullptr), + position_(nullptr), + velocity_(nullptr), + force_(nullptr) { // do nothing } @@ -90,9 +90,9 @@ namespace ATC { //-------------------------------------------------------- TimeIntegrator::TimeIntegrator(ATC_Coupling * atc, TimeIntegrationType timeIntegrationType) : - timeIntegrationMethod_(NULL), + timeIntegrationMethod_(nullptr), atc_(atc), - timeFilter_(NULL), + timeFilter_(nullptr), timeFilterManager_(atc_->time_filter_manager()), timeIntegrationType_(timeIntegrationType), needReset_(true) diff --git a/lib/atc/TransferLibrary.cpp b/lib/atc/TransferLibrary.cpp index d0db0076d7..b77a91fd2e 100644 --- a/lib/atc/TransferLibrary.cpp +++ b/lib/atc/TransferLibrary.cpp @@ -816,7 +816,7 @@ namespace ATC { for (unsigned i = 0; i < quantity_.size(); ++i) { if (quantity_[i]) delete quantity_[i]; } - quantity_.resize(source.size(),NULL); + quantity_.resize(source.size(),nullptr); for (unsigned i = 0; i < source.size(); i++) { quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols()); } @@ -1363,7 +1363,7 @@ namespace ATC { { pointToElementMap_->register_dependence(this); pointPositions_->register_dependence(this); - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } @@ -1428,7 +1428,7 @@ namespace ATC { atomPositions_->register_dependence(this); // storage container - matrices_.resize(atc->nsd(),NULL); + matrices_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { matrices_[i] = new AtcAtomSparseMatrix(atc,feEngine_->num_nodes(), feEngine_->num_nodes_per_element(), @@ -1440,7 +1440,7 @@ namespace ATC { matrices_[i]->register_dependence(this); } - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); } //-------------------------------------------------------- @@ -1926,7 +1926,7 @@ namespace ATC { VectorTransfer(), feEngine_(atc->fe_engine()) { - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } diff --git a/lib/atc/TransferLibrary.h b/lib/atc/TransferLibrary.h index 3a0f420f37..d1f27e5e6d 100644 --- a/lib/atc/TransferLibrary.h +++ b/lib/atc/TransferLibrary.h @@ -115,7 +115,7 @@ namespace ATC { // constructor NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction, - PerAtomQuantity * atomElement=NULL); + PerAtomQuantity * atomElement=nullptr); // destructor virtual ~NodalAtomVolumeElement() { @@ -173,7 +173,7 @@ namespace ATC { // constructor AtomTypeElement(ATC_Coupling * atc, - PerAtomQuantity * atomElement = NULL); + PerAtomQuantity * atomElement = nullptr); // destructor virtual ~AtomTypeElement() { @@ -211,8 +211,8 @@ namespace ATC { // constructor ElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~ElementMask() { @@ -251,7 +251,7 @@ namespace ATC { // constructor AtomElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasAtoms = NULL); + MatrixDependencyManager * hasAtoms = nullptr); // destructor virtual ~AtomElementMask() { @@ -287,8 +287,8 @@ namespace ATC { // constructor NodalGeometryType(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~NodalGeometryType() { @@ -338,7 +338,7 @@ namespace ATC { // constructor NodalGeometryTypeElementSet(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL); + MatrixDependencyManager * hasInternal = nullptr); // destructor virtual ~NodalGeometryTypeElementSet() { @@ -659,7 +659,7 @@ namespace ATC { // constructor RegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL); + MatrixDependencyManager * nodalGeometryType = nullptr); // destructor virtual ~RegulatedNodes() { @@ -721,7 +721,7 @@ namespace ATC { // constructor FluxNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -751,7 +751,7 @@ namespace ATC { // constructor BoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -781,7 +781,7 @@ namespace ATC { // constructor FluxBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -811,7 +811,7 @@ namespace ATC { // constructor AllRegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -841,7 +841,7 @@ namespace ATC { // constructor FixedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -871,7 +871,7 @@ namespace ATC { // constructor FixedBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FixedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -1052,8 +1052,8 @@ namespace ATC { // constructor PerAtomShapeFunctionGradient(ATC_Method * atc, - MatrixDependencyManager* atomToElementMap = NULL, - DENS_MAN* atomPositions = NULL, + MatrixDependencyManager* atomToElementMap = nullptr, + DENS_MAN* atomPositions = nullptr, const std::string & tag = "AtomicShapeFunctionGradient", AtomType atomType = INTERNAL); diff --git a/lib/atc/TransferOperator.h b/lib/atc/TransferOperator.h index 5f776d04ca..5cf578b77c 100644 --- a/lib/atc/TransferOperator.h +++ b/lib/atc/TransferOperator.h @@ -542,7 +542,7 @@ namespace ATC { AtfProjection(ATC_Method * atc, PerAtomQuantity * source, SPAR_MAN * accumulant, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjection(); @@ -587,7 +587,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, const double scale, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionScaled(); @@ -620,7 +620,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, DENS_MAN * reference, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionReferenced(); diff --git a/lib/atc/Utility.h b/lib/atc/Utility.h index 2c0ea7270f..6693df9323 100644 --- a/lib/atc/Utility.h +++ b/lib/atc/Utility.h @@ -226,7 +226,7 @@ namespace ATC_Utility { char *endptr; strtod(s.c_str(), &endptr); - if(endptr != NULL && *endptr == '\0') return true; + if(endptr != nullptr && *endptr == '\0') return true; return false; } diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 7bf6125bc6..2eebfcc0ce 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(NULL),next(NULL){ + :descriptor(descriptor_),prev(nullptr),next(nullptr){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=NULL; - prev=NULL; + glogp->next=nullptr; + prev=nullptr; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index c29f72773f..0f79fc4184 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(NULL,1) { + recmatrix(): parr(nullptr,1) { sizey=sizex=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(NULL,1) { + sqmatrix(): parr(nullptr,1) { size=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(NULL){ + sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not NULL, puts the found value there - virtual int Find(long i, long j, T *retval=NULL)=0; - virtual int Find(long i, long j, T **retval=NULL)=0; + //e if retval is not nullptr, puts the found value there + virtual int Find(long i, long j, T *retval=nullptr)=0; + virtual int Find(long i, long j, T **retval=nullptr)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=NULL){ + int Find(long i, long j, T *retval=nullptr){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index a1a4feb0ff..8e5fc7df45 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=NULL, int managed=0){ + void reset(T* ptr=nullptr, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==NULL than p is not managed (as in mngptr) + int *num; //if num==nullptr than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=NULL; + else num=nullptr; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } public: - shptr(T* p=NULL, int managed=1){ + shptr(T* p=nullptr, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=NULL; + num=nullptr; } - p=NULL; + p=nullptr; } } bool valid() const { - return p!=NULL; + return p!=nullptr; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 468abbda99..534cea44aa 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=NULL) const { + T maxcoord(int *ind=nullptr) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 7e82af0f65..6e809dd65c 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=NULL; +message_logger *message_logger::glogp=nullptr; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index e118b76f36..4c65440014 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ + void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=NULL )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); + /// Default (q=nullptr )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=NULL); + virtual int interaction_ii(int flag,Vector_3P fi=nullptr); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 2c58bdaf28..55105066de 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be NULL, \n +/// will not update electronic force arrays, which may be nullptr, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 44fb757576..0ffef2645d 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); + /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be NULL, \n + /// will not update electronic force arrays, which may be nullptr, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index 1002dc35d8..61e83f44ab 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -22,7 +22,7 @@ colvar::colvar() { - runave_os = NULL; + runave_os = nullptr; prev_timestep = -1L; after_restart = false; @@ -62,7 +62,7 @@ int colvar::init(std::string const &conf) get_keyval(conf, "name", this->name, (std::string("colvar")+cvm::to_str(cv->variables()->size()))); - if ((cvm::colvar_by_name(this->name) != NULL) && + if ((cvm::colvar_by_name(this->name) != nullptr) && (cvm::colvar_by_name(this->name) != this)) { cvm::error("Error: this colvar cannot have the same name, \""+this->name+ "\", as another colvar.\n", @@ -744,7 +744,7 @@ template int colvar::init_components_type(std::string c : ".\n")); cvm::increase_depth(); cvc *cvcp = new def_class_name(def_conf); - if (cvcp != NULL) { + if (cvcp != nullptr) { cvcs.push_back(cvcp); cvcp->check_keywords(def_conf, def_config_key); cvcp->config_key = def_config_key; @@ -994,7 +994,7 @@ int colvar::parse_analysis(std::string const &conf) acf_type = acf_vel; enable(f_cv_fdiff_velocity); colvar *cv2 = cvm::colvar_by_name(acf_colvar_name); - if (cv2 == NULL) { + if (cv2 == nullptr) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -1215,14 +1215,14 @@ colvar::~colvar() for (std::vector::iterator cei = value_evaluators.begin(); cei != value_evaluators.end(); ++cei) { - if (*cei != NULL) delete (*cei); + if (*cei != nullptr) delete (*cei); } value_evaluators.clear(); for (std::vector::iterator gei = gradient_evaluators.begin(); gei != gradient_evaluators.end(); ++gei) { - if (*gei != NULL) delete (*gei); + if (*gei != nullptr) delete (*gei); } gradient_evaluators.clear(); #endif @@ -1972,7 +1972,7 @@ void const *colvar::get_cvc_param_ptr(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return NULL; + return nullptr; } @@ -1983,7 +1983,7 @@ colvarvalue const *colvar::get_cvc_param_grad(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param_grad() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return NULL; + return nullptr; } @@ -2422,7 +2422,7 @@ int colvar::calc_acf() // the pointer to each vector is changed at every step colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name); - if (cfcv == NULL) { + if (cfcv == nullptr) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -2660,7 +2660,7 @@ int colvar::calc_runave() if ((*x_history_p).size() >= runave_length-1) { - if (runave_os == NULL) { + if (runave_os == nullptr) { if (runave_outfile.size() == 0) { runave_outfile = std::string(cvm::output_prefix()+"."+ this->name+".runave.traj"); diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index 180fc69a85..2796f3d28b 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -105,7 +105,7 @@ cvm::atom_group::~atom_group() if (fitting_group) { delete fitting_group; - fitting_group = NULL; + fitting_group = nullptr; } cvm::main()->unregister_named_atom_group(this); @@ -217,7 +217,7 @@ int cvm::atom_group::init() b_center = false; b_rotate = false; b_user_defined_fit = false; - fitting_group = NULL; + fitting_group = nullptr; noforce = false; @@ -368,7 +368,7 @@ int cvm::atom_group::parse(std::string const &group_conf) // Optional group name will let other groups reuse atom definition if (get_keyval(group_conf, "name", name)) { - if ((cvm::atom_group_by_name(this->name) != NULL) && + if ((cvm::atom_group_by_name(this->name) != nullptr) && (cvm::atom_group_by_name(this->name) != this)) { cvm::error("Error: this atom group cannot have the same name, \""+this->name+ "\", as another atom group.\n", @@ -395,7 +395,7 @@ int cvm::atom_group::parse(std::string const &group_conf) std::string atoms_of = ""; if (get_keyval(group_conf, "atomsOfGroup", atoms_of)) { atom_group * ag = atom_group_by_name(atoms_of); - if (ag == NULL) { + if (ag == nullptr) { cvm::error("Error: cannot find atom group with name " + atoms_of + ".\n"); return COLVARS_ERROR; } diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index 09bcca01b5..cdbc13699b 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -47,7 +47,7 @@ int colvarbias::init(std::string const &conf) { colvarbias *bias_with_name = cvm::bias_by_name(this->name); - if (bias_with_name != NULL) { + if (bias_with_name != nullptr) { if ((bias_with_name->rank != this->rank) || (bias_with_name->bias_type != this->bias_type)) { cvm::error("Error: this bias cannot have the same name, \""+this->name+ @@ -295,8 +295,8 @@ int colvarbias::update() colvar_values[i] = colvars[i]->value(); } - error_code |= calc_energy(NULL); - error_code |= calc_forces(NULL); + error_code |= calc_energy(nullptr); + error_code |= calc_forces(nullptr); return error_code; } @@ -547,8 +547,8 @@ colvarbias_ti::colvarbias_ti(char const *key) : colvarbias(key) { provide(f_cvb_calc_ti_samples); - ti_avg_forces = NULL; - ti_count = NULL; + ti_avg_forces = nullptr; + ti_count = nullptr; } @@ -560,13 +560,13 @@ colvarbias_ti::~colvarbias_ti() int colvarbias_ti::clear_state_data() { - if (ti_avg_forces != NULL) { + if (ti_avg_forces != nullptr) { delete ti_avg_forces; - ti_avg_forces = NULL; + ti_avg_forces = nullptr; } - if (ti_count != NULL) { + if (ti_count != nullptr) { delete ti_count; - ti_count = NULL; + ti_count = nullptr; } return COLVARS_OK; } @@ -622,7 +622,7 @@ int colvarbias_ti::init(std::string const &conf) int colvarbias_ti::init_grids() { if (is_enabled(f_cvb_calc_ti_samples)) { - if (ti_avg_forces == NULL) { + if (ti_avg_forces == nullptr) { ti_bin.resize(num_variables()); ti_system_forces.resize(num_variables()); for (size_t icv = 0; icv < num_variables(); icv++) { @@ -643,7 +643,7 @@ int colvarbias_ti::init_grids() int colvarbias_ti::update() { - return update_system_forces(NULL); + return update_system_forces(nullptr); } @@ -679,7 +679,7 @@ int colvarbias_ti::update_system_forces(std::vector const ti_system_forces[i] = variables(i)->total_force(); } else { ti_system_forces[i] = variables(i)->total_force() - - ((subtract_forces != NULL) ? + ((subtract_forces != nullptr) ? (*subtract_forces)[i] : previous_colvar_forces[i]); } } @@ -759,7 +759,7 @@ int colvarbias_ti::write_output_files() std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name; - std::ostream *os = NULL; + std::ostream *os = nullptr; if (is_enabled(f_cvb_write_ti_samples)) { std::string const ti_count_file_name(ti_output_prefix+".ti.count"); diff --git a/lib/colvars/colvarbias.h b/lib/colvars/colvarbias.h index 5179c42853..20c346f81c 100644 --- a/lib/colvars/colvarbias.h +++ b/lib/colvars/colvarbias.h @@ -58,12 +58,12 @@ public: virtual int update(); /// Compute the energy of the bias - /// Uses the vector of colvar values provided if not NULL, and the values + /// Uses the vector of colvar values provided if not nullptr, and the values /// currently cached in the bias instance otherwise virtual int calc_energy(std::vector const *values); /// Compute the forces due to the bias - /// Uses the vector of colvar values provided if not NULL, and the values + /// Uses the vector of colvar values provided if not nullptr, and the values /// currently cached in the bias instance otherwise virtual int calc_forces(std::vector const *values); diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index 5382a828f7..9926579a8d 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -18,16 +18,16 @@ colvarbias_abf::colvarbias_abf(char const *key) b_UI_estimator(false), b_CZAR_estimator(false), pabf_freq(0), - system_force(NULL), - gradients(NULL), - samples(NULL), - pmf(NULL), - z_gradients(NULL), - z_samples(NULL), - czar_gradients(NULL), - czar_pmf(NULL), - last_gradients(NULL), - last_samples(NULL) + system_force(nullptr), + gradients(nullptr), + samples(nullptr), + pmf(nullptr), + z_gradients(nullptr), + z_samples(nullptr), + czar_gradients(nullptr), + czar_pmf(nullptr), + last_gradients(nullptr), + last_samples(nullptr) { } @@ -261,37 +261,37 @@ colvarbias_abf::~colvarbias_abf() { if (samples) { delete samples; - samples = NULL; + samples = nullptr; } if (gradients) { delete gradients; - gradients = NULL; + gradients = nullptr; } if (pmf) { delete pmf; - pmf = NULL; + pmf = nullptr; } if (z_samples) { delete z_samples; - z_samples = NULL; + z_samples = nullptr; } if (z_gradients) { delete z_gradients; - z_gradients = NULL; + z_gradients = nullptr; } if (czar_gradients) { delete czar_gradients; - czar_gradients = NULL; + czar_gradients = nullptr; } if (czar_pmf) { delete czar_pmf; - czar_pmf = NULL; + czar_pmf = nullptr; } // shared ABF @@ -299,17 +299,17 @@ colvarbias_abf::~colvarbias_abf() // but now we can call shared externally if (last_samples) { delete last_samples; - last_samples = NULL; + last_samples = nullptr; } if (last_gradients) { delete last_gradients; - last_gradients = NULL; + last_gradients = nullptr; } if (system_force) { delete [] system_force; - system_force = NULL; + system_force = nullptr; } } @@ -488,7 +488,7 @@ int colvarbias_abf::update() } /// Add the bias energy for 1D ABF - bias_energy = calc_energy(NULL); + bias_energy = calc_energy(nullptr); return COLVARS_OK; } diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 92985b0f61..44862ba256 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -15,7 +15,7 @@ colvarbias_histogram::colvarbias_histogram(char const *key) : colvarbias(key), - grid(NULL), out_name("") + grid(nullptr), out_name("") { provide(f_cvb_bypass_ext_lagrangian); // Allow histograms of actual cv for extended-Lagrangian } @@ -105,7 +105,7 @@ colvarbias_histogram::~colvarbias_histogram() { if (grid) { delete grid; - grid = NULL; + grid = nullptr; } } diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 05f293d872..03c1886a8f 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key) : colvarbias(key), colvarbias_ti(key) { new_hills_begin = hills.end(); - hills_traj_os = NULL; + hills_traj_os = nullptr; hill_width = 0.0; @@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key) use_grids = true; grids_freq = 0; rebin_grids = false; - hills_energy = NULL; - hills_energy_gradients = NULL; + hills_energy = nullptr; + hills_energy_gradients = nullptr; dump_fes = true; keep_hills = false; @@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf) get_keyval(conf, "keepHills", keep_hills, keep_hills); get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save); - if (hills_energy == NULL) { + if (hills_energy == nullptr) { hills_energy = new colvar_grid_scalar(colvars); hills_energy_gradients = new colvar_grid_gradient(colvars); } @@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf) int colvarbias_meta::init_ebmeta_params(std::string const &conf) { // for ebmeta - target_dist = NULL; + target_dist = nullptr; get_keyval(conf, "ebMeta", ebmeta, false); if(ebmeta){ if (use_grids && expand_grids) { @@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta() if (hills_traj_os) { proxy->close_output_stream(hills_traj_file_name()); - hills_traj_os = NULL; + hills_traj_os = nullptr; } if (target_dist) { delete target_dist; - target_dist = NULL; + target_dist = nullptr; } } @@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data() { if (hills_energy) { delete hills_energy; - hills_energy = NULL; + hills_energy = nullptr; } if (hills_energy_gradients) { delete hills_energy_gradients; - hills_energy_gradients = NULL; + hills_energy_gradients = nullptr; } hills.clear(); @@ -451,8 +451,8 @@ int colvarbias_meta::update() error_code |= replica_share(); } - error_code |= calc_energy(NULL); - error_code |= calc_forces(NULL); + error_code |= calc_energy(nullptr); + error_code |= calc_forces(nullptr); return error_code; } @@ -593,7 +593,7 @@ int colvarbias_meta::update_bias() std::vector curr_bin = hills_energy->get_colvars_index(); hills_energy_sum_here = hills_energy->value(curr_bin); } else { - calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL); + calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr); } hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann())); } @@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first, std::vector colvar_forces_scalar(num_variables()); std::vector he_ix = he->new_index(); - std::vector hg_ix = (hg != NULL) ? hg->new_index() : std::vector (0); + std::vector hg_ix = (hg != nullptr) ? hg->new_index() : std::vector (0); cvm::real hills_energy_here = 0.0; std::vector hills_forces_here(num_variables(), 0.0); size_t count = 0; size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1))); - if (hg != NULL) { + if (hg != nullptr) { // loop over the points of the grid for ( ; @@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) hills_energy_gradients = new colvar_grid_gradient(colvars); } - colvar_grid_scalar *hills_energy_backup = NULL; - colvar_grid_gradient *hills_energy_gradients_backup = NULL; + colvar_grid_scalar *hills_energy_backup = nullptr; + colvar_grid_gradient *hills_energy_gradients_backup = nullptr; if (has_data) { if (cvm::debug()) @@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_pos = is.tellg(); std::string key; if (!(is >> key)) { - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == NULL) + if (hills_energy_backup == nullptr) cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_gradients_pos = is.tellg(); if (!(is >> key)) { - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_gradients_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == NULL) + if (hills_energy_backup == nullptr) cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n"); - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { // now that we have successfully updated the grids, delete the // backup copies if (cvm::debug()) @@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output() // TODO: one may want to specify the path manually for intricated filesystems? char *pwd = new char[3001]; - if (GETCWD(pwd, 3000) == NULL) + if (GETCWD(pwd, 3000) == nullptr) cvm::fatal_error("Error: cannot get the path of the current working directory.\n"); replica_list_file = (std::string(pwd)+std::string(PATHSEP)+ @@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file() { int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; - if (proxy->get_output_stream(replica_hills_file) != NULL) { + if (proxy->get_output_stream(replica_hills_file) != nullptr) { error_code |= proxy->close_output_stream(replica_hills_file); } error_code |= proxy->remove_file(replica_hills_file); diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index 05d1195d58..d45d85111a 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -135,7 +135,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf, char const *group_key, bool optional) { - cvm::atom_group *group = NULL; + cvm::atom_group *group = nullptr; std::string group_conf; if (key_lookup(conf, group_key, &group_conf)) { @@ -298,7 +298,7 @@ colvar::cvc::~cvc() free_children_deps(); remove_all_children(); for (size_t i = 0; i < atom_groups.size(); i++) { - if (atom_groups[i] != NULL) delete atom_groups[i]; + if (atom_groups[i] != nullptr) delete atom_groups[i]; } } @@ -344,7 +344,7 @@ colvarvalue const *colvar::cvc::get_param_grad(std::string const ¶m_name) { colvarvalue const *ptr = reinterpret_cast(get_param_grad_ptr(param_name)); - return ptr != NULL ? ptr : NULL; + return ptr != nullptr ? ptr : nullptr; } @@ -553,7 +553,7 @@ void colvar::cvc::debug_gradients() } } - if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) { + if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != nullptr)) { cvm::atom_group *ref_group = group->fitting_group; group->read_positions(); group->calc_required_properties(); diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index f0fbabfc4f..f36d055528 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -91,7 +91,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0, colvar::coordnum::coordnum(std::string const &conf) - : cvc(conf), b_anisotropic(false), pairlist(NULL) + : cvc(conf), b_anisotropic(false), pairlist(nullptr) { function_type = "coordnum"; @@ -102,7 +102,7 @@ colvar::coordnum::coordnum(std::string const &conf) group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); - if (group1 == NULL || group2 == NULL) { + if (group1 == nullptr || group2 == nullptr) { cvm::error("Error: failed to initialize atom groups.\n", INPUT_ERROR); return; @@ -183,7 +183,7 @@ colvar::coordnum::coordnum(std::string const &conf) colvar::coordnum::~coordnum() { - if (pairlist != NULL) { + if (pairlist != nullptr) { delete [] pairlist; } } @@ -218,11 +218,11 @@ template void colvar::coordnum::main_loop(bool **pairlist_elem) template int colvar::coordnum::compute_coordnum() { - bool const use_pairlist = (pairlist != NULL); - bool const rebuild_pairlist = (pairlist != NULL) && + bool const use_pairlist = (pairlist != nullptr); + bool const rebuild_pairlist = (pairlist != nullptr) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : NULL; + bool *pairlist_elem = use_pairlist ? pairlist : nullptr; if (b_anisotropic) { @@ -239,7 +239,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags | ef_anisotropic; - main_loop(NULL); + main_loop(nullptr); } } else { @@ -257,7 +257,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags; - main_loop(NULL); + main_loop(nullptr); } } @@ -367,7 +367,7 @@ void colvar::h_bond::calc_value() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - NULL, 0.0); + nullptr, 0.0); } @@ -378,7 +378,7 @@ void colvar::h_bond::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - NULL, 0.0); + nullptr, 0.0); } @@ -393,7 +393,7 @@ simple_scalar_dist_functions(h_bond) colvar::selfcoordnum::selfcoordnum(std::string const &conf) - : cvc(conf), pairlist(NULL) + : cvc(conf), pairlist(nullptr) { function_type = "selfcoordnum"; x.type(colvarvalue::type_scalar); @@ -438,7 +438,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf) colvar::selfcoordnum::~selfcoordnum() { - if (pairlist != NULL) { + if (pairlist != nullptr) { delete [] pairlist; } } @@ -448,11 +448,11 @@ template int colvar::selfcoordnum::compute_selfcoordnum() { cvm::rvector const r0_vec(0.0); // TODO enable the flag? - bool const use_pairlist = (pairlist != NULL); - bool const rebuild_pairlist = (pairlist != NULL) && + bool const use_pairlist = (pairlist != nullptr); + bool const rebuild_pairlist = (pairlist != nullptr) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : NULL; + bool *pairlist_elem = use_pairlist ? pairlist : nullptr; size_t i = 0, j = 0; size_t const n = group1->size(); @@ -601,13 +601,13 @@ void colvar::groupcoordnum::calc_value() x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } else { int const flags = coordnum::ef_null; x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } } @@ -624,13 +624,13 @@ void colvar::groupcoordnum::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } else { int const flags = coordnum::ef_gradients; coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } group1->set_weighted_gradient(group1_com_atom.grad); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index c3c1ee55d5..88a5088aaf 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -964,7 +964,7 @@ colvar::rmsd::rmsd(std::string const &conf) } bool b_Jacobian_derivative = true; - if (atoms->fitting_group != NULL && b_Jacobian_derivative) { + if (atoms->fitting_group != nullptr && b_Jacobian_derivative) { cvm::log("The option \"fittingGroup\" (alternative group for fitting) was enabled: " "Jacobian derivatives of the RMSD will not be calculated.\n"); b_Jacobian_derivative = false; diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index f83458b51c..f647211f6e 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -33,7 +33,7 @@ colvardeps::~colvardeps() { // Do not delete features if it's a static object // may change in the future though // for (i=0; i &colvars, {} colvar_grid_scalar::colvar_grid_scalar() - : colvar_grid(), samples(NULL) + : colvar_grid(), samples(nullptr) {} colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g) - : colvar_grid(g), samples(NULL) + : colvar_grid(g), samples(nullptr) { } colvar_grid_scalar::colvar_grid_scalar(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, 1), samples(NULL) + : colvar_grid(nx_i, 0.0, 1), samples(nullptr) { } colvar_grid_scalar::colvar_grid_scalar(std::vector &colvars, bool margin) - : colvar_grid(colvars, 0.0, 1, margin), samples(NULL) + : colvar_grid(colvars, 0.0, 1, margin), samples(nullptr) { } @@ -122,15 +122,15 @@ cvm::real colvar_grid_scalar::entropy() const colvar_grid_gradient::colvar_grid_gradient() - : colvar_grid(), samples(NULL) + : colvar_grid(), samples(nullptr) {} colvar_grid_gradient::colvar_grid_gradient(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, nx_i.size()), samples(NULL) + : colvar_grid(nx_i, 0.0, nx_i.size()), samples(nullptr) {} colvar_grid_gradient::colvar_grid_gradient(std::vector &colvars) - : colvar_grid(colvars, 0.0, colvars.size()), samples(NULL) + : colvar_grid(colvars, 0.0, colvars.size()), samples(nullptr) {} void colvar_grid_gradient::write_1D_integral(std::ostream &os) diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 1d5f75bbca..48a38a6076 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -30,11 +30,11 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) depth_s = 0; log_level_ = 10; - cv_traj_os = NULL; + cv_traj_os = nullptr; xyz_reader_use_count = 0; - if (proxy == NULL) { + if (proxy == nullptr) { proxy = proxy_in; // Pointer to the proxy object parse = new colvarparse(); // Parsing object for global options version_int = proxy->get_version_from_string(COLVARS_VERSION); @@ -573,7 +573,7 @@ colvarbias * colvarmodule::bias_by_name(std::string const &name) return (*bi); } } - return NULL; + return nullptr; } @@ -587,7 +587,7 @@ colvar *colvarmodule::colvar_by_name(std::string const &name) return (*cvi); } } - return NULL; + return nullptr; } @@ -601,7 +601,7 @@ cvm::atom_group *colvarmodule::atom_group_by_name(std::string const &name) return (*agi); } } - return NULL; + return nullptr; } @@ -631,7 +631,7 @@ int colvarmodule::change_configuration(std::string const &bias_name, cvm::increase_depth(); colvarbias *b; b = bias_by_name(bias_name); - if (b == NULL) { + if (b == nullptr) { cvm::error("Error: bias not found: " + bias_name); return COLVARS_ERROR; } @@ -647,7 +647,7 @@ std::string colvarmodule::read_colvar(std::string const &name) colvar *c; std::stringstream ss; c = colvar_by_name(name); - if (c == NULL) { + if (c == nullptr) { cvm::error("Error: colvar not found: " + name); return std::string(); } @@ -663,7 +663,7 @@ cvm::real colvarmodule::energy_difference(std::string const &bias_name, colvarbias *b; cvm::real energy_diff = 0.; b = bias_by_name(bias_name); - if (b == NULL) { + if (b == nullptr) { cvm::error("Error: bias not found: " + bias_name); return 0.; } @@ -678,7 +678,7 @@ int colvarmodule::bias_current_bin(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->current_bin(); } else { cvm::error("Error: bias not found.\n"); @@ -695,7 +695,7 @@ int colvarmodule::bias_bin_num(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->bin_num(); } else { cvm::error("Error: bias not found.\n"); @@ -712,7 +712,7 @@ int colvarmodule::bias_bin_count(std::string const &bias_name, size_t bin_index) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->bin_count(bin_index); } else { cvm::error("Error: bias not found.\n"); @@ -729,7 +729,7 @@ int colvarmodule::bias_share(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { b->replica_share(); ret = COLVARS_OK; } else { @@ -1037,7 +1037,7 @@ int colvarmodule::write_restart_file(std::string const &out_name) int colvarmodule::write_traj_files() { - if (cv_traj_os == NULL) { + if (cv_traj_os == nullptr) { if (open_traj_file(cv_traj_name) != COLVARS_OK) { return cvm::get_error(); } else { @@ -1057,7 +1057,7 @@ int colvarmodule::write_traj_files() write_traj(*cv_traj_os); } - if (restart_out_freq && (cv_traj_os != NULL)) { + if (restart_out_freq && (cv_traj_os != nullptr)) { // flush the trajectory file if we are at the restart frequency if ( (cvm::step_relative() > 0) && ((cvm::step_absolute() % restart_out_freq) == 0) ) { @@ -1151,8 +1151,8 @@ colvarmodule::~colvarmodule() atom_group::delete_features(); delete parse; - parse = NULL; - proxy = NULL; + parse = nullptr; + proxy = nullptr; } } @@ -1184,7 +1184,7 @@ int colvarmodule::reset() proxy->reset(); - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { // Do not close traj file here, as we might not be done with it yet. proxy->flush_output_stream(cv_traj_os); } @@ -1395,7 +1395,7 @@ std::istream & colvarmodule::read_objects_state(std::istream &is) if (static_cast(is.tellg()) == pos) { // This block has not been read by any object: discard it and move on // to the next one - is >> colvarparse::read_block(word, NULL); + is >> colvarparse::read_block(word, nullptr); } if (!is) break; @@ -1456,7 +1456,7 @@ int colvarmodule::write_output_files() } cvm::decrease_depth(); - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { // do not close, there may be another run command proxy->flush_output_stream(cv_traj_os); } @@ -1575,7 +1575,7 @@ std::ostream & colvarmodule::write_restart(std::ostream &os) int colvarmodule::open_traj_file(std::string const &file_name) { - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { return COLVARS_OK; } @@ -1591,7 +1591,7 @@ int colvarmodule::open_traj_file(std::string const &file_name) cv_traj_os = (cvm::proxy)->output_stream(file_name); } - if (cv_traj_os == NULL) { + if (cv_traj_os == nullptr) { cvm::error("Error: cannot write to file \""+file_name+"\".\n", FILE_ERROR); } @@ -1602,9 +1602,9 @@ int colvarmodule::open_traj_file(std::string const &file_name) int colvarmodule::close_traj_file() { - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { proxy->close_output_stream(cv_traj_name); - cv_traj_os = NULL; + cv_traj_os = nullptr; } return cvm::get_error(); } @@ -1672,7 +1672,7 @@ void cvm::log(std::string const &message, int min_log_level) { if (cvm::log_level() < min_log_level) return; // allow logging when the module is not fully initialized - size_t const d = (cvm::main() != NULL) ? depth() : 0; + size_t const d = (cvm::main() != nullptr) ? depth() : 0; if (d > 0) { proxy->log((std::string(2*d, ' '))+message); } else { @@ -1780,7 +1780,7 @@ int cvm::read_index_file(char const *filename) } if (index_of_group < 0) { index_group_names.push_back(group_name); - index_groups.push_back(NULL); + index_groups.push_back(nullptr); index_of_group = index_groups.size()-1; } } else { @@ -1799,7 +1799,7 @@ int cvm::read_index_file(char const *filename) pos = is.tellg(); } - if (old_index_group != NULL) { + if (old_index_group != nullptr) { bool equal = false; if (new_index_group->size() == old_index_group->size()) { if (std::equal(new_index_group->begin(), new_index_group->end(), @@ -1810,13 +1810,13 @@ int cvm::read_index_file(char const *filename) if (! equal) { new_index_group->clear(); delete new_index_group; - new_index_group = NULL; + new_index_group = nullptr; return cvm::error("Error: the index group \""+group_name+ "\" was redefined.\n", INPUT_ERROR); } else { old_index_group->clear(); delete old_index_group; - old_index_group = NULL; + old_index_group = nullptr; } } @@ -1850,7 +1850,7 @@ int colvarmodule::reset_index_groups() size_t i = 0; for ( ; i < index_groups.size(); i++) { delete index_groups[i]; - index_groups[i] = NULL; + index_groups[i] = nullptr; } index_group_names.clear(); index_groups.clear(); @@ -2179,7 +2179,7 @@ std::string cvm::wrap_string(std::string const &s, size_t nchars) // shared pointer to the proxy object -colvarproxy *colvarmodule::proxy = NULL; +colvarproxy *colvarmodule::proxy = nullptr; // static runtime data cvm::real colvarmodule::debug_gradients_step_size = 1.0e-07; diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index 9346e8e1d6..e06f05aca0 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -459,13 +459,13 @@ public: /// Backup a file before writing it static int backup_file(char const *filename); - /// Look up a bias by name; returns NULL if not found + /// Look up a bias by name; returns nullptr if not found static colvarbias * bias_by_name(std::string const &name); - /// Look up a colvar by name; returns NULL if not found + /// Look up a colvar by name; returns nullptr if not found static colvar * colvar_by_name(std::string const &name); - /// Look up a named atom group by name; returns NULL if not found + /// Look up a named atom group by name; returns nullptr if not found static atom_group * atom_group_by_name(std::string const &name); /// Load new configuration for the given bias - diff --git a/lib/colvars/colvarparams.cpp b/lib/colvars/colvarparams.cpp index e957a1841d..ea45c01104 100644 --- a/lib/colvars/colvarparams.cpp +++ b/lib/colvars/colvarparams.cpp @@ -76,7 +76,7 @@ void const *colvarparams::get_param_ptr(std::string const ¶m_name) return param_map[param_name]; } cvm::error("Error: parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return NULL; + return nullptr; } @@ -87,7 +87,7 @@ void const *colvarparams::get_param_grad_ptr(std::string const ¶m_name) } cvm::error("Error: gradient of parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return NULL; + return nullptr; } @@ -95,7 +95,7 @@ cvm::real colvarparams::get_param(std::string const ¶m_name) { cvm::real const *ptr = reinterpret_cast(get_param_ptr(param_name)); - return ptr != NULL ? *ptr : 0.0; + return ptr != nullptr ? *ptr : 0.0; } diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index a09d6be9ef..e61ebf355f 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -674,12 +674,12 @@ bool colvarparse::key_lookup(std::string const &conf, std::string const conf_lower(to_lower_cppstr(conf)); // by default, there is no value, unless we found one - if (data != NULL) { + if (data != nullptr) { data->clear(); } // start from the first occurrence of key - size_t pos = conf_lower.find(key, (save_pos != NULL) ? *save_pos : 0); + size_t pos = conf_lower.find(key, (save_pos != nullptr) ? *save_pos : 0); // iterate over all instances of the substring until it finds it as isolated keyword while (true) { @@ -727,7 +727,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != NULL) { + if (save_pos != nullptr) { // save the pointer for a future call (when iterating over multiple // valid instances of the same keyword) *save_pos = pos + key.size(); @@ -820,7 +820,7 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != NULL) { + if (data != nullptr) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) { @@ -834,7 +834,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != NULL) *save_pos = line_end; + if (save_pos != nullptr) *save_pos = line_end; return true; } diff --git a/lib/colvars/colvarparse.h b/lib/colvars/colvarparse.h index b7d42fdffa..fc1362b2b1 100644 --- a/lib/colvars/colvarparse.h +++ b/lib/colvars/colvarparse.h @@ -275,12 +275,12 @@ public: /// The keyword that identifies the block std::string const key; - /// Where to keep the data (may be NULL) + /// Where to keep the data (may be nullptr) std::string * const data; public: - read_block(std::string const &key_in, std::string *data_in = NULL); + read_block(std::string const &key_in, std::string *data_in = nullptr); ~read_block(); @@ -300,8 +300,8 @@ public: /// within "conf", useful when doing multiple calls bool key_lookup(std::string const &conf, char const *key, - std::string *data = NULL, - size_t *save_pos = NULL); + std::string *data = nullptr, + size_t *save_pos = nullptr); /// \brief Reads a configuration line, adds it to config_string, and returns /// the stream \param is Input stream \param line String that will hold the diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 63ae07a57c..7eb0b22cb5 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -296,7 +296,7 @@ void colvarproxy_atom_groups::clear_atom_group(int index) colvarproxy_smp::colvarproxy_smp() { b_smp_active = true; // May be disabled by user option - omp_lock_state = NULL; + omp_lock_state = nullptr; #if defined(_OPENMP) if (smp_thread_id() == 0) { omp_lock_state = reinterpret_cast(new omp_lock_t); @@ -459,7 +459,7 @@ int colvarproxy_smp::smp_unlock() colvarproxy_script::colvarproxy_script() { - script = NULL; + script = nullptr; } @@ -507,7 +507,7 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name colvarproxy_tcl::colvarproxy_tcl() { - tcl_interp_ = NULL; + tcl_interp_ = nullptr; } @@ -528,7 +528,7 @@ char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj) #if defined(COLVARS_TCL) return Tcl_GetString(reinterpret_cast(obj)); #else - return NULL; + return nullptr; #endif } @@ -666,7 +666,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, } std::ostream *os = get_output_stream(output_name); - if (os != NULL) return os; + if (os != nullptr) return os; if (!(mode & (std::ios_base::app | std::ios_base::ate))) { backup_file(output_name); @@ -675,7 +675,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, if (!osf->is_open()) { cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n", FILE_ERROR); - return NULL; + return nullptr; } output_stream_names.push_back(output_name); output_files.push_back(osf); @@ -692,7 +692,7 @@ std::ostream *colvarproxy_io::get_output_stream(std::string const &output_name) return *osi; } } - return NULL; + return nullptr; } @@ -794,7 +794,7 @@ int colvarproxy_io::rename_file(char const *filename, char const *newfilename) colvarproxy::colvarproxy() { - colvars = NULL; + colvars = nullptr; b_simulation_running = true; b_delete_requested = false; } diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index ba91afb40e..a46589a526 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -607,7 +607,7 @@ public: std::ios_base::openmode mode = std::ios_base::out); - /// Returns a reference to output_name if it exists, NULL otherwise + /// Returns a reference to output_name if it exists, nullptr otherwise virtual std::ostream *get_output_stream(std::string const &output_name); /// \brief Flushes the given output channel diff --git a/lib/colvars/colvarscript.cpp b/lib/colvars/colvarscript.cpp index 10b276c89e..a8b5d6ab2f 100644 --- a/lib/colvars/colvarscript.cpp +++ b/lib/colvars/colvarscript.cpp @@ -97,7 +97,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvar *cv = cvm::colvar_by_name(name); - if (cv == NULL) { + if (cv == nullptr) { result = "Colvar not found: " + name; return COLVARSCRIPT_ERROR; } @@ -111,7 +111,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvarbias *b = cvm::bias_by_name(name); - if (b == NULL) { + if (b == nullptr) { result = "Bias not found: " + name; return COLVARSCRIPT_ERROR; } @@ -186,7 +186,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) /// Parse config from string if (cmd == "config") { - return exec_command(cv_config, NULL, objc, objv); + return exec_command(cv_config, nullptr, objc, objv); } /// Load an input state file @@ -247,7 +247,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } else if (objc == 3) { // Failure of this function does not trigger an error, but // returns nonzero, to let scripts detect available frames - int error = proxy->set_frame(strtol(obj_to_str(objv[2]), NULL, 10)); + int error = proxy->set_frame(strtol(obj_to_str(objv[2]), nullptr, 10)); result = cvm::to_str(error == COLVARS_OK ? 0 : -1); return COLVARS_OK; } else { @@ -258,7 +258,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) if (cmd == "addenergy") { if (objc == 3) { - colvars->total_bias_energy += strtod(obj_to_str(objv[2]), NULL); + colvars->total_bias_energy += strtod(obj_to_str(objv[2]), nullptr); return COLVARS_OK; } else { result = "Wrong arguments to command \"addenergy\"\n" + help_string(); @@ -267,7 +267,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } if (cmd == "help") { - return exec_command(cv_help, NULL, objc, objv); + return exec_command(cv_help, nullptr, objc, objv); } result = "Syntax error\n" + help_string(); @@ -320,7 +320,7 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[]) // colvar destructor is tasked with the cleanup delete cv; // TODO this could be done by the destructors - if (colvars->cv_traj_os != NULL) { + if (colvars->cv_traj_os != nullptr) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -513,7 +513,7 @@ int colvarscript::proc_bias(colvarbias *b, int objc, unsigned char *const objv[] // the bias destructor takes care of the cleanup at cvm level delete b; // TODO this could be done by the destructors - if (colvars->cv_traj_os != NULL) { + if (colvars->cv_traj_os != nullptr) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -564,7 +564,7 @@ int colvarscript::proc_features(colvardeps *obj, if ((subcmd == "get") || (subcmd == "set")) { std::vector const &features = obj->features(); std::string const req_feature(obj_to_str(objv[3])); - colvardeps::feature *f = NULL; + colvardeps::feature *f = nullptr; int fid = 0; for (fid = 0; fid < int(features.size()); fid++) { if (features[fid]->description == @@ -574,7 +574,7 @@ int colvarscript::proc_features(colvardeps *obj, } } - if (f == NULL) { + if (f == nullptr) { result = "Error: feature \""+req_feature+"\" does not exist.\n"; return COLVARSCRIPT_ERROR; diff --git a/lib/colvars/colvarscript.h b/lib/colvars/colvarscript.h index 69d52cbb51..04679b37ad 100644 --- a/lib/colvars/colvarscript.h +++ b/lib/colvars/colvarscript.h @@ -278,7 +278,7 @@ extern "C" { 1, 1, { "E (float) - Amount of energy to add" }, cvm::main()->total_bias_energy += - strtod(script->obj_to_str(objv[2]), NULL); + strtod(script->obj_to_str(objv[2]), nullptr); return COLVARS_OK; ) diff --git a/lib/colvars/colvartypes.h b/lib/colvars/colvartypes.h index e5f12154e6..55401576b1 100644 --- a/lib/colvars/colvartypes.h +++ b/lib/colvars/colvartypes.h @@ -59,7 +59,7 @@ public: if (data.size() > 0) { return &(data[0]); } else { - return NULL; + return nullptr; } } @@ -520,7 +520,7 @@ public: if (rows.size() > 0) { return &(pointers[0]); } else { - return NULL; + return nullptr; } } diff --git a/lib/colvars/lepton/include/lepton/Operation.h b/lib/colvars/lepton/include/lepton/Operation.h index 1ddde0b8c0..68474137f1 100644 --- a/lib/colvars/lepton/include/lepton/Operation.h +++ b/lib/colvars/lepton/include/lepton/Operation.h @@ -186,7 +186,7 @@ public: } bool operator!=(const Operation& op) const { const Constant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -217,7 +217,7 @@ public: ExpressionTreeNode differentiate(const std::vector& children, const std::vector& childDerivs, const std::string& variable) const; bool operator!=(const Operation& op) const { const Variable* o = dynamic_cast(&op); - return (o == NULL || o->name != name); + return (o == nullptr || o->name != name); } private: std::string name; @@ -264,7 +264,7 @@ public: } bool operator!=(const Operation& op) const { const Custom* o = dynamic_cast(&op); - return (o == NULL || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); + return (o == nullptr || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); } private: std::string name; @@ -955,7 +955,7 @@ public: } bool operator!=(const Operation& op) const { const AddConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -988,7 +988,7 @@ public: } bool operator!=(const Operation& op) const { const MultiplyConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -1042,7 +1042,7 @@ public: } bool operator!=(const Operation& op) const { const PowerConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } bool isInfixOperator() const { return true; diff --git a/lib/colvars/lepton/src/CompiledExpression.cpp b/lib/colvars/lepton/src/CompiledExpression.cpp index 1ad348b47d..6abcad2de2 100644 --- a/lib/colvars/lepton/src/CompiledExpression.cpp +++ b/lib/colvars/lepton/src/CompiledExpression.cpp @@ -40,10 +40,10 @@ using namespace std; using namespace asmjit; #endif -CompiledExpression::CompiledExpression() : jitCode(NULL) { +CompiledExpression::CompiledExpression() : jitCode(nullptr) { } -CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(NULL) { +CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(nullptr) { ParsedExpression expr = expression.optimize(); // Just in case it wasn't already optimized. vector > temps; compileExpression(expr.getRootNode(), temps); @@ -59,11 +59,11 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit CompiledExpression::~CompiledExpression() { for (int i = 0; i < (int) operation.size(); i++) - if (operation[i] != NULL) + if (operation[i] != nullptr) delete operation[i]; } -CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(NULL) { +CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(nullptr) { *this = expression; } diff --git a/lib/colvars/lepton/src/ExpressionTreeNode.cpp b/lib/colvars/lepton/src/ExpressionTreeNode.cpp index 8519878262..09c5352d20 100644 --- a/lib/colvars/lepton/src/ExpressionTreeNode.cpp +++ b/lib/colvars/lepton/src/ExpressionTreeNode.cpp @@ -59,14 +59,14 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati throw Exception("wrong number of arguments to function: "+operation->getName()); } -ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) { +ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == nullptr ? nullptr : node.operation->clone()), children(node.getChildren()) { } -ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) { +ExpressionTreeNode::ExpressionTreeNode() : operation(nullptr) { } ExpressionTreeNode::~ExpressionTreeNode() { - if (operation != NULL) + if (operation != nullptr) delete operation; } @@ -91,7 +91,7 @@ bool ExpressionTreeNode::operator==(const ExpressionTreeNode& node) const { } ExpressionTreeNode& ExpressionTreeNode::operator=(const ExpressionTreeNode& node) { - if (operation != NULL) + if (operation != nullptr) delete operation; operation = node.getOperation().clone(); children = node.getChildren(); diff --git a/lib/colvars/lepton/src/ParsedExpression.cpp b/lib/colvars/lepton/src/ParsedExpression.cpp index fd3b091d3c..c259756346 100644 --- a/lib/colvars/lepton/src/ParsedExpression.cpp +++ b/lib/colvars/lepton/src/ParsedExpression.cpp @@ -46,7 +46,7 @@ ParsedExpression::ParsedExpression(const ExpressionTreeNode& rootNode) : rootNod } const ExpressionTreeNode& ParsedExpression::getRootNode() const { - if (&rootNode.getOperation() == NULL) + if (&rootNode.getOperation() == nullptr) throw Exception("Illegal call to an initialized ParsedExpression"); return rootNode; } diff --git a/lib/gpu/cudpp_mini/cudpp.cpp b/lib/gpu/cudpp_mini/cudpp.cpp index e2cd4621a4..9506320748 100644 --- a/lib/gpu/cudpp_mini/cudpp.cpp +++ b/lib/gpu/cudpp_mini/cudpp.cpp @@ -95,7 +95,7 @@ CUDPPResult cudppScan(CUDPPHandle planHandle, size_t numElements) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, 1, plan); return CUDPP_SUCCESS; @@ -159,7 +159,7 @@ CUDPPResult cudppSegmentedScan(CUDPPHandle planHandle, { CUDPPSegmentedScanPlan *plan = (CUDPPSegmentedScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSegmentedScanDispatch(d_out, d_idata, d_iflags, numElements, plan); return CUDPP_SUCCESS; @@ -200,7 +200,7 @@ CUDPPResult cudppMultiScan(CUDPPHandle planHandle, size_t numRows) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, numRows, plan); return CUDPP_SUCCESS; @@ -255,7 +255,7 @@ CUDPPResult cudppCompact(CUDPPHandle planHandle, size_t numElements) { CUDPPCompactPlan *plan = (CUDPPCompactPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppCompactDispatch(d_out, d_numValidElements, d_in, d_isValid, numElements, plan); @@ -300,7 +300,7 @@ CUDPPResult cudppSort(CUDPPHandle planHandle, size_t numElements) { CUDPPRadixSortPlan *plan = (CUDPPRadixSortPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppRadixSortDispatch(d_keys, d_values, numElements, keyBits, plan); return CUDPP_SUCCESS; @@ -331,7 +331,7 @@ CUDPPResult cudppSparseMatrixVectorMultiply(CUDPPHandle sparseMatrixHandl CUDPPSparseMatrixVectorMultiplyPlan *plan = (CUDPPSparseMatrixVectorMultiplyPlan*)CUDPPPlanManager::GetPlan(sparseMatrixHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSparseMatrixVectorMultiplyDispatch(d_y, d_x, plan); return CUDPP_SUCCESS; @@ -366,7 +366,7 @@ CUDPP_DLL CUDPPResult cudppRand(CUDPPHandle planHandle,void * d_out, size_t numElements) { CUDPPRandPlan * plan = (CUDPPRandPlan *) CUDPPPlanManager::GetPlan(planHandle); - if(plan != NULL) + if(plan != nullptr) { //dispatch the rand algorithm here cudppRandDispatch(d_out, numElements, plan); diff --git a/lib/gpu/cudpp_mini/cudpp_plan.cpp b/lib/gpu/cudpp_mini/cudpp_plan.cpp index e92a857dd1..8ea99a23fe 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan.cpp @@ -18,7 +18,7 @@ #include -CUDPPPlanManager* CUDPPPlanManager::m_instance = NULL; +CUDPPPlanManager* CUDPPPlanManager::m_instance = nullptr; CUDPPResult validateOptions(CUDPPConfiguration config, size_t /*numElements*/, size_t numRows, size_t /*rowPitch*/) { diff --git a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp index dd9d6eb9db..33c8621d29 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp @@ -26,17 +26,17 @@ extern "C" void compNumCTAs(KernelPointer kernel, size_t bytesDynamicSharedMem, //! @internal Instantiate the plan manager singleton object void CUDPPPlanManager::Instantiate() { - if (NULL == m_instance) + if (nullptr == m_instance) m_instance = new CUDPPPlanManager; } //! @internal Destroy the plan manager singleton object void CUDPPPlanManager::Destroy() { - if (NULL != m_instance) + if (nullptr != m_instance) { delete m_instance; - m_instance = NULL; + m_instance = nullptr; } } @@ -51,7 +51,7 @@ CUDPPPlanManager::~CUDPPPlanManager() { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; } m_instance->plans.clear(); @@ -85,7 +85,7 @@ CUDPPHandle CUDPPPlanManager::AddPlan(CUDPPPlan* plan) */ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { return false; } @@ -97,7 +97,7 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; m_instance->plans.erase(it); if (0 == m_instance->plans.size()) @@ -115,14 +115,14 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) /** @brief Get a plan from the plan manager by handle * -* @returns A pointer to the plan if found, or NULL otherwise +* @returns A pointer to the plan if found, or nullptr otherwise * @param handle The handle to the requested plan */ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { - return NULL; + return nullptr; } std::map::iterator it; @@ -133,13 +133,13 @@ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) } else { - return NULL; + return nullptr; } } size_t CUDPPPlanManager::numCTAs(KernelPointer kernel) { - if (m_instance == NULL) + if (m_instance == nullptr) { return 0; } diff --git a/lib/gpu/cudpp_mini/cutil.h b/lib/gpu/cudpp_mini/cutil.h index 7d1fcc17ee..54f29f498e 100644 --- a/lib/gpu/cudpp_mini/cutil.h +++ b/lib/gpu/cudpp_mini/cutil.h @@ -136,7 +136,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -152,7 +152,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -168,7 +168,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -215,7 +215,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -307,7 +307,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -350,7 +350,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -366,7 +366,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -381,7 +381,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// diff --git a/lib/gpu/geryon/hip_device.h b/lib/gpu/geryon/hip_device.h index 93f38d28bb..d2fb1919b7 100644 --- a/lib/gpu/geryon/hip_device.h +++ b/lib/gpu/geryon/hip_device.h @@ -261,7 +261,7 @@ class UCL_Device { /// Select the platform that has accelerators (for compatibility with OpenCL) inline int set_platform_accelerator(int pid=-1) { return UCL_SUCCESS; } - inline int load_module(const void* program, hipModule_t& module, std::string *log=NULL){ + inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){ auto it = _loaded_modules.emplace(program, hipModule_t()); if(!it.second){ module = it.first->second; @@ -281,7 +281,7 @@ class UCL_Device { hipError_t err=hipModuleLoadDataEx(&module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != hipSuccess) { diff --git a/lib/gpu/geryon/hip_kernel.h b/lib/gpu/geryon/hip_kernel.h index 654eb44772..c5014b52e7 100644 --- a/lib/gpu/geryon/hip_kernel.h +++ b/lib/gpu/geryon/hip_kernel.h @@ -30,7 +30,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _device_ptr = &device; _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _device_ptr = &device; _cq=device.cq(); init(device); load_string(program,flags,log); @@ -46,7 +46,7 @@ class UCL_Program { inline void clear() { } /// Load a program from a file and compile with flags - inline int load(const char *filename, const char *flags="", std::string *log=NULL) { + inline int load(const char *filename, const char *flags="", std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -64,7 +64,7 @@ class UCL_Program { } /// Load a program from a string and compile with flags - inline int load_string(const void *program, const char *flags="", std::string *log=NULL) { + inline int load_string(const void *program, const char *flags="", std::string *log=nullptr) { return _device_ptr->load_module(program, _module, log); } @@ -263,7 +263,7 @@ class UCL_Kernel { }; const auto res = hipModuleLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq, NULL, config); + _block_size[2],0,_cq, nullptr, config); CU_SAFE_CALL(res); //#endif } diff --git a/lib/gpu/geryon/hip_memory.h b/lib/gpu/geryon/hip_memory.h index 13f60ad939..a983ba3227 100644 --- a/lib/gpu/geryon/hip_memory.h +++ b/lib/gpu/geryon/hip_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/hip_texture.h b/lib/gpu/geryon/hip_texture.h index e7aa4e1461..ae16bee900 100644 --- a/lib/gpu/geryon/hip_texture.h +++ b/lib/gpu/geryon/hip_texture.h @@ -99,7 +99,7 @@ class UCL_Texture { else CU_SAFE_CALL(hipTexRefSetFormat(_tex,HIP_AD_FORMAT_SIGNED_INT32,numel*2)); } - CU_SAFE_CALL(hipTexRefSetAddress(NULL, _tex, vec.cbegin(), vec.numel()*vec.element_size())); + CU_SAFE_CALL(hipTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); #else void* data_ptr = (void*)vec.cbegin(); CU_SAFE_CALL(hipMemcpyHtoD(hipDeviceptr_t(_device_ptr_to_global_var), &data_ptr, sizeof(void*))); diff --git a/lib/gpu/geryon/nvd_kernel.h b/lib/gpu/geryon/nvd_kernel.h index 9293db2fe4..d74b0e2dc1 100644 --- a/lib/gpu/geryon/nvd_kernel.h +++ b/lib/gpu/geryon/nvd_kernel.h @@ -41,7 +41,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _cq=device.cq(); init(device); load_string(program,flags,log); @@ -58,7 +58,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -77,7 +77,7 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { if (std::string(flags)=="BINARY") return load_binary((const char *)program); const unsigned int num_opts=2; @@ -95,7 +95,7 @@ class UCL_Program { CUresult err=cuModuleLoadDataEx(&_module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != CUDA_SUCCESS) { @@ -361,7 +361,7 @@ class UCL_Kernel { #if CUDA_VERSION >= 4000 CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq,_kernel_args,NULL)); + _block_size[2],0,_cq,_kernel_args,nullptr)); #else CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size)); CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq)); diff --git a/lib/gpu/geryon/nvd_memory.h b/lib/gpu/geryon/nvd_memory.h index 0484e33de6..bcfc055ac2 100644 --- a/lib/gpu/geryon/nvd_memory.h +++ b/lib/gpu/geryon/nvd_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/nvd_texture.h b/lib/gpu/geryon/nvd_texture.h index 965595a448..c766af826c 100644 --- a/lib/gpu/geryon/nvd_texture.h +++ b/lib/gpu/geryon/nvd_texture.h @@ -80,7 +80,7 @@ class UCL_Texture { #ifdef UCL_DEBUG assert(numel!=0 && numel<5); #endif - CU_SAFE_CALL(cuTexRefSetAddress(NULL, _tex, vec.cbegin(), + CU_SAFE_CALL(cuTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); if (vec.element_size()==sizeof(float)) CU_SAFE_CALL(cuTexRefSetFormat(_tex, CU_AD_FORMAT_FLOAT, numel)); diff --git a/lib/gpu/geryon/ocl_device.h b/lib/gpu/geryon/ocl_device.h index 10e84a436a..de4def0bc1 100644 --- a/lib/gpu/geryon/ocl_device.h +++ b/lib/gpu/geryon/ocl_device.h @@ -360,7 +360,7 @@ int UCL_Device::set_platform(int pid) { // --- Get Number of Devices cl_uint n; - errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,NULL,&n); + errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,nullptr,&n); _num_devices=n; if (errorv!=CL_SUCCESS || _num_devices==0) { _num_devices=0; @@ -385,7 +385,7 @@ int UCL_Device::create_context() { props[0]=CL_CONTEXT_PLATFORM; props[1]=_platform; props[2]=0; - _context=clCreateContext(0,1,&_cl_device,NULL,NULL,&errorv); + _context=clCreateContext(0,1,&_cl_device,nullptr,nullptr,&errorv); if (errorv!=CL_SUCCESS) { #ifndef UCL_NO_EXIT std::cerr << "UCL Error: Could not access accelerator number " << _device @@ -404,36 +404,36 @@ void UCL_Device::add_properties(cl_device_id device_list) { char buffer[1024]; cl_bool ans_bool; - CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,NULL)); + CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,nullptr)); op.name=buffer; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_GLOBAL_MEM_SIZE, - sizeof(op.global_mem),&op.global_mem,NULL)); + sizeof(op.global_mem),&op.global_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_LOCAL_MEM_SIZE, - sizeof(op.shared_mem),&op.shared_mem,NULL)); + sizeof(op.shared_mem),&op.shared_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, - sizeof(op.const_mem),&op.const_mem,NULL)); + sizeof(op.const_mem),&op.const_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_TYPE, - sizeof(op.device_type),&op.device_type,NULL)); + sizeof(op.device_type),&op.device_type,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(op.compute_units),&op.compute_units, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CLOCK_FREQUENCY, - sizeof(op.clock),&op.clock,NULL)); + sizeof(op.clock),&op.clock,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(op.work_group_size),&op.work_group_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_ITEM_SIZES, 3*sizeof(op.work_item_size[0]),op.work_item_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MEM_BASE_ADDR_ALIGN, - sizeof(cl_uint),&op.alignment,NULL)); + sizeof(cl_uint),&op.alignment,nullptr)); op.alignment/=8; // Determine if double precision is supported cl_uint double_width; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, - sizeof(double_width),&double_width,NULL)); + sizeof(double_width),&double_width,nullptr)); if (double_width==0) op.double_precision=false; else @@ -441,13 +441,13 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PROFILING_TIMER_RESOLUTION, - sizeof(size_t),&op.timer_resolution,NULL)); + sizeof(size_t),&op.timer_resolution,nullptr)); op.ecc_support=false; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_ERROR_CORRECTION_SUPPORT, - sizeof(ans_bool),&ans_bool,NULL)); + sizeof(ans_bool),&ans_bool,nullptr)); if (ans_bool==CL_TRUE) op.ecc_support=true; @@ -459,7 +459,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { #ifdef CL_VERSION_1_2 size_t return_bytes; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_OPENCL_C_VERSION,1024, - buffer,NULL)); + buffer,nullptr)); op.c_version=buffer; cl_device_partition_property pinfo[4]; @@ -479,7 +479,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, - sizeof(cl_uint),&op.max_sub_devices,NULL)); + sizeof(cl_uint),&op.max_sub_devices,nullptr)); #endif _properties.push_back(op); @@ -489,15 +489,15 @@ std::string UCL_Device::platform_name() { char info[1024]; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VENDOR,1024,info, - NULL)); + nullptr)); std::string ans=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_NAME,1024,info, - NULL)); + nullptr)); ans+=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VERSION,1024,info, - NULL)); + nullptr)); ans+=std::string(info); return ans; diff --git a/lib/gpu/geryon/ocl_kernel.h b/lib/gpu/geryon/ocl_kernel.h index b65049b9e6..77593f4515 100644 --- a/lib/gpu/geryon/ocl_kernel.h +++ b/lib/gpu/geryon/ocl_kernel.h @@ -42,7 +42,7 @@ class UCL_Program { inline UCL_Program() : _init_done(false) {} inline UCL_Program(UCL_Device &device) : _init_done(false) { init(device); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) : + const char *flags="", std::string *log=nullptr) : _init_done(false) { init(device); load_string(program,flags,log); @@ -74,7 +74,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -93,29 +93,29 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { cl_int error_flag; const char *prog=(const char *)program; - _program=clCreateProgramWithSource(_context,1,&prog,NULL,&error_flag); + _program=clCreateProgramWithSource(_context,1,&prog,nullptr,&error_flag); CL_CHECK_ERR(error_flag); - error_flag = clBuildProgram(_program,1,&_device,flags,NULL,NULL); + error_flag = clBuildProgram(_program,1,&_device,flags,nullptr,nullptr); if (error_flag!=-11) CL_CHECK_ERR(error_flag); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); - if (build_status != CL_SUCCESS || log!=NULL) { + if (build_status != CL_SUCCESS || log!=nullptr) { size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); - if (log!=NULL) + if (log!=nullptr) *log=std::string(build_log); if (build_status != CL_SUCCESS) { @@ -363,7 +363,7 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) _kernel_info_name=function; cl_uint nargs; CL_SAFE_CALL(clGetKernelInfo(_kernel,CL_KERNEL_NUM_ARGS,sizeof(cl_uint), - &nargs,NULL)); + &nargs,nullptr)); _kernel_info_nargs=nargs; #ifdef NOT_TEST_CL_VERSION_1_2 char tname[256]; @@ -380,8 +380,8 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) } void UCL_Kernel::run() { - CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,NULL, - _num_blocks,_block_size,0,NULL,NULL)); + CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,nullptr, + _num_blocks,_block_size,0,nullptr,nullptr)); } } // namespace diff --git a/lib/gpu/geryon/ocl_memory.h b/lib/gpu/geryon/ocl_memory.h index 9692f4dd7b..740020ab18 100644 --- a/lib/gpu/geryon/ocl_memory.h +++ b/lib/gpu/geryon/ocl_memory.h @@ -58,7 +58,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; cl_map_flags map_perm; @@ -103,12 +103,12 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, map_perm=CL_MAP_READ | CL_MAP_WRITE; } - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(cm.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=cm.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); @@ -120,10 +120,10 @@ inline int _host_view(mat_type &mat, copy_type &cm, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags orig_flags; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_FLAGS,sizeof(orig_flags), - &orig_flags,NULL)); + &orig_flags,nullptr)); orig_flags=orig_flags & ~CL_MEM_ALLOC_HOST_PTR; mat.cbegin()=clCreateBuffer(context, CL_MEM_USE_HOST_PTR | orig_flags, n, @@ -159,13 +159,13 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, } cl_int error_flag; - mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(dev.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=dev.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); return UCL_SUCCESS; @@ -194,10 +194,10 @@ inline int _host_resize(mat_type &mat, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_FLAGS,sizeof(buffer_perm), - &buffer_perm,NULL)); + &buffer_perm,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); @@ -209,12 +209,12 @@ inline int _host_resize(mat_type &mat, const size_t n) { else map_perm=CL_MAP_READ | CL_MAP_WRITE; - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(mat.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); return UCL_SUCCESS; } @@ -229,7 +229,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags flag; if (kind==UCL_READ_WRITE) flag=CL_MEM_READ_WRITE; @@ -247,7 +247,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); @@ -276,7 +276,7 @@ inline int _device_alloc(mat_type &mat, UCL_Device &dev, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(dev.context(),flag,n,NULL, + mat.cbegin()=clCreateBuffer(dev.context(),flag,n,nullptr, &error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; @@ -321,7 +321,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -341,7 +341,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -359,7 +359,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -379,7 +379,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -395,21 +395,21 @@ inline void _host_zero(void *ptr, const size_t n) { inline void _ocl_build(cl_program &program, cl_device_id &device, const char* options = "") { - clBuildProgram(program,1,&device,options,NULL,NULL); + clBuildProgram(program,1,&device,options,nullptr,nullptr); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); if (build_status == CL_SUCCESS) return; size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(program, device,CL_PROGRAM_BUILD_LOG, 0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(program,device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); std::cerr << std::endl << "----------------------------------------------------------\n" @@ -426,7 +426,7 @@ inline void _ocl_kernel_from_source(cl_context &context, cl_device_id &device, cl_int error_flag; cl_program program=clCreateProgramWithSource(context,lines,source, - NULL,&error_flag); + nullptr,&error_flag); CL_CHECK_ERR(error_flag); _ocl_build(program,device,options); kernel=clCreateKernel(program,function,&error_flag); @@ -444,15 +444,15 @@ inline void _device_zero(mat_type &mat, const size_t n, command_queue &cq) { #ifdef UCL_CL_ZERO cl_int zeroint=0; CL_SAFE_CALL(clEnqueueFillBuffer(cq,mat.begin(),&zeroint,sizeof(cl_int), - mat.byteoff(),n,0,NULL,NULL)); + mat.byteoff(),n,0,nullptr,nullptr)); #else cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_device_id device; CL_SAFE_CALL(clGetContextInfo(context,CL_CONTEXT_DEVICES, - sizeof(cl_device_id),&device,NULL)); + sizeof(cl_device_id),&device,nullptr)); const char * szero[3]={ "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", @@ -585,7 +585,7 @@ template <> struct _ucl_memcpy<1,0> { std::cerr << "UCL_COPY 1NS\n"; #endif CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,n, - dst.begin(),0,NULL,NULL)); + dst.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -607,13 +607,13 @@ template <> struct _ucl_memcpy<1,0> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset, spitch*rows, - (char *)dst.begin()+dst_offset,0,NULL, - NULL)); + (char *)dst.begin()+dst_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy<0,1> { std::cerr << "UCL_COPY 3NS\n"; #endif CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,n, - src.begin(),0,NULL,NULL)); + src.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -659,13 +659,13 @@ template <> struct _ucl_memcpy<0,1> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset, spitch*rows, - (char *)src.begin()+src_offset,0,NULL, - NULL)); + (char *)src.begin()+src_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy { const size_t dst_offset, const size_t src_offset) { if (src.cbegin()!=dst.cbegin() || src_offset!=dst_offset) { CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,n,0,NULL,NULL)); + dst_offset,n,0,nullptr,nullptr)); #ifdef UCL_DBG_MEM_TRACE std::cerr << "UCL_COPY 6NS\n"; #endif @@ -704,13 +704,13 @@ template struct _ucl_memcpy { if (spitch==dpitch && dst.cols()==src.cols() && src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,spitch*rows,0,NULL,NULL)); + dst_offset,spitch*rows,0,nullptr,nullptr)); else for (size_t i=0; i AnswerT::Answer() : _allocated(false),_eflag(false),_vflag(false), - _inum(0),_ilist(NULL),_newton(false) { + _inum(0),_ilist(nullptr),_newton(false) { } template @@ -119,7 +119,7 @@ void AnswerT::clear() { engv.clear(); time_answer.clear(); _inum=0; - _ilist=NULL; + _ilist=nullptr; _eflag=false; _vflag=false; } @@ -180,7 +180,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=0; i<_inum; i++) evdwl+=engv[i]; if (_ef_atom) { - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) eatom[i]+=engv[i]; } else { @@ -196,7 +196,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=vstart; i void AnswerT::get_answers(double **f, double **tor) { int fl=0; - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) { f[i][0]+=force[fl]; f[i][1]+=force[fl+1]; diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index eb0eab87b6..42925aaeec 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -25,8 +25,8 @@ BaseAtomicT::BaseAtomic() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -135,7 +135,7 @@ int * BaseAtomicT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -231,7 +231,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -244,7 +244,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_charge.cpp b/lib/gpu/lal_base_charge.cpp index 52e8ae2d89..d5a6e06222 100644 --- a/lib/gpu/lal_base_charge.cpp +++ b/lib/gpu/lal_base_charge.cpp @@ -25,8 +25,8 @@ BaseChargeT::BaseCharge() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -137,7 +137,7 @@ int * BaseChargeT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -240,7 +240,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -253,7 +253,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_dipole.cpp b/lib/gpu/lal_base_dipole.cpp index ed71029e68..57773a3b80 100644 --- a/lib/gpu/lal_base_dipole.cpp +++ b/lib/gpu/lal_base_dipole.cpp @@ -25,8 +25,8 @@ BaseDipoleT::BaseDipole() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -139,7 +139,7 @@ int * BaseDipoleT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); atom->cast_quat_data(host_mu[0]); hd_balancer.start_timer(); diff --git a/lib/gpu/lal_base_dpd.cpp b/lib/gpu/lal_base_dpd.cpp index c0d7ad47bc..e4fd80fcc3 100644 --- a/lib/gpu/lal_base_dpd.cpp +++ b/lib/gpu/lal_base_dpd.cpp @@ -25,8 +25,8 @@ BaseDPDT::BaseDPD() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -138,7 +138,7 @@ int * BaseDPDT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_v_data(host_v,tag); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index abc8807a8b..524705ed41 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -33,10 +33,10 @@ BaseEllipsoidT::BaseEllipsoid() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - nbor_program=NULL; - ellipsoid_program=NULL; - lj_program=NULL; - ucl_device=NULL; + nbor_program=nullptr; + ellipsoid_program=nullptr; + lj_program=nullptr; + ucl_device=nullptr; } template @@ -356,7 +356,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } int ago=hd_balancer.ago_first(f_ago); @@ -369,7 +369,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, reset_nbors(nall, inum, inum_full, ilist, numj, host_type, firstneigh, success); if (!success) - return NULL; + return nullptr; } int *list; if (_multiple_forms) @@ -406,7 +406,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -420,7 +420,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_quat_data(host_quat[0]); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_three.cpp b/lib/gpu/lal_base_three.cpp index 0b4dbdc89a..cfc138aea2 100644 --- a/lib/gpu/lal_base_three.cpp +++ b/lib/gpu/lal_base_three.cpp @@ -27,8 +27,8 @@ BaseThreeT::BaseThree() : _compiled(false), _max_bytes(0) { #ifdef THREE_CONCURRENT ans2=new Answer(); #endif - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -176,7 +176,7 @@ int * BaseThreeT::reset_nbors(const int nall, const int inum, const int nlist, resize_atom(inum,nall,success); resize_local(nall,mn,success); if (!success) - return NULL; + return nullptr; _nall = nall; @@ -310,7 +310,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -326,7 +326,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, _max_nbors = build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_three.h b/lib/gpu/lal_base_three.h index 38af78b78e..36129e6168 100644 --- a/lib/gpu/lal_base_three.h +++ b/lib/gpu/lal_base_three.h @@ -59,7 +59,7 @@ class BaseThree { const double gpu_split, FILE *screen, const void *pair_program, const char *k_two, const char *k_three_center, const char *k_three_end, - const char *k_short_nbor=NULL); + const char *k_short_nbor=nullptr); /// Estimate the overhead for GPU context changes and CPU driver void estimate_gpu_overhead(); diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index aaf74ed28c..6c6a206307 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -72,7 +72,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int first_gpu, // "0:generic" will select platform 0 and tune for generic device // "1:fermi" will select platform 1 and tune for Nvidia Fermi gpu if (ocl_vendor) { - char *sep = NULL; + char *sep = nullptr; if ((sep = strstr(ocl_vendor,":"))) { *sep = '\0'; _platform_id = atoi(ocl_vendor); @@ -182,7 +182,7 @@ template int DeviceT::set_ocl_params(char *ocl_vendor) { #ifdef USE_OPENCL std::string s_vendor=OCL_DEFAULT_VENDOR; - if (ocl_vendor!=NULL) + if (ocl_vendor!=nullptr) s_vendor=ocl_vendor; if (s_vendor=="none") s_vendor="generic"; @@ -215,14 +215,14 @@ int DeviceT::set_ocl_params(char *ocl_vendor) { int token_count=0; std::string params[13]; char *pch = strtok(ocl_vendor,","); - pch = strtok(NULL,","); - if (pch == NULL) return -11; - while (pch != NULL) { + pch = strtok(nullptr,","); + if (pch == nullptr) return -11; + while (pch != nullptr) { if (token_count==13) return -11; params[token_count]=pch; token_count++; - pch = strtok(NULL,","); + pch = strtok(nullptr,","); } _ocl_vendor_string+=" -DMEM_THREADS="+params[0]+ " -DTHREADS_PER_ATOM="+params[1]+ @@ -430,9 +430,9 @@ template void DeviceT::estimate_gpu_overhead(const int kernel_calls, double &gpu_overhead, double &gpu_driver_overhead) { - UCL_H_Vec *host_data_in=NULL, *host_data_out=NULL; - UCL_D_Vec *dev_data_in=NULL, *dev_data_out=NULL, *kernel_data=NULL; - UCL_Timer *timers_in=NULL, *timers_out=NULL, *timers_kernel=NULL; + UCL_H_Vec *host_data_in=nullptr, *host_data_out=nullptr; + UCL_D_Vec *dev_data_in=nullptr, *dev_data_out=nullptr, *kernel_data=nullptr; + UCL_Timer *timers_in=nullptr, *timers_out=nullptr, *timers_kernel=nullptr; UCL_Timer over_timer(*gpu); if (_data_in_estimate>0) { diff --git a/lib/gpu/lal_eam.cpp b/lib/gpu/lal_eam.cpp index 8c81353f36..03479cd16a 100644 --- a/lib/gpu/lal_eam.cpp +++ b/lib/gpu/lal_eam.cpp @@ -380,7 +380,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -394,7 +394,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; } else { this->atom->cast_x_data(host_x,host_type); this->atom->add_x_data(host_x,host_type); @@ -429,7 +429,7 @@ void EAMT::compute2(int *ilist, const bool eflag, const bool vflag, time_fp2.stop(); loop2(eflag,vflag); - if (ilist == NULL) + if (ilist == nullptr) this->ans->copy_answers(eflag,vflag,eatom,vatom); else this->ans->copy_answers(eflag,vflag,eatom,vatom, ilist); diff --git a/lib/gpu/lal_lj_tip4p_long.cpp b/lib/gpu/lal_lj_tip4p_long.cpp index bb848ad5c3..1f3b32248c 100644 --- a/lib/gpu/lal_lj_tip4p_long.cpp +++ b/lib/gpu/lal_lj_tip4p_long.cpp @@ -340,7 +340,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } this->hd_balancer.balance(cpu_time); @@ -353,7 +353,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->atom->cast_q_data(host_q); this->hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_neighbor.cpp b/lib/gpu/lal_neighbor.cpp index 3e128bcf57..6c4890ef47 100644 --- a/lib/gpu/lal_neighbor.cpp +++ b/lib/gpu/lal_neighbor.cpp @@ -158,7 +158,7 @@ void Neighbor::alloc(bool &success) { } _c_bytes+=nbor_host.device.row_bytes()+dev_numj_host.row_bytes(); } else { - // Some OpenCL implementations return errors for NULL pointers as args + // Some OpenCL implementations return errors for nullptr pointers as args nbor_host.device.view(dev_nbor); dev_numj_host.view(dev_nbor); } diff --git a/lib/gpu/lal_pppm.cpp b/lib/gpu/lal_pppm.cpp index 84d6c16e14..6b5bf88ea5 100644 --- a/lib/gpu/lal_pppm.cpp +++ b/lib/gpu/lal_pppm.cpp @@ -35,7 +35,7 @@ PPPMT::PPPM() : _allocated(false), _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); - pppm_program=NULL; + pppm_program=nullptr; } template diff --git a/lib/gpu/lal_pppm_ext.cpp b/lib/gpu/lal_pppm_ext.cpp index a75536eb19..b826881392 100644 --- a/lib/gpu/lal_pppm_ext.cpp +++ b/lib/gpu/lal_pppm_ext.cpp @@ -56,7 +56,7 @@ grdtyp * pppm_gpu_init(memtyp &pppm, const int nlocal, const int nall, } success=0; - grdtyp * host_brick=NULL; + grdtyp * host_brick=nullptr; if (world_me==0) host_brick=pppm.init(nlocal,nall,screen,order,nxlo_out,nylo_out,nzlo_out, nxhi_out,nyhi_out,nzhi_out,rho_coeff,vd_brick, @@ -129,7 +129,7 @@ double pppm_gpu_bytes_f() { void pppm_gpu_forces_f(double **f) { double etmp; PPPMF.atom->data_unavail(); - PPPMF.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMF.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } double * pppm_gpu_init_d(const int nlocal, const int nall, FILE *screen, @@ -173,6 +173,6 @@ double pppm_gpu_bytes_d() { void pppm_gpu_forces_d(double **f) { double etmp; PPPMD.atom->data_unavail(); - PPPMD.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMD.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } diff --git a/lib/gpu/lal_yukawa_colloid.cpp b/lib/gpu/lal_yukawa_colloid.cpp index e71e962ffd..46d4d64328 100644 --- a/lib/gpu/lal_yukawa_colloid.cpp +++ b/lib/gpu/lal_yukawa_colloid.cpp @@ -213,7 +213,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -227,7 +227,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->cast_rad_data(rad); this->hd_balancer.start_timer(); } else { diff --git a/lib/kokkos/cmake/compile_tests/pthread.cpp b/lib/kokkos/cmake/compile_tests/pthread.cpp index 92310da029..7fa98611be 100644 --- a/lib/kokkos/cmake/compile_tests/pthread.cpp +++ b/lib/kokkos/cmake/compile_tests/pthread.cpp @@ -4,11 +4,11 @@ void* kokkos_test(void* args) { return args; } int main(void) { pthread_t thread; - /* Use NULL to avoid C++11. Some compilers + /* Use nullptr to avoid C++11. Some compilers do not have C++11 by default. Forcing C++11 in the compile tests can be done, but is unnecessary */ - pthread_create(&thread, NULL, kokkos_test, NULL); - pthread_join(thread, NULL); + pthread_create(&thread, nullptr, kokkos_test, nullptr); + pthread_join(thread, nullptr); return 0; } diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index a97fb2f7cc..d4db2c538d 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -640,7 +640,7 @@ void SharedAllocationRecord:: /*--------------------------------------------------------------------------*/ void* hip_resize_scratch_space(size_t bytes, bool force_shrink) { - static void* ptr = NULL; + static void* ptr = nullptr; static size_t current_size = 0; if (current_size == 0) { current_size = bytes; diff --git a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp index fad36c02f1..613793fc60 100644 --- a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp @@ -139,7 +139,7 @@ void *HBWSpace::allocate(const char *arg_label, const size_t arg_alloc_size, } msg << " ]( " << arg_alloc_size << " ) FAILED"; if (ptr == nullptr) { - msg << " nullptr"; + msg << " NULL"; } else { msg << " NOT ALIGNED " << ptr; } diff --git a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp index a9a2778813..2b11adbf6d 100644 --- a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp @@ -215,7 +215,7 @@ SharedAllocationRecord::SharedAllocationRecord( } else { Kokkos::Impl::throw_runtime_exception( - "Kokkos::Impl::SharedAllocationRecord given nullptr allocation"); + "Kokkos::Impl::SharedAllocationRecord given NULL allocation"); } } diff --git a/lib/kokkos/core/unit_test/TestCTestDevice.cpp b/lib/kokkos/core/unit_test/TestCTestDevice.cpp index b2ee79b856..c54c75f94b 100644 --- a/lib/kokkos/core/unit_test/TestCTestDevice.cpp +++ b/lib/kokkos/core/unit_test/TestCTestDevice.cpp @@ -13,7 +13,7 @@ int setenv(const char *name, const char *value, int overwrite) { int errcode = 0; if (!overwrite) { size_t envsize = 0; - errcode = getenv_s(&envsize, NULL, 0, name); + errcode = getenv_s(&envsize, nullptr, 0, name); if (errcode || envsize) return errcode; } return _putenv_s(name, value); diff --git a/lib/message/cslib/src/STUBS_ZMQ/zmq.h b/lib/message/cslib/src/STUBS_ZMQ/zmq.h index a335ee5e01..98cb937ed1 100644 --- a/lib/message/cslib/src/STUBS_ZMQ/zmq.h +++ b/lib/message/cslib/src/STUBS_ZMQ/zmq.h @@ -24,10 +24,10 @@ namespace CSLIB_NS { #define ZMQ_REQ 0 #define ZMQ_REP 0 -static void *zmq_ctx_new() {return NULL;} -static void *zmq_connect(void *, char *) {return NULL;} +static void *zmq_ctx_new() {return nullptr;} +static void *zmq_connect(void *, char *) {return nullptr;} static int zmq_bind(void *, char *) {return 0;} -static void *zmq_socket(void *,int) {return NULL;} +static void *zmq_socket(void *,int) {return nullptr;} static void zmq_close(void *) {} static void zmq_ctx_destroy(void *) {} static void zmq_send(void *, void *, int, int) {} diff --git a/lib/message/cslib/src/cslib.cpp b/lib/message/cslib/src/cslib.cpp index 7c75a39929..20292329ac 100644 --- a/lib/message/cslib/src/cslib.cpp +++ b/lib/message/cslib/src/cslib.cpp @@ -57,7 +57,7 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) else if (csflag == 1) server = 1; else error_all("constructor(): Invalid client/server arg"); - if (pcomm == NULL) { + if (pcomm == nullptr) { me = 0; nprocs = 1; @@ -82,19 +82,19 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) } maxfield = 0; - fieldID = fieldtype = fieldlen = fieldoffset = NULL; + fieldID = fieldtype = fieldlen = fieldoffset = nullptr; maxheader = 0; - header = NULL; + header = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; - recvcounts = displs = NULL; + recvcounts = displs = nullptr; maxglobal = 0; - allids = NULL; + allids = nullptr; maxfieldbytes = 0; - fielddata = NULL; + fielddata = nullptr; - pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing NULL + pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing nullptr nsend = nrecv = 0; } @@ -218,7 +218,7 @@ void CSlib::pack_parallel(int id, int ftype, // nlocal datums, each of nper length, from all procs // final data in buf = datums for all natoms, ordered by ids - if (recvcounts == NULL) { + if (recvcounts == nullptr) { recvcounts = (int *) smalloc(nprocs*sizeof(int)); displs = (int *) smalloc(nprocs*sizeof(int)); } @@ -706,9 +706,9 @@ void CSlib::deallocate_fields() void *CSlib::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"malloc(): Failed to allocate %d bytes",nbytes); error_one(str); @@ -722,11 +722,11 @@ void *CSlib::srealloc(void *ptr, int nbytes) { if (nbytes == 0) { sfree(ptr); - return NULL; + return nullptr; } ptr = realloc(ptr,nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"realloc(): Failed to reallocate %d bytes",nbytes); error_one(str); @@ -738,7 +738,7 @@ void *CSlib::srealloc(void *ptr, int nbytes) void CSlib::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/cslib_wrap.cpp b/lib/message/cslib/src/cslib_wrap.cpp index 64b4d53b25..cb132c2382 100644 --- a/lib/message/cslib/src/cslib_wrap.cpp +++ b/lib/message/cslib/src/cslib_wrap.cpp @@ -44,7 +44,7 @@ void cslib_open_fortran(int csflag, const char *mode, const char *str, const void *pcomm, void **csptr) { MPI_Comm ccomm; - void *pccomm = NULL; + void *pccomm = nullptr; if (pcomm) { MPI_Fint *fcomm = (MPI_Fint *) pcomm; diff --git a/lib/message/cslib/src/msg.cpp b/lib/message/cslib/src/msg.cpp index ff654ecbcf..dcd78fb739 100644 --- a/lib/message/cslib/src/msg.cpp +++ b/lib/message/cslib/src/msg.cpp @@ -80,9 +80,9 @@ void Msg::allocate(int nheader, int &maxheader, int *&header, void *Msg::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = (void *) malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"Failed to allocate %d bytes",nbytes); } @@ -93,7 +93,7 @@ void *Msg::smalloc(int nbytes) void Msg::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/msg_mpi_two.cpp b/lib/message/cslib/src/msg_mpi_two.cpp index 2a4fa65ff7..d365e20849 100644 --- a/lib/message/cslib/src/msg_mpi_two.cpp +++ b/lib/message/cslib/src/msg_mpi_two.cpp @@ -52,7 +52,7 @@ void MsgMPITwo::init(char *filename) { if (client) { if (me == 0) { - FILE *fp = NULL; + FILE *fp = nullptr; while (!fp) { fp = fopen(filename,"r"); if (!fp) sleep(1); diff --git a/lib/message/cslib/src/msg_zmq.cpp b/lib/message/cslib/src/msg_zmq.cpp index 8bee3aebde..07920c6b5c 100644 --- a/lib/message/cslib/src/msg_zmq.cpp +++ b/lib/message/cslib/src/msg_zmq.cpp @@ -99,12 +99,12 @@ void MsgZMQ::send(int nheader, int *header, int nbuf, char *buf) if (me == 0) { zmq_send(socket,lengths,2*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) { zmq_send(socket,header,nheader*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) zmq_send(socket,buf,nbuf,0); @@ -125,7 +125,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) { if (me == 0) { zmq_recv(socket,lengths,2*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(lengths,2,MPI_INT,0,world); @@ -135,7 +135,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) if (me == 0) { zmq_recv(socket,header,nheader*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(header,nheader,MPI_INT,0,world); diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 057c403369..2b7c57b840 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -193,7 +193,7 @@ typedef struct molfile_timestep_metadata { typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ float *velocities; /**< space for velocities of all atoms; same layout */ - /**< NULL unless has_velocities is set */ + /**< nullptr unless has_velocities is set */ /*@{*/ /** @@ -517,7 +517,7 @@ typedef struct { * form {orbital1(c1),orbital1(c2),.....,orbitalM(cN)} */ float *orbital_energies; /**< list of orbital energies for wavefunction */ float *occupancies; /**< orbital occupancies */ - int *orbital_ids; /**< orbital ID numbers; If NULL then VMD will + int *orbital_ids; /**< orbital ID numbers; If nullptr then VMD will * assume 1,2,3,...num_orbs. */ } molfile_qm_wavefunction_t; @@ -588,7 +588,7 @@ color r, g, b /** - * Main file reader API. Any function in this struct may be NULL + * Main file reader API. Any function in this struct may be nullptr * if not implemented by the plugin; the application checks this to determine * what functionality is present in the plugin. */ @@ -599,7 +599,7 @@ typedef struct { vmdplugin_HEAD /** - * Filename extension for this file type. May be NULL if no filename + * Filename extension for this file type. May be nullptr if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" @@ -611,7 +611,7 @@ typedef struct { const char *filename_extension; /** - * Try to open the file for reading. Return an opaque handle, or NULL on + * Try to open the file for reading. Return an opaque handle, or nullptr on * failure. Set the number of atoms; if the number of atoms cannot be * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; @@ -638,20 +638,20 @@ typedef struct { * the caller. * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be - * set to 0 and from/to should be set to NULL to indicate that no bond + * set to 0 and from/to should be set to nullptr to indicate that no bond * information was actually present, and automatic bond search should be * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to NULL, in which case the caller will provide a + * pointer should be set to nullptr, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array * will contain the bond type index for each from/to pair. These numbers * are consecutive integers starting from 0. * the bondtypenames list, contains the corresponding names, if available, - * as a NULL string terminated list. nbondtypes is provided for convenience + * as a nullptr string terminated list. nbondtypes is provided for convenience * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. @@ -666,7 +666,7 @@ typedef struct { * new QM-capable version named read_timestep(), when finished. * * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is nullptr, then * the frame should be skipped. Otherwise, the application must prepare * molfile_timestep_t by allocating space in coords for the corresponding * number of coordinates. @@ -684,7 +684,7 @@ typedef struct { /** * Open a coordinate file for writing using the given header information. - * Return an opaque handle, or NULL on failure. The application must + * Return an opaque handle, or nullptr on failure. The application must * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ @@ -757,7 +757,7 @@ typedef struct { * from/to and to/from versions of each. * This function must be called before write_structure(). * - * Like the read_bonds() routine, the bondorder pointer is set to NULL + * Like the read_bonds() routine, the bondorder pointer is set to nullptr * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. @@ -767,7 +767,7 @@ typedef struct { * index (consecutive integers starting from 0) and bondtypenames * contain the corresponding strings, in case the naming/numbering * scheme is different from the index numbers. - * if the pointers are set to NULL, then this information is not available. + * if the pointers are set to nullptr, then this information is not available. * bondtypenames can only be used of bondtypes is also given. * Return MOLFILE_SUCCESS if no errors occur. */ @@ -842,13 +842,13 @@ typedef struct { /** * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are NULL, then the coordinate or qm data should be skipped. + * arguments are nullptr, then the coordinate or qm data should be skipped. * Otherwise, the application must prepare molfile_timestep_t and * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or NULL pointers for the molfile_timestep_t and + * valid, or nullptr pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. * The natoms and qm metadata parameters exist because some file formats @@ -886,9 +886,9 @@ typedef struct { * caller the ability to prioritize, buffer, and redirect console messages * to an appropriate output channel, window, etc. This enables the use of * graphical consoles like TkCon without losing console output from plugins. - * If the function pointer is NULL, no console output service is provided + * If the function pointer is nullptr, no console output service is provided * by the calling application, and the output should default to stdout - * stream. If the function pointer is non-NULL, all output will be + * stream. If the function pointer is non-nullptr, all output will be * subsequently dealt with by the calling application. * * XXX this should really be put into a separate block of diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index 4fc8785dd7..c1c45a86a7 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != NULL) + if(currentNode != nullptr) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != NULL); //repeat this until all chains have been added + while(currentNode != nullptr); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null + if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null { - return NULL; + return nullptr; } int * tmp; - POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = NULL; //temporary variable to hold data - while(tempNode != NULL) //when we have followed all links, stop + POEMSChain * tempChain = nullptr; //temporary variable to hold data + while(tempNode != nullptr) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == NULL) + if(aNode == nullptr) { - return NULL; + return nullptr; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == NULL) //and if we find nothing... + if(returnVal == nullptr) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == NULL) //if we could not find any chains + if(returnVal == nullptr) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be NULL if no new chains are + return returnVal; //return what we find (will be nullptr if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists + while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != NULL || tmp2->value != NULL) //go through the list + while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 446fa2013f..04f0f4b79b 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); +TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value NULL +// The pointers have default value nullptr TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == NULL) + if (p == nullptr) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=NULL) + if(t !=nullptr) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == NULL && t->Right() == NULL) + if (t->Left() == nullptr && t->Right() == nullptr) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == NULL) + if (t == nullptr) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=NULL - if (t != NULL) + //print tree with root t, as long as t!=nullptr + if (t != nullptr) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index ee07a33255..14f5fd4008 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = NULL); + void Insert(const int& item, const int& data, void * AuxData = nullptr); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = NULL; + DeleteAuxData = nullptr; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return NULL +// address and a pointer to its parent; otherwise, return nullptr TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is NULL - parent = NULL; + // the parent of the root is nullptr + parent = nullptr; // terminate on empty subtree - while(t != NULL) + while(t != nullptr) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; NULL if not found + // return pointer to node; nullptr if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != NULL) + if (current != nullptr) { item = current->data; return current->GetAuxData(); } else // item not found in the tree. return False - return NULL; + return nullptr; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,NULL,NULL); + newNode = GetTreeNode(item,nullptr,nullptr); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == NULL) + if (tree == nullptr) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) + if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) return; - // If D has NULL pointer, the + // If D has nullptr pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == NULL) + if (DNodePtr->right == nullptr) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == NULL) + else if (DNodePtr->left == nullptr) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-NULL + // Both pointers of DNodePtr are non-nullptr else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != NULL) + while (RNodePtr->right != nullptr) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == NULL) + if (PNodePtr == nullptr) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=NULL && current->data == item) + if (current !=nullptr && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == NULL) - return NULL; + if (t == nullptr) + return nullptr; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns NULL. + // present it makes a copy of left child or returns nullptr. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=NULL) + if (t->Left() !=nullptr) newlptr = CopyTree(t->Left()); else - newlptr = NULL; + newlptr = nullptr; - if (t->Right() !=NULL) + if (t->Right() !=nullptr) newrptr = CopyTree(t->Right()); else - newrptr = NULL; + newrptr = nullptr; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != NULL) { + if (t != nullptr) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != NULL) { - if (DeleteAuxData != NULL) { + if (aux != nullptr) { + if (DeleteAuxData != nullptr) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to NULL +// set the root pointer back to nullptr void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = NULL; // root now NULL + t = nullptr; // root now nullptr } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 051e13d6e0..52905fc40f 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value NULL assigns a empty subtree +// The pointer value nullptr assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/poemstreenode.h b/lib/poems/poemstreenode.h index a1835ba025..e5673344a9 100644 --- a/lib/poems/poemstreenode.h +++ b/lib/poems/poemstreenode.h @@ -18,7 +18,7 @@ #ifndef TREENODE_H #define TREENODE_H -//#define NULL 0 +//#define nullptr 0 //Tree depends on TreeNode diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 67f5b607e3..7b1e718b93 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return NULL; + default: return nullptr; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 369213f7d0..23554f4117 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = NULL; + mappings = nullptr; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 2b3257b0dd..21819d4c02 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = NULL; + system = nullptr; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != NULL) { + while(NodeValue != nullptr) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return NULL; + return nullptr; } } diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 889563f617..2242fba026 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -38,7 +38,7 @@ enum{ROTATE,ALL}; ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL), tbias(NULL), avec(NULL) + id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/asphere command"); @@ -49,7 +49,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 89350dd00f..3878f7e4de 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -461,20 +461,20 @@ void PairGayBerne::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -506,12 +506,12 @@ void PairGayBerne::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&gamma,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&gamma,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&gamma,1,MPI_DOUBLE,0,world); MPI_Bcast(&upsilon,1,MPI_DOUBLE,0,world); diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 6397e77f5b..ba565c5922 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; PairLineLJ::PairLineLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index 81fb4d4b6c..c234ce27bf 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -439,20 +439,20 @@ void PairRESquared::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -480,8 +480,8 @@ void PairRESquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index cf89cf9d33..79253140c0 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; PairTriLJ::PairTriLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index e63d50f814..2619f0cf1b 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -30,7 +30,7 @@ enum{SPHERE,LINE,TRI}; // also in DumpImage /* ---------------------------------------------------------------------- */ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : - Body(lmp, narg, arg), imflag(NULL), imdata(NULL) + Body(lmp, narg, arg), imflag(nullptr), imdata(nullptr) { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); @@ -194,7 +194,7 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index c43484dca2..f2e798c93c 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -321,7 +321,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolygon::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index 18fd65c1dd..b647c7e541 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -122,7 +122,7 @@ int BodyRoundedPolyhedron::nfaces(AtomVecBody::Bonus *bonus) double *BodyRoundedPolyhedron::faces(AtomVecBody::Bonus *bonus) { int nvertices = bonus->ivalue[0]; - if (nvertices == 1 || nvertices == 2) return NULL; + if (nvertices == 1 || nvertices == 2) return nullptr; return bonus->dvalue+3*nsub(bonus)+2*nedges(bonus); } @@ -373,7 +373,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolyhedron::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index cf570d71a3..940250d160 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,INDEX}; /* ---------------------------------------------------------------------- */ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), which(NULL), index(NULL), avec(NULL), bptr(NULL) + Compute(lmp, narg, arg), which(nullptr), index(nullptr), avec(nullptr), bptr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute body/local command"); @@ -66,8 +66,8 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index 18c301678a..6903f7a25c 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -36,7 +36,7 @@ enum{ROTATE,ALL}; /* ---------------------------------------------------------------------- */ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_bias(NULL), tbias(NULL), avec(NULL) + Compute(lmp, narg, arg), id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/body command"); @@ -47,7 +47,7 @@ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index ccfd37bbb2..99ae8ed094 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -133,15 +133,15 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -226,7 +226,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 161f8d6d6d..2507b94d25 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -132,19 +132,19 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -233,7 +233,7 @@ void FixWallBodyPolyhedron::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index ece23d9522..92ae392cd7 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; PairBodyNparticle::PairBodyNparticle(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index fa5a8e57da..b7fa88b740 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -53,16 +53,16 @@ enum {INVALID=0,NONE=1,VERTEXI=2,VERTEXJ=3,EDGE=4}; PairBodyRoundedPolygon::PairBodyRoundedPolygon(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -458,7 +458,7 @@ void PairBodyRoundedPolygon::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index d376ac759e..1d7461199d 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -58,20 +58,20 @@ enum {EF_INVALID=0,EF_NONE,EF_PARALLEL,EF_SAME_SIDE_OF_FACE, PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -81,8 +81,8 @@ PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) mu = 0.0; A_ua = 1.0; - k_n = NULL; - k_na = NULL; + k_n = nullptr; + k_na = nullptr; } /* ---------------------------------------------------------------------- */ @@ -440,7 +440,7 @@ void PairBodyRoundedPolyhedron::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = facnum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; @@ -884,7 +884,7 @@ void PairBodyRoundedPolyhedron::sphere_against_face(int ibody, int jbody, project_pt_plane(x[jbody], xi1, xi2, xi3, h, d, inside); - inside_polygon(ibody, ni, x[ibody], h, NULL, inside, tmp); + inside_polygon(ibody, ni, x[ibody], h, nullptr, inside, tmp); if (inside == 0) continue; delx = h[0] - x[jbody][0]; @@ -1880,7 +1880,7 @@ void PairBodyRoundedPolyhedron::project_pt_plane(const double* q, face_index = face index of the body xmi = atom i's coordinates q1 = tested point on the face (e.g. the projection of a point) - q2 = another point (can be NULL) for face-edge intersection + q2 = another point (can be nullptr) for face-edge intersection Output: inside1 = 1 if q1 is inside the polygon, 0 otherwise inside2 = 1 if q2 is inside the polygon, 0 otherwise @@ -1929,7 +1929,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, anglesum1 += acos(costheta); } - if (q2 != NULL) { + if (q2 != nullptr) { MathExtra::sub3(xi1,q2,u); MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); @@ -1945,7 +1945,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, if (fabs(anglesum1 - MY_2PI) < EPSILON) inside1 = 1; else inside1 = 0; - if (q2 != NULL) { + if (q2 != nullptr) { if (fabs(anglesum2 - MY_2PI) < EPSILON) inside2 = 1; else inside2 = 0; } diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index eea43480e1..28d081c5c9 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -373,19 +373,19 @@ void AngleClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index a97b06a3c7..8a84717228 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -184,10 +184,10 @@ void BondClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -228,5 +228,5 @@ void *BondClass2::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 5be522f2c9..5a0300359d 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -834,45 +834,45 @@ void DihedralClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 0b07a7d60c..801c21c3b4 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -598,15 +598,15 @@ void ImproperClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - - utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + + utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index bb1dfe0ab3..fdfaf158ef 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -509,7 +509,7 @@ void PairLJClass2::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -612,13 +612,13 @@ void PairLJClass2::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -647,10 +647,10 @@ void PairLJClass2::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -707,5 +707,5 @@ void *PairLJClass2::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 8375043ed8..df0019c251 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -364,14 +364,14 @@ void PairLJClass2CoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairLJClass2CoulCut::write_restart_settings(FILE *fp) void PairLJClass2CoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -478,6 +478,6 @@ void *PairLJClass2CoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 3b9ef8deaf..68a5bd2171 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -47,8 +47,8 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - cut_respa = NULL; + ftable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -691,11 +691,11 @@ void PairLJClass2CoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -807,13 +807,13 @@ void PairLJClass2CoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -844,13 +844,13 @@ void PairLJClass2CoulLong::write_restart_settings(FILE *fp) void PairLJClass2CoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -956,5 +956,5 @@ void *PairLJClass2CoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index 786be66c70..9ec25eeccd 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -51,7 +51,7 @@ enum{EDGE,CONSTANT,VARIABLE}; PairBrownian::PairBrownian(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -497,7 +497,7 @@ void PairBrownian::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); @@ -603,12 +603,12 @@ void PairBrownian::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -643,17 +643,17 @@ void PairBrownian::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_target, sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed, sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_target, sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed, sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index 9c2593ffb1..c71c0aa3ef 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -358,7 +358,7 @@ void PairBrownianPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index f95645c613..3ac4d8f2b1 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -395,15 +395,15 @@ void PairColloid::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (comm->me == 0) { - utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -433,9 +433,9 @@ void PairColloid::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index 867bb91979..4e0bf33442 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -566,7 +566,7 @@ void PairLubricate::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair lubricate"); @@ -683,12 +683,12 @@ void PairLubricate::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -721,15 +721,15 @@ void PairLubricate::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 2df1ecaaa6..b3420154fb 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -58,10 +58,10 @@ PairLubricateU::PairLubricateU(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nmax = 0; - fl = Tl = xl = NULL; + fl = Tl = xl = nullptr; cgmax = 0; - bcg = xcg = rcg = rcg1 = pcg = RU = NULL; + bcg = xcg = rcg = rcg1 = pcg = RU = nullptr; // set comm size needed by this Pair @@ -1794,7 +1794,7 @@ void PairLubricateU::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -1909,12 +1909,12 @@ void PairLubricateU::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -1946,14 +1946,14 @@ void PairLubricateU::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 8483bb0f51..501977187b 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -1158,7 +1158,7 @@ void PairLubricateUPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL){ + else if (strstr(modify->fix[i]->style,"wall") != nullptr){ if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index 351757e09b..244b37457b 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -468,7 +468,7 @@ void PairLubricatePoly::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -478,7 +478,7 @@ void PairLubricatePoly::init_style() if (wallfix->xflag) flagwall = 2; // Moving walls exist } - if (strstr(modify->fix[i]->style,"wall") != NULL){ + if (strstr(modify->fix[i]->style,"wall") != nullptr){ flagwall = 1; // Walls exist if (((FixWall *) modify->fix[i])->xflag ) { flagwall = 2; // Moving walls exist diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 484175762e..9cc1439e66 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtomGZ::~DumpAtomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -102,8 +102,8 @@ void DumpAtomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpAtomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 18f0fa56d7..b6a94e587d 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -41,8 +41,8 @@ DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFGGZ::~DumpCFGGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -106,8 +106,8 @@ void DumpCFGGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -163,7 +163,7 @@ void DumpCFGGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index fb2b121f7f..af37ff0a1d 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustomGZ::~DumpCustomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpCustomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpCustomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 49a3c3bef2..fc7b534727 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocalGZ::~DumpLocalGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpLocalGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -170,7 +170,7 @@ void DumpLocalGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index cc07b1ce61..24b4a7a070 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZGZ::~DumpXYZGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -103,8 +103,8 @@ void DumpXYZGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -134,7 +134,7 @@ void DumpXYZGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 1b7eb1e43f..06754003f6 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), vint(NULL), id_fix(NULL), fix(NULL) + Compute(lmp, narg, arg), vint(nullptr), id_fix(nullptr), fix(nullptr) { if (narg != 5) error->all(FLERR,"Illegal compute temp/cs command"); @@ -94,7 +94,7 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : vector = new double[size_vector]; maxatom = 0; - vint = NULL; + vint = nullptr; // set comm size needed by this Compute diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index d50138145a..58f58db1bf 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairBornCoulLongCS::PairBornCoulLongCS(LAMMPS *lmp) : PairBornCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; writedata = 1; } diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index dd43f7f4bd..f8a00a3489 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -43,7 +43,7 @@ PairBuckCoulLongCS::PairBuckCoulLongCS(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 1; writedata = 1; single_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index ee03780a02..6a2117149f 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairCoulLongCS::PairCoulLongCS(LAMMPS *lmp) : PairCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp index 75e3f5ed17..81336e6810 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongCS::PairLJClass2CoulLongCS(LAMMPS *lmp) : PairLJClass2CoulLo respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index 9d60dfdbf6..89523032a0 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -44,7 +44,7 @@ PairLJCutCoulLongCS::PairLJCutCoulLongCS(LAMMPS *lmp) : PairLJCutCoulLong(lmp) respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 25fed599db..d7f3201805 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -438,14 +438,14 @@ void PairLJCutDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -474,10 +474,10 @@ void PairLJCutDipoleCut::write_restart_settings(FILE *fp) void PairLJCutDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 67d2e0aa3c..e6fe0e8dca 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -446,7 +446,7 @@ void PairLJCutDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -490,13 +490,13 @@ void PairLJCutDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,10 +524,10 @@ void PairLJCutDipoleLong::write_restart_settings(FILE *fp) void PairLJCutDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -552,5 +552,5 @@ void *PairLJCutDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 86e143626d..33ee57b83d 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -58,7 +58,7 @@ PairLJLongDipoleLong::PairLJLongDipoleLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongDipoleLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/dipole/long command"); @@ -168,10 +168,10 @@ void *PairLJLongDipoleLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_vdwl", NULL}; + "cut_coul", "cut_vdwl", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, &cut_coul, - &cut_lj_global, NULL}; + &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -220,8 +220,8 @@ void PairLJLongDipoleLong::coeff(int narg, char **arg) void PairLJLongDipoleLong::init_style() { - const char *style3[] = {"ewald/disp", NULL}; - const char *style6[] = {"ewald/disp", NULL}; + const char *style3[] = {"ewald/disp", nullptr}; + const char *style6[] = {"ewald/disp", nullptr}; int i; if (strcmp(update->unit_style,"electron") == 0) @@ -242,14 +242,14 @@ void PairLJLongDipoleLong::init_style() // ensure use of KSpace long-range solver, set g_ewald if (ewald_order&(1<<3)) { // r^-1 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style3[i]&&strcmp(force->kspace_style, style3[i]); ++i); if (!style3[i]) error->all(FLERR,"Pair style requires use of kspace_style ewald/disp"); } if (ewald_order&(1<<6)) { // r^-6 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style6[i]&&strcmp(force->kspace_style, style6[i]); ++i); if (!style6[i]) @@ -343,13 +343,13 @@ void PairLJLongDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -378,11 +378,11 @@ void PairLJLongDipoleLong::write_restart_settings(FILE *fp) void PairLJLongDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 15bc42c37e..c33b496150 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -118,7 +118,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : int newtonflag = 0; int threads_per_atom = -1; double binsize = 0.0; - char *opencl_flags = NULL; + char *opencl_flags = nullptr; int block_pair = -1; int iarg = 4; @@ -232,7 +232,7 @@ void FixGPU::init() // make sure fdotr virial is not accumulated multiple times - if (force->pair_match("^hybrid",0) != NULL) { + if (force->pair_match("^hybrid",0) != nullptr) { PairHybrid *hybrid = (PairHybrid *) force->pair; for (int i = 0; i < hybrid->nstyles; i++) if (!utils::strmatch(hybrid->keywords[i],"/gpu$")) diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index c27c670f2a..dbcb3bcf3f 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -189,7 +189,7 @@ void PairBornCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index a2524909e5..3a6808d43c 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -184,7 +184,7 @@ void PairBornCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index 41823fc27e..aa25fb4cbb 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -180,7 +180,7 @@ void PairBuckCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index 39737ab183..0ced57d285 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -158,7 +158,7 @@ void PairColloidGPU::init_style() } double cell_size = sqrt(maxcut) + neighbor->skin; - int **_form = NULL; + int **_form = nullptr; int n=atom->ntypes; memory->create(_form,n+1,n+1,"colloid/gpu:_form"); for (int i = 1; i <= n; i++) { diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index da59873dd2..3eb678fc79 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -154,7 +154,7 @@ void PairCoulLongCSGPU::compute(int eflag, int vflag) void PairCoulLongCSGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/cs/gpu requires atom attribute q"); @@ -175,7 +175,7 @@ void PairCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index 185d3a7f94..7eb5029558 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -149,7 +149,7 @@ void PairCoulLongGPU::compute(int eflag, int vflag) void PairCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/gpu requires atom attribute q"); @@ -170,7 +170,7 @@ void PairCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 4939537770..9dd5c85c49 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMAlloyGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_alloy_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_alloy_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_alloy_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_alloy_gpu.h b/src/GPU/pair_eam_alloy_gpu.h index 14d9a95c30..3cd78ea511 100644 --- a/src/GPU/pair_eam_alloy_gpu.h +++ b/src/GPU/pair_eam_alloy_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index eb028bc778..10f6b4ebe9 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMFSGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_fs_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_fs_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_fs_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMFSGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_fs_gpu.h b/src/GPU/pair_eam_fs_gpu.h index 70edf2164e..53825f2e8a 100644 --- a/src/GPU/pair_eam_fs_gpu.h +++ b/src/GPU/pair_eam_fs_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 3965f27c67..d8058f11ae 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -145,7 +145,7 @@ void PairEAMGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index e4742a3bef..09566f7de9 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -33,7 +33,7 @@ class PairEAMGPU : public PairEAM { void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 451799027b..58414f4e30 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -74,7 +74,7 @@ PairGayBerneGPU::PairGayBerneGPU(LAMMPS *lmp) : PairGayBerne(lmp), { quat_nmax = 0; reinitflag = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 215998bc88..e4d20e23ad 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -135,7 +135,7 @@ void PairLJ96CutGPU::compute(int eflag, int vflag) void PairLJ96CutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj96/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index 09ed178200..9210188539 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag) void PairLJCharmmCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/charmm/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCharmmCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index f6d671d95a..264ada0fd3 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -177,7 +177,7 @@ void PairLJClass2CoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 2a9d431a42..135a2a7dd9 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag) void PairLJCutCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCutCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index f5987c0ddf..f8f4af5dee 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -143,7 +143,7 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) void PairLJCutCoulMSMGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/coul/msm/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp index 7de9ae2aa6..896a0b9d4d 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp @@ -185,13 +185,13 @@ void PairLJCutDipoleLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 5656c2e18d..3fc727a4f7 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -139,7 +139,7 @@ void PairLJCutGPU::compute(int eflag, int vflag) void PairLJCutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp index 2bd7420e72..8e08075bcd 100644 --- a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp @@ -168,15 +168,15 @@ void PairLJCutTIP4PLongGPU::compute(int eflag, int vflag) void PairLJCutTIP4PLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (atom->tag_enable == 0) error->all(FLERR,"Pair style lj/cut/tip4p/long/gpu requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/gpu requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); if (atom->map_style == 2) @@ -202,7 +202,7 @@ void PairLJCutTIP4PLongGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index f13eea51e7..86ff980c7e 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJExpandCoulLongGPU::compute(int eflag, int vflag) void PairLJExpandCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJExpandCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index 4054f08523..d04a490caf 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -186,13 +186,13 @@ void PairLJSDKCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style is incompatible with KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index 60e6e935e8..70e8752918 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -136,7 +136,7 @@ void PairMIECutGPU::compute(int eflag, int vflag) void PairMIECutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with mie/cut/gpu pair style"); diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index ca70e3c337..4ce9730e0c 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -76,7 +76,7 @@ PairRESquaredGPU::PairRESquaredGPU(LAMMPS *lmp) : PairRESquared(lmp), if (!avec) error->all(FLERR,"Pair resquared/gpu requires atom style ellipsoid"); quat_nmax = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index d544534c9d..54312e4115 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -76,7 +76,7 @@ PairSWGPU::PairSWGPU(LAMMPS *lmp) : PairSW(lmp), gpu_mode(GPU_FORCE) suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -162,9 +162,9 @@ void PairSWGPU::init_style() double *epsilon, *sigma, *lambda, *gamma; double *biga, *bigb, *powerp, *powerq; double *_cut, *_cutsq, *costheta; - epsilon = sigma = lambda = gamma = NULL; - biga = bigb = powerp = powerq = NULL; - _cut = _cutsq = costheta = NULL; + epsilon = sigma = lambda = gamma = nullptr; + biga = bigb = powerp = powerq = nullptr; + _cut = _cutsq = costheta = nullptr; memory->create(epsilon,nparams,"pair:epsilon"); memory->create(sigma,nparams,"pair:sigma"); diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index 4ac674aa94..20d21615a9 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -165,8 +165,8 @@ void PairTableGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // pack tables and send them to device - double ***table_coeffs = NULL; - double **table_data = NULL; + double ***table_coeffs = nullptr; + double **table_data = nullptr; memory->create(table_coeffs, ntypes+1, ntypes+1, 6, "table:coeffs"); Table *tb; diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 885dd73d9e..b76bf99d5d 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -80,7 +80,7 @@ PairTersoffGPU::PairTersoffGPU(LAMMPS *lmp) : PairTersoff(lmp), gpu_mode(GPU_FOR suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -168,11 +168,11 @@ void PairTersoffGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index 35edd9ea22..57e13bb299 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -73,7 +73,7 @@ PairTersoffMODGPU::PairTersoffMODGPU(LAMMPS *lmp) : PairTersoffMOD(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -160,11 +160,11 @@ void PairTersoffMODGPU::init_style() double *biga, *bigb, *bigr, *bigd; double *c1, *c2, *c3, *c4, *c5, *h; double *beta, *powern, *ca1, *powern_del, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - powern_del = ca1 = NULL; - c1 = c2 = c3 = c4 = c5 = h = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + powern_del = ca1 = nullptr; + c1 = c2 = c3 = c4 = c5 = h = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index 73251ee726..5facd86254 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -81,7 +81,7 @@ PairTersoffZBLGPU::PairTersoffZBLGPU(LAMMPS *lmp) : PairTersoffZBL(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairTersoffZBLGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *Z_i, *Z_j, *ZBLcut, *ZBLexpscale, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index fe6adfef12..f462e579c5 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -141,7 +141,7 @@ void PairUFMGPU::compute(int eflag, int vflag) void PairUFMGPU::init_style() { -// cut_respa = NULL; +// cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with ufm/gpu pair style"); diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index 868b8de0c0..99a763bfbc 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -77,7 +77,7 @@ PairVashishtaGPU::PairVashishtaGPU(LAMMPS *lmp) : PairVashishta(lmp), gpu_mode(G suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairVashishtaGPU::init_style() double *bigw, *c0, *costheta, *bigb; double *big2b, *bigc; - cutsq = r0 = gamma = eta = NULL; - lam1inv = lam4inv = zizj = mbigd = NULL; - dvrc = big6w = heta = bigh = NULL; - bigw = c0 = costheta = bigb = NULL; - big2b = bigc = NULL; + cutsq = r0 = gamma = eta = nullptr; + lam1inv = lam4inv = zizj = mbigd = nullptr; + dvrc = big6w = heta = bigh = nullptr; + bigw = c0 = costheta = bigb = nullptr; + big2b = bigc = nullptr; memory->create(cutsq,nparams,"pair:cutsq"); memory->create(r0,nparams,"pair:r0"); diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index cb5e08a46d..9b753edd68 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -91,7 +91,7 @@ void PPPM_GPU_API(forces)(double **f); PPPMGPU::PPPMGPU(LAMMPS *lmp) : PPPM(lmp) { - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; kspace_split = false; im_real_space = false; @@ -117,11 +117,11 @@ void PPPMGPU::init() // thru its deallocate(), allocate() // NOTE: could free density_brick and vdxyz_brick after PPPM allocates them, // before allocating db_gpu and vd_brick down below, if don't need, - // if do this, make sure to set them to NULL + // if do this, make sure to set them to nullptr destroy_3d_offset(density_brick_gpu,nzlo_out,nylo_out); destroy_3d_offset(vd_brick,nzlo_out,nylo_out); - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; PPPM::init(); @@ -707,7 +707,7 @@ FFT_SCALAR ***PPPMGPU::create_3d_offset(int n1lo, int n1hi, int n2lo, int n2hi, void PPPMGPU::destroy_3d_offset(FFT_SCALAR ***array, int n1_offset, int n2_offset) { - if (array == NULL) return; + if (array == nullptr) return; memory->sfree(&array[n1_offset][n2_offset]); memory->sfree(array + n1_offset); } @@ -797,7 +797,7 @@ void PPPMGPU::compute_group_group(int groupbit_A, int groupbit_B, int AA_flag) // extend size of per-atom arrays if necessary // part2grid needs to be allocated - if (atom->nmax > nmax || part2grid == NULL) { + if (atom->nmax > nmax || part2grid == nullptr) { memory->destroy(part2grid); nmax = atom->nmax; memory->create(part2grid,nmax,3,"pppm:part2grid"); diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index d449bb5614..0bf900729c 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -48,10 +48,10 @@ enum{CONSTANT,EQUAL}; // same as FixGravity /* ---------------------------------------------------------------------- */ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), radius_poly(NULL), frac_poly(NULL), - idrigid(NULL), idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), - imageflags(NULL), fixrigid(NULL), fixshake(NULL), recvcounts(NULL), - displs(NULL), random(NULL), random2(NULL) + Fix(lmp, narg, arg), radius_poly(nullptr), frac_poly(nullptr), + idrigid(nullptr), idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), + imageflags(nullptr), fixrigid(nullptr), fixshake(nullptr), recvcounts(nullptr), + displs(nullptr), random(nullptr), random2(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix pour command"); @@ -344,7 +344,7 @@ void FixPour::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix pour rigid fix does not exist"); @@ -359,7 +359,7 @@ void FixPour::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix pour shake fix does not exist"); @@ -456,7 +456,7 @@ void FixPour::pre_exchange() // perform allgatherv to acquire list of nearby particles on all procs - double *ptr = NULL; + double *ptr = nullptr; if (ncount) ptr = xmine[0]; MPI_Allgatherv(ptr,4*ncount,MPI_DOUBLE, xnear[0],recvcounts,displs,MPI_DOUBLE,world); @@ -889,16 +889,16 @@ void FixPour::options(int narg, char **arg) iregion = -1; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; ignoreflag = ignoreline = ignoretri = 0; dstyle = ONE; radius_max = radius_one = 0.5; - radius_poly = frac_poly = NULL; + radius_poly = frac_poly = nullptr; density_lo = density_hi = 1.0; volfrac = 0.25; maxattempt = 50; @@ -1091,5 +1091,5 @@ void *FixPour::extract(const char *str, int &itype) itype = 0; return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 9ec76b88f1..25d271be9d 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -63,8 +63,8 @@ enum {ROLL_NONE, ROLL_SDS}; /* ---------------------------------------------------------------------- */ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), history_one(NULL), - fix_rigid(NULL), mass_rigid(NULL) + Fix(lmp, narg, arg), idregion(nullptr), history_one(nullptr), + fix_rigid(nullptr), mass_rigid(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command"); @@ -303,7 +303,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wallstyle args - idregion = NULL; + idregion = nullptr; if (strcmp(arg[iarg],"xplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); @@ -407,16 +407,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - history_one = NULL; + history_one = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // initialize history as if particle is not touching region - // history_one will be NULL for wallstyle = REGION + // history_one will be nullptr for wallstyle = REGION if (use_history && history_one) { int nlocal = atom->nlocal; @@ -471,7 +471,7 @@ void FixWallGran::init() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -576,7 +576,7 @@ void FixWallGran::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential // set history if pair potential stores history @@ -681,7 +681,7 @@ void FixWallGran::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 3aa518209a..1b3be22e7f 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -103,7 +103,7 @@ class FixWallGran : public Fix { // rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 543df02fc2..f91bac2c9b 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -39,9 +39,9 @@ enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; /* ---------------------------------------------------------------------- */ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : - FixWallGran(lmp, narg, arg), region(NULL), region_style(NULL), - ncontact(NULL), - walls(NULL), history_many(NULL), c2r(NULL) + FixWallGran(lmp, narg, arg), region(nullptr), region_style(nullptr), + ncontact(nullptr), + walls(nullptr), history_many(nullptr), c2r(nullptr) { restart_global = 1; motion_resetflag = 0; @@ -61,11 +61,11 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : // do not register with Atom class, since parent class did that memory->destroy(history_one); - history_one = NULL; + history_one = nullptr; - ncontact = NULL; - walls = NULL; - history_many = NULL; + ncontact = nullptr; + walls = nullptr; + history_many = nullptr; grow_arrays(atom->nmax); // initialize shear history as if particle is not touching region @@ -262,7 +262,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 68a7803f4b..b296f84657 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -52,7 +52,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // set comm size needed by this Pair if used with fix rigid @@ -65,7 +65,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_HH_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -426,7 +426,7 @@ void PairGranHookeHistory::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -450,7 +450,7 @@ void PairGranHookeHistory::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -554,7 +554,7 @@ void PairGranHookeHistory::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -580,12 +580,12 @@ void PairGranHookeHistory::write_restart_settings(FILE *fp) void PairGranHookeHistory::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kn,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kt,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamman,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gammat,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&xmu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kn,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kt,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamman,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gammat,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&xmu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kn,1,MPI_DOUBLE,0,world); MPI_Bcast(&kt,1,MPI_DOUBLE,0,world); diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index 309af54ee6..dd9a843142 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -61,7 +61,7 @@ class PairGranHookeHistory : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index ee0eb2ad77..5edc656a67 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -73,14 +73,14 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; - onerad_dynamic = NULL; - onerad_frozen = NULL; - maxrad_dynamic = NULL; - maxrad_frozen = NULL; + onerad_dynamic = nullptr; + onerad_frozen = nullptr; + maxrad_dynamic = nullptr; + maxrad_frozen = nullptr; - history_transfer_factors = NULL; + history_transfer_factors = nullptr; dt = update->dt; @@ -97,7 +97,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -1101,7 +1101,7 @@ void PairGranular::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (use_history && fix_history == NULL) { + if (use_history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -1125,7 +1125,7 @@ void PairGranular::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -1330,20 +1330,20 @@ void PairGranular::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,NULL,error); - utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); + utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index e9ba629b49..ce417812de 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -56,7 +56,7 @@ class PairGranular : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 776d8aab98..5428b75093 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -67,8 +67,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixStoreKIM::FixStoreKIM(LAMMPS *lmp, int narg, char **arg) - : Fix(lmp, narg, arg), simulator_model(NULL), model_name(NULL), - model_units(NULL), user_units(NULL) + : Fix(lmp, narg, arg), simulator_model(nullptr), model_name(nullptr), + model_units(nullptr), user_units(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix STORE/KIM command"); } @@ -82,25 +82,25 @@ FixStoreKIM::~FixStoreKIM() if (simulator_model) { KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); - simulator_model = NULL; + simulator_model = nullptr; } if (model_name) { char *mn = (char *)model_name; delete[] mn; - model_name = NULL; + model_name = nullptr; } if (model_units) { char *mu = (char *)model_units; delete[] mu; - model_units = NULL; + model_units = nullptr; } if (user_units) { char *uu = (char *)user_units; delete[] uu; - user_units = NULL; + user_units = nullptr; } } @@ -151,5 +151,5 @@ void *FixStoreKIM::getptr(const char *name) else if (strcmp(name,"model_name") == 0) return model_name; else if (strcmp(name,"model_units") == 0) return model_units; else if (strcmp(name,"user_units") == 0) return user_units; - else return NULL; + else return nullptr; } diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 6baf480993..4e4890ea6e 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -79,8 +79,8 @@ class FixStoreKIM : public Fix { private: void *simulator_model; // pointer to KIM simulator model class void *model_name; // string of KIM model name - void *model_units; // string of unit conversion origin or NULL - void *user_units; // string of unit conversion target or NULL + void *model_units; // string of unit conversion origin or nullptr + void *user_units; // string of unit conversion target or nullptr }; } diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 684108be71..bbeffe2d82 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -96,7 +96,7 @@ void KimInit::command(int narg, char **arg) } else unit_conversion_mode = false; char *model_units; - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; if (universe->me == 0) std::remove("kim.log"); @@ -366,8 +366,8 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM if (numberOfParameters) { KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; mesg += std::to_string(numberOfParameters) + " mutable parameters. \n"; @@ -486,7 +486,7 @@ void KimInit::write_log_cite(char *model_name) int availableAsString; char const * fileString; err = KIM_Collections_GetItemMetadataFile( - coll,i,&fileName,NULL,NULL,&availableAsString,&fileString); + coll,i,&fileName,nullptr,nullptr,&availableAsString,&fileString); if (err) continue; if (0 == strncmp("kimcite",fileName,7)) { diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 5f45dd34dc..7551216072 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -103,12 +103,12 @@ void KimInteractions::do_setup(int narg, char **arg) fixed_types = false; } - char *model_name = NULL; - KIM_SimulatorModel *simulatorModel(NULL); + char *model_name = nullptr; + KIM_SimulatorModel *simulatorModel(nullptr); // check if we had a kim_init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. - // validate model name if not given as NULL. + // validate model name if not given as nullptr. int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { @@ -256,7 +256,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con FILE *fp; fp = fopen(filename.c_str(),"r"); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR,"Parameter file not found"); } @@ -266,7 +266,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 6f4ac5cc21..121f167ab6 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -185,7 +185,7 @@ void KimParam::command(int narg, char **arg) input->write_echo(fmt::format("#=== BEGIN kim-param {} ===================" "==================\n",kim_param_get_set)); - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; std::string atom_type_list; @@ -251,9 +251,9 @@ void KimParam::command(int narg, char **arg) // Get the parameters if (kim_param_get_set == "get") { // Parameter name - char *paramname = NULL; + char *paramname = nullptr; // Variable name - char *varname = NULL; + char *varname = nullptr; // Loop over all the arguments for (int i = 1; i < narg;) { @@ -267,8 +267,8 @@ void KimParam::command(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kim_error = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -344,7 +344,7 @@ void KimParam::command(int narg, char **arg) } int const nvars = nubound - nlbound + 1; - char **varsname = NULL; + char **varsname = nullptr; if (i < narg) { // Get the variable/variable_base name diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 95a1274859..4a381fb8da 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -112,7 +112,7 @@ void kimProperty::command(int narg, char **arg) PyGILState_STATE gstate = PyGILState_Ensure(); // kim_property module - PyObject *kim_property = NULL; + PyObject *kim_property = nullptr; // import kim_property { @@ -438,7 +438,7 @@ void kimProperty::command(int narg, char **arg) "evaluation failed!"); } } else - pValue = NULL; + pValue = nullptr; // Destroy the variable input->variable->set("kim_property_str delete"); diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7ed70972c5..30b5e6cbb2 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -78,9 +78,9 @@ PairKIM::PairKIM(LAMMPS *lmp) : Pair(lmp), settings_call_count(0), init_style_call_count(0), - kim_modelname(NULL), - lmps_map_species_to_unique(NULL), - lmps_unique_elements(NULL), + kim_modelname(nullptr), + lmps_map_species_to_unique(nullptr), + lmps_unique_elements(nullptr), lmps_num_unique_elements(0), lmps_units(METAL), lengthUnit(KIM_LENGTH_UNIT_unused), @@ -88,8 +88,8 @@ PairKIM::PairKIM(LAMMPS *lmp) : chargeUnit(KIM_CHARGE_UNIT_unused), temperatureUnit(KIM_TEMPERATURE_UNIT_unused), timeUnit(KIM_TIME_UNIT_unused), - pkim(NULL), - pargs(NULL), + pkim(nullptr), + pargs(nullptr), kim_model_support_for_energy(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_forces(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_particleEnergy(KIM_SUPPORT_STATUS_notSupported), @@ -97,15 +97,15 @@ PairKIM::PairKIM(LAMMPS *lmp) : lmps_local_tot_num_atoms(0), kim_global_influence_distance(0.0), kim_number_of_neighbor_lists(0), - kim_cutoff_values(NULL), - modelWillNotRequestNeighborsOfNoncontributingParticles(NULL), - neighborLists(NULL), - kim_particle_codes(NULL), + kim_cutoff_values(nullptr), + modelWillNotRequestNeighborsOfNoncontributingParticles(nullptr), + neighborLists(nullptr), + kim_particle_codes(nullptr), lmps_maxalloc(0), - kim_particleSpecies(NULL), - kim_particleContributing(NULL), - lmps_stripped_neigh_list(NULL), - lmps_stripped_neigh_ptr(NULL) + kim_particleSpecies(nullptr), + kim_particleContributing(nullptr), + lmps_stripped_neigh_list(nullptr), + lmps_stripped_neigh_ptr(nullptr) { // Initialize Pair data members to appropriate values single_enable = 0; // We do not provide the Single() function @@ -137,7 +137,7 @@ PairKIM::~PairKIM() if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } @@ -393,7 +393,7 @@ void PairKIM::coeff(int narg, char **arg) // setup mapping between LAMMPS unique elements and KIM species codes if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } kim_particle_codes = new int[lmps_num_unique_elements]; @@ -430,7 +430,7 @@ void PairKIM::coeff(int narg, char **arg) int kimerror; // Parameter name - char *paramname = NULL; + char *paramname = nullptr; for (int i = 2 + atom->ntypes; i < narg;) { // Parameter name @@ -443,8 +443,8 @@ void PairKIM::coeff(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kimerror = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -903,7 +903,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs,KIM_COMPUTE_ARGUMENT_NAME_partialEnergy, - static_cast(NULL)); + static_cast(nullptr)); } } @@ -924,7 +924,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleEnergy, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( @@ -937,7 +937,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, - static_cast(NULL)); + static_cast(nullptr)); } else { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, &(atom->f[0][0])); @@ -960,7 +960,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleVirial, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index e826a7c392..ed0cfccd43 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -87,7 +87,7 @@ AtomKokkos::~AtomKokkos() memoryKK->destroy_kokkos(k_duChem,duChem); memoryKK->destroy_kokkos(k_dvector,dvector); - dvector = NULL; + dvector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -282,7 +282,7 @@ int AtomKokkos::add_custom(const char *name, int flag) /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to NULL + free memory for vector and name and set ptrs to nullptr ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ @@ -290,14 +290,14 @@ void AtomKokkos::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { //memoryKK->destroy_kokkos(dvector); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index 662f09fe5a..3090a62d11 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -48,7 +48,7 @@ AtomVecAngleKokkos::AtomVecAngleKokkos(LAMMPS *lmp) : AtomVecKokkos(lmp) k_count = DAT::tdual_int_1d("atom::k_count",1); atomKK = (AtomKokkos *) atom; commKK = (CommKokkos *) comm; - buffer = NULL; + buffer = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index 9e39f53733..f2dca9bebc 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; AtomVecKokkos::AtomVecKokkos(LAMMPS *lmp) : AtomVec(lmp) { kokkosable = 1; - buffer = NULL; + buffer = nullptr; buffer_size = 0; no_comm_vel_flag = 0; diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 51ba6bbdb2..9e1bfcbc5c 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -45,7 +45,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) { if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]); memory->sfree(sendlist); - sendlist = NULL; + sendlist = nullptr; k_sendlist = DAT::tdual_int_2d(); k_total_send = DAT::tdual_int_scalar("comm::k_total_send"); @@ -54,9 +54,9 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) // initialize comm buffers & exchange memory memory->destroy(buf_send); - buf_send = NULL; + buf_send = nullptr; memory->destroy(buf_recv); - buf_recv = NULL; + buf_recv = nullptr; k_exchange_lists = DAT::tdual_int_2d("comm:k_exchange_lists",2,100); k_exchange_sendlist = Kokkos::subview(k_exchange_lists,0,Kokkos::ALL); @@ -65,7 +65,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) k_sendflag = DAT::tdual_int_1d("comm:k_sendflag",100); memory->destroy(maxsendlist); - maxsendlist = NULL; + maxsendlist = nullptr; memory->create(maxsendlist,maxswap,"comm:maxsendlist"); for (int i = 0; i < maxswap; i++) { maxsendlist[i] = BUFMIN; @@ -82,11 +82,11 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) CommKokkos::~CommKokkos() { memoryKK->destroy_kokkos(k_sendlist,sendlist); - sendlist = NULL; + sendlist = nullptr; memoryKK->destroy_kokkos(k_buf_send,buf_send); - buf_send = NULL; + buf_send = nullptr; memoryKK->destroy_kokkos(k_buf_recv,buf_recv); - buf_recv = NULL; + buf_recv = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fft3d_kokkos.cpp b/src/KOKKOS/fft3d_kokkos.cpp index ff95998e4e..d7f556cf87 100644 --- a/src/KOKKOS/fft3d_kokkos.cpp +++ b/src/KOKKOS/fft3d_kokkos.cpp @@ -69,7 +69,7 @@ FFT3dKokkos::FFT3dKokkos(LAMMPS *lmp, MPI_Comm comm, int nfast, int in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective,nthreads,usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ @@ -403,7 +403,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan = new struct fft_plan_3d_kokkos; remapKK = new RemapKokkos(lmp); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -422,7 +422,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; @@ -436,7 +436,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -461,7 +461,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -502,7 +502,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -521,7 +521,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remapKK->remap_3d_create_plan_kokkos(comm, @@ -530,7 +530,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -648,39 +648,39 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #elif defined(FFT_CUFFT) @@ -704,16 +704,16 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl kissfftKK = new KissFFTKokkos(); - plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,NULL,NULL); - plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,NULL,NULL); + plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,NULL,NULL); - plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,NULL,NULL); + plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -725,8 +725,8 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,NULL,NULL); - plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,NULL,NULL); + plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index dadf9e4c8b..8761b54d49 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -735,7 +735,7 @@ void FixLangevinKokkos::reset_dt() template double FixLangevinKokkos::compute_scalar() { - if (!tallyflag || flangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr) return 0.0; v = atomKK->k_v.template view(); mask = atomKK->k_mask.template view(); @@ -893,19 +893,19 @@ void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) template void FixLangevinKokkos::cleanup_copy() { - random = NULL; - tstr = NULL; - gfactor1 = NULL; - gfactor2 = NULL; - ratio = NULL; - id_temp = NULL; - flangevin = NULL; - tforce = NULL; + random = nullptr; + tstr = nullptr; + gfactor1 = nullptr; + gfactor2 = nullptr; + ratio = nullptr; + id_temp = nullptr; + flangevin = nullptr; + tforce = nullptr; gjfflag = 0; - franprev = NULL; - lv = NULL; - id = style = NULL; - vatom = NULL; + franprev = nullptr; + lv = nullptr; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index 13b9cb02a7..f123a663d2 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -34,7 +34,7 @@ FixMinimizeKokkos::FixMinimizeKokkos(LAMMPS *lmp, int narg, char **arg) : FixMinimizeKokkos::~FixMinimizeKokkos() { memoryKK->destroy_kokkos(k_vectors,vectors); - vectors = NULL; + vectors = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index d1f3f66327..56a37c8d1b 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -35,9 +35,9 @@ FixNeighHistoryKokkos::FixNeighHistoryKokkos(LAMMPS *lmp, int narg, memory->destroy(npartner); memory->sfree(partner); memory->sfree(valuepartner); - npartner = NULL; - partner = NULL; - valuepartner = NULL; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; maxpartner = 8; grow_arrays(atom->nmax); diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index beabc55727..fe6aeaccff 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -163,8 +163,8 @@ void FixNVEKokkos::final_integrate_rmass_item(int i) const template void FixNVEKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.cpp b/src/KOKKOS/fix_nve_sphere_kokkos.cpp index 64298748db..f292f30d3f 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.cpp +++ b/src/KOKKOS/fix_nve_sphere_kokkos.cpp @@ -39,8 +39,8 @@ FixNVESphereKokkos::FixNVESphereKokkos(LAMMPS *lmp, int narg, char * template void FixNVESphereKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index eac044da28..dfa0ff6091 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -1424,7 +1424,7 @@ void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double template void FixQEqReaxKokkos::cleanup_copy() { - id = style = NULL; + id = style = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp index f98ab0314c..faa5a98315 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp @@ -51,7 +51,7 @@ FixReaxCBondsKokkos::~FixReaxCBondsKokkos() void FixReaxCBondsKokkos::init() { Pair *pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c/kk"); FixReaxCBonds::init(); diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxc_species_kokkos.cpp index f3bce2f9c0..4674389ed4 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_species_kokkos.cpp @@ -58,7 +58,7 @@ FixReaxCSpeciesKokkos::~FixReaxCSpeciesKokkos() void FixReaxCSpeciesKokkos::init() { Pair* pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/species/kk without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/species/kk without " "pair_style reax/c/kk"); FixReaxCSpecies::init(); diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 18bc4225a7..1ba227d539 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -62,7 +62,7 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; template FixRxKokkos::FixRxKokkos(LAMMPS *lmp, int narg, char **arg) : FixRX(lmp, narg, arg), - pairDPDEKK(NULL), + pairDPDEKK(nullptr), update_kinetics_data(true) { kokkosable = 1; @@ -117,14 +117,14 @@ void FixRxKokkos::init() //FixRX::init(); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); pairDPDEKK = dynamic_cast(pairDPDE); - if (pairDPDEKK == NULL) + if (pairDPDEKK == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy/kk with fix rx/kk"); bool eos_flag = false; @@ -964,7 +964,7 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d //const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) @@ -1111,7 +1111,7 @@ KOKKOS_INLINE_FUNCTION int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, VectorType& dydt, UserDataType& userData) const { #define kFor (userData.kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData.rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 26c6ae4ae5..0033e69649 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -121,7 +121,7 @@ class FixRxKokkos : public FixRX { value_type *m_data; KOKKOS_INLINE_FUNCTION - StridedArrayType() : m_data(NULL) {} + StridedArrayType() : m_data(nullptr) {} KOKKOS_INLINE_FUNCTION StridedArrayType(value_type *ptr) : m_data(ptr) {} diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index a11e8b4bd4..00d717c915 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -57,7 +57,7 @@ FixSetForceKokkos::~FixSetForceKokkos() if (copymode) return; memoryKK->destroy_kokkos(k_sforce,sforce); - sforce = NULL; + sforce = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void FixSetForceKokkos::post_force(int /*vflag*/) // update region if necessary - region = NULL; + region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 9be4321ff2..1779ebc855 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -63,7 +63,7 @@ using namespace random_external_state; template FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **arg) : - FixShardlow(lmp, narg, arg), k_pairDPDE(NULL), ghostmax(0), nlocal(0) , nghost(0) + FixShardlow(lmp, narg, arg), k_pairDPDE(nullptr), ghostmax(0), nlocal(0) , nghost(0) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -74,8 +74,8 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); -// k_pairDPD = NULL; - k_pairDPDE = NULL; +// k_pairDPD = nullptr; + k_pairDPDE = nullptr; // k_pairDPD = (PairDPDfdtKokkos *) force->pair_match("dpd/fdt",1); k_pairDPDE = dynamic_cast *>(force->pair_match("dpd/fdt/energy",0)); @@ -88,7 +88,7 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a // } - if(/* k_pairDPD == NULL &&*/ k_pairDPDE == NULL) + if(/* k_pairDPD == nullptr &&*/ k_pairDPDE == nullptr) error->all(FLERR,"Must use pair_style "/*"dpd/fdt/kk or "*/"dpd/fdt/energy/kk with fix shardlow/kk"); #ifdef DEBUG_SSA_PAIR_CT diff --git a/src/KOKKOS/gridcomm_kokkos.cpp b/src/KOKKOS/gridcomm_kokkos.cpp index 909e3c8544..0a175343c3 100644 --- a/src/KOKKOS/gridcomm_kokkos.cpp +++ b/src/KOKKOS/gridcomm_kokkos.cpp @@ -91,21 +91,21 @@ GridCommKokkos::~GridCommKokkos() // regular comm data struct for (int i = 0; i < nswap; i++) { - swap[i].packlist = NULL; - swap[i].unpacklist = NULL; + swap[i].packlist = nullptr; + swap[i].unpacklist = nullptr; } // tiled comm data structs for (int i = 0; i < nsend; i++) - send[i].packlist = NULL; + send[i].packlist = nullptr; for (int i = 0; i < nrecv; i++) - recv[i].unpacklist = NULL; + recv[i].unpacklist = nullptr; for (int i = 0; i < ncopy; i++) { - copy[i].packlist = NULL; - copy[i].unpacklist = NULL; + copy[i].packlist = nullptr; + copy[i].unpacklist = nullptr; } } @@ -459,7 +459,7 @@ void GridCommKokkos::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 79fd0685b0..16d906ba3c 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -226,7 +226,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int len; char mpi_version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI_Get_library_version(mpi_version, &len); - if (strstr(&mpi_version[0], "Spectrum") != NULL) { + if (strstr(&mpi_version[0], "Spectrum") != nullptr) { cuda_aware_flag = 0; char* str; if (str = getenv("OMPI_MCA_pml_pami_enable_cuda")) diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 83e8b9ec7c..df85f72c65 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -78,7 +78,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); array = data.h_view.data(); @@ -88,9 +88,9 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -100,7 +100,7 @@ void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) template TYPE destroy_kokkos(TYPE &data) { - /*if(data.data()!=NULL) + /*if(data.data()!=nullptr) free(data.data());*/ data = TYPE(); return data; @@ -186,7 +186,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); n += n2; @@ -211,7 +211,7 @@ template bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &h_data(i,0); n += n2; @@ -228,14 +228,14 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, int n2, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,n2,name); + if (array == nullptr) return create_kokkos(data,array,n1,n2,name); data.resize(n1,n2); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type**) srealloc(array,nbytes,name); for (int i = 0; i < n1; i++) if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -252,7 +252,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -263,7 +263,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); @@ -272,7 +272,7 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -286,10 +286,10 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type** &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); sfree(array); - array = NULL; + array = nullptr; } }; diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index 032538fe60..759b00976f 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -49,7 +49,7 @@ using namespace LAMMPS_NS; MinKokkos::MinKokkos(LAMMPS *lmp) : Min(lmp) { atomKK = (AtomKokkos *) atom; - fix_minimize_kk = NULL; + fix_minimize_kk = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index b21a7cb1ee..cadfccfa6b 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -41,10 +41,10 @@ NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp), neighbond_host(lmp),neighbond_device(lmp) { device_flag = 0; - bondlist = NULL; - anglelist = NULL; - dihedrallist = NULL; - improperlist = NULL; + bondlist = nullptr; + anglelist = nullptr; + dihedrallist = nullptr; + improperlist = nullptr; } /* ---------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ NeighborKokkos::~NeighborKokkos() { if (!copymode) { memoryKK->destroy_kokkos(k_cutneighsq,cutneighsq); - cutneighsq = NULL; + cutneighsq = nullptr; memoryKK->destroy_kokkos(k_ex_type,ex_type); memoryKK->destroy_kokkos(k_ex1_type,ex1_type); diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index afa8bd649a..8f874b9feb 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -48,9 +48,9 @@ PairBuckCoulCutKokkos::PairBuckCoulCutKokkos(LAMMPS *lmp):PairBuckCo execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -69,11 +69,11 @@ PairBuckCoulCutKokkos::~PairBuckCoulCutKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } } diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index a77ef291fa..6a13254e8a 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -55,8 +55,8 @@ PairBuckCoulLongKokkos::PairBuckCoulLongKokkos(LAMMPS *lmp):PairBuck execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -75,11 +75,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } } @@ -88,11 +88,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() template void PairBuckCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 71f63a9f92..efddb43a99 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -46,7 +46,7 @@ PairBuckKokkos::PairBuckKokkos(LAMMPS *lmp) : PairBuck(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -59,9 +59,9 @@ PairBuckKokkos::~PairBuckKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 8fae09e1eb..a77f738a5f 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -37,7 +37,7 @@ PairCoulCutKokkos::PairCoulCutKokkos(LAMMPS *lmp) : PairCoulCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -55,9 +55,9 @@ template void PairCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index e3326f3056..b469a2b8c1 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -46,7 +46,7 @@ PairCoulDebyeKokkos::PairCoulDebyeKokkos(LAMMPS *lmp):PairCoulDebye( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } @@ -66,9 +66,9 @@ template void PairCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 780d57d921..aeba50c0ad 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairCoulLongKokkos::PairCoulLongKokkos(LAMMPS *lmp):PairCoulLong(lmp execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_coulsq = 0.0; } @@ -71,9 +71,9 @@ PairCoulLongKokkos::~PairCoulLongKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_coulsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -82,10 +82,10 @@ PairCoulLongKokkos::~PairCoulLongKokkos() template void PairCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 280e47b771..4e0c44acba 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMAlloyKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index aee94471cf..2c4e4fdf93 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMAlloyKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index a4828c00aa..2714da9cae 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMFSKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 5f1a912f54..104ecf1a0b 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMFSKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 5992b7ed6d..99719bbe5a 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -59,7 +59,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 035bf87cec..811589972f 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -1715,16 +1715,16 @@ void PairExp6rxKokkos::read_file(char *file) char **words = new char*[params_per_line+1]; memoryKK->destroy_kokkos(k_params,params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -1741,7 +1741,7 @@ void PairExp6rxKokkos::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1763,7 +1763,7 @@ void PairExp6rxKokkos::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1783,7 +1783,7 @@ void PairExp6rxKokkos::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index a442a987f6..a1c376cdfa 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -48,8 +48,8 @@ PairGranHookeHistoryKokkos::~PairGranHookeHistoryKokkos() if (allocated) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } @@ -64,7 +64,7 @@ void PairGranHookeHistoryKokkos::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",3); char **fixarg = new char*[4]; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index b5b0a9d02b..23b8401fe8 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -87,7 +87,7 @@ void PairHybridKokkos::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 396a5f2d48..1eaf20eadb 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -94,7 +94,7 @@ struct PairComputeFunctor { dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); }; - // Call cleanup_copy which sets allocations NULL which are destructed by the PairStyle + // Call cleanup_copy which sets allocations nullptr which are destructed by the PairStyle ~PairComputeFunctor() {c.cleanup_copy();list.copymode = 1;}; KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const { diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index 2ce0569383..adfe095dc5 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -54,7 +54,7 @@ PairLJCharmmCoulCharmmImplicitKokkos::PairLJCharmmCoulCharmmImplicit execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -74,9 +74,9 @@ PairLJCharmmCoulCharmmImplicitKokkos::~PairLJCharmmCoulCharmmImplici memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -88,11 +88,11 @@ template void PairLJCharmmCoulCharmmImplicitKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index e59da8d298..a20a6242c3 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulCharmmKokkos::PairLJCharmmCoulCharmmKokkos(LAMMPS *l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulCharmmKokkos::~PairLJCharmmCoulCharmmKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulCharmmKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index a06e569ebe..2f4a03e9b0 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulLongKokkos::PairLJCharmmCoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulLongKokkos::~PairLJCharmmCoulLongKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index b45ff6d31a..799f1a2789 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -43,9 +43,9 @@ PairLJClass2CoulCutKokkos::PairLJClass2CoulCutKokkos(LAMMPS *lmp):Pa execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -67,11 +67,11 @@ template void PairLJClass2CoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index fc97c3491f..7fafd865c0 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -51,8 +51,8 @@ PairLJClass2CoulLongKokkos::PairLJClass2CoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -74,11 +74,11 @@ template void PairLJClass2CoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index a0d2fba581..6a66a8861d 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -46,7 +46,7 @@ PairLJClass2Kokkos::PairLJClass2Kokkos(LAMMPS *lmp) : PairLJClass2(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJClass2Kokkos::~PairLJClass2Kokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJClass2Kokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index d269de45e4..3749690b79 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -42,9 +42,9 @@ PairLJCutCoulCutKokkos::PairLJCutCoulCutKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -66,11 +66,11 @@ template void PairLJCutCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 05e0d15dbf..bd4530cf32 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -46,9 +46,9 @@ PairLJCutCoulDebyeKokkos::PairLJCutCoulDebyeKokkos(LAMMPS *lmp):Pair execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -70,11 +70,11 @@ template void PairLJCutCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index bdd167a299..47fa5cf114 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -56,9 +56,9 @@ PairLJCutCoulDSFKokkos::PairLJCutCoulDSFKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } @@ -80,11 +80,11 @@ template void PairLJCutCoulDSFKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index b6ea969d86..6f31a816d2 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -53,8 +53,8 @@ PairLJCutCoulLongKokkos::PairLJCutCoulLongKokkos(LAMMPS *lmp):PairLJ execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -66,8 +66,8 @@ PairLJCutCoulLongKokkos::~PairLJCutCoulLongKokkos() { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; if (allocated){ memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); @@ -80,11 +80,11 @@ template void PairLJCutCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 8294d62f68..674c54fa4c 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -41,7 +41,7 @@ PairLJCutKokkos::PairLJCutKokkos(LAMMPS *lmp) : PairLJCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,9 +54,9 @@ PairLJCutKokkos::~PairLJCutKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -66,9 +66,9 @@ template void PairLJCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index f17703e2d1..5d47e5dabe 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -46,7 +46,7 @@ PairLJExpandKokkos::PairLJExpandKokkos(LAMMPS *lmp) : PairLJExpand(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJExpandKokkos::~PairLJExpandKokkos() if (!copymode) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJExpandKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 60d18519b2..04d018257e 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -46,7 +46,7 @@ PairLJGromacsCoulGromacsKokkos::PairLJGromacsCoulGromacsKokkos(LAMMP execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -66,9 +66,9 @@ PairLJGromacsCoulGromacsKokkos::~PairLJGromacsCoulGromacsKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -80,11 +80,11 @@ template void PairLJGromacsCoulGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index d27b9e1ec6..dacf4d977e 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -46,9 +46,9 @@ PairLJGromacsKokkos::PairLJGromacsKokkos(LAMMPS *lmp):PairLJGromacs( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } @@ -63,11 +63,11 @@ PairLJGromacsKokkos::~PairLJGromacsKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_inner_sq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } } @@ -77,11 +77,11 @@ template void PairLJGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index 8b228f2c01..ddf4b4efd7 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -46,7 +46,7 @@ PairLJSDKKokkos::PairLJSDKKokkos(LAMMPS *lmp) : PairLJSDK(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJSDKKokkos::~PairLJSDKKokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJSDKKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index ba6e9ba97d..b6cf4ed8d6 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -48,7 +48,7 @@ PairMorseKokkos::PairMorseKokkos(LAMMPS *lmp) : PairMorse(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -61,9 +61,9 @@ PairMorseKokkos::~PairMorseKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -73,9 +73,9 @@ template void PairMorseKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index c4e1ae38cb..f620d194a0 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -83,7 +83,7 @@ PairMultiLucyRXKokkos::~PairMultiLucyRXKokkos() delete h_table; delete d_table; - tabindex = NULL; + tabindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -980,7 +980,7 @@ void PairMultiLucyRXKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 3a7359df93..d76cb98ec3 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -79,9 +79,9 @@ PairReaxCKokkos::~PairReaxCKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->destroy_kokkos(k_tmpid,tmpid); - tmpid = NULL; + tmpid = nullptr; memoryKK->destroy_kokkos(k_tmpbo,tmpbo); - tmpbo = NULL; + tmpbo = nullptr; // deallocate views of views in serial to prevent race condition in profiling tools @@ -137,7 +137,7 @@ void PairReaxCKokkos::init_style() { PairReaxC::init_style(); if (fix_reax) modify->delete_fix(fix_id); // not needed in the Kokkos version - fix_reax = NULL; + fix_reax = nullptr; // irequest = neigh request made by parent class diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 7a567e846b..a8a79f968f 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -61,8 +61,8 @@ PairSWKokkos::~PairSWKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index b5b59dc456..996dae5c1b 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -462,7 +462,7 @@ void PairTableKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -522,10 +522,10 @@ template void PairTableKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 09e38e6387..b2b8a7d60e 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -995,7 +995,7 @@ void PairTableRXKokkos::settings(int narg, char **arg) for (int m = 0; m < ntables; m++) free_table(&tables[m]); memory->sfree(tables); ntables = 0; - tables = NULL; + tables = nullptr; if (allocated) { memory->destroy(setflag); @@ -1289,10 +1289,10 @@ template void PairTableRXKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index b5dd43f12a..106422a234 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -61,8 +61,8 @@ PairVashishtaKokkos::~PairVashishtaKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 71236c807c..03deb1ecf8 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -45,7 +45,7 @@ PairYukawaKokkos::PairYukawaKokkos(LAMMPS *lmp) : PairYukawa(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -58,9 +58,9 @@ PairYukawaKokkos::~PairYukawaKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -70,9 +70,9 @@ template void PairYukawaKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index 8b583a75f7..796dd52116 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -60,9 +60,9 @@ PairZBLKokkos::~PairZBLKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -416,9 +416,9 @@ template void PairZBLKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index 4a795833fb..f4e3955f3c 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -77,25 +77,25 @@ PPPMKokkos::PPPMKokkos(LAMMPS *lmp) : PPPM(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = NULL; - //d_density_fft = NULL; - //d_u_brick = NULL; - //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = NULL; - //greensfn = NULL; - //d_work1 = d_work2 = NULL; - //vg = NULL; - //d_fkx = d_fky = d_fkz = NULL; + //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = nullptr; + //d_density_fft = nullptr; + //d_u_brick = nullptr; + //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = nullptr; + //greensfn = nullptr; + //d_work1 = d_work2 = nullptr; + //vg = nullptr; + //d_fkx = d_fky = d_fkz = nullptr; - //gf_b = NULL; - //rho1d = rho_coeff = drho1d = drho_coeff = NULL; + //gf_b = nullptr; + //rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; nmax = 0; - //part2grid = NULL; + //part2grid = nullptr; peratom_allocate_flag = 0; @@ -160,8 +160,8 @@ PPPMKokkos::~PPPMKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- @@ -212,7 +212,7 @@ void PPPMKokkos::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -247,7 +247,7 @@ void PPPMKokkos::init() // or overlap is allowed, then done // else reduce order and try again - GridCommKokkos *gctmp = NULL; + GridCommKokkos *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -851,22 +851,22 @@ template void PPPMKokkos::deallocate() { memoryKK->destroy_kokkos(d_density_fft,density_fft); - density_fft = NULL; + density_fft = nullptr; memoryKK->destroy_kokkos(d_greensfn,greensfn); - greensfn = NULL; + greensfn = nullptr; memoryKK->destroy_kokkos(d_work1,work1); - work1 = NULL; + work1 = nullptr; memoryKK->destroy_kokkos(d_work2,work2); - work2 = NULL; + work2 = nullptr; delete fft1; - fft1 = NULL; + fft1 = nullptr; delete fft2; - fft2 = NULL; + fft2 = nullptr; delete remap; - remap = NULL; + remap = nullptr; delete gc; - gc = NULL; + gc = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.cpp b/src/KOKKOS/rand_pool_wrap_kokkos.cpp index 2d8865feb0..51ea45e83a 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.cpp +++ b/src/KOKKOS/rand_pool_wrap_kokkos.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; RandPoolWrap::RandPoolWrap(int, LAMMPS *lmp) : Pointers(lmp) { - random_thr = NULL; + random_thr = nullptr; nthreads = lmp->kokkos->nthreads; } @@ -42,7 +42,7 @@ void RandPoolWrap::destroy() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.h b/src/KOKKOS/rand_pool_wrap_kokkos.h index 9124d8e9e7..8ae90011ab 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.h +++ b/src/KOKKOS/rand_pool_wrap_kokkos.h @@ -26,7 +26,7 @@ struct RandWrap { KOKKOS_INLINE_FUNCTION RandWrap() { - rng = NULL; + rng = nullptr; } KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/remap_kokkos.cpp b/src/KOKKOS/remap_kokkos.cpp index af87ba3644..1c72c9edc5 100644 --- a/src/KOKKOS/remap_kokkos.cpp +++ b/src/KOKKOS/remap_kokkos.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; template RemapKokkos::RemapKokkos(LAMMPS *lmp) : Pointers(lmp) { - plan = NULL; + plan = nullptr; } template @@ -44,7 +44,7 @@ RemapKokkos::RemapKokkos(LAMMPS *lmp, MPI_Comm comm, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective, usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ @@ -235,7 +235,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // allocate memory for plan data struct plan = new struct remap_plan_3d_kokkos; - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; plan->usecuda_aware = usecuda_aware; @@ -268,10 +268,10 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -297,8 +297,8 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -379,9 +379,9 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -465,7 +465,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (size) { plan->d_sendbuf = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:sendbuf",size); - if (!plan->d_sendbuf.data()) return NULL; + if (!plan->d_sendbuf.data()) return nullptr; } // if requested, allocate internal scratch space for recvs, @@ -475,7 +475,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (nrecv > 0) { plan->d_scratch = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:scratch",nqty*out.isize*out.jsize*out.ksize); - if (!plan->d_scratch.data()) return NULL; + if (!plan->d_scratch.data()) return nullptr; } } @@ -495,7 +495,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat template void RemapKokkos::remap_3d_destroy_plan_kokkos(struct remap_plan_3d_kokkos *plan) { - if (plan == NULL) return; + if (plan == nullptr) return; // free MPI communicator diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 6133df398f..51e19f7637 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -39,11 +39,11 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), - kxvecs(NULL), kyvecs(NULL), kzvecs(NULL), ug(NULL), eg(NULL), vg(NULL), - ek(NULL), sfacrl(NULL), sfacim(NULL), sfacrl_all(NULL), sfacim_all(NULL), - cs(NULL), sn(NULL), sfacrl_A(NULL), sfacim_A(NULL), sfacrl_A_all(NULL), - sfacim_A_all(NULL), sfacrl_B(NULL), sfacim_B(NULL), sfacrl_B_all(NULL), - sfacim_B_all(NULL) + kxvecs(nullptr), kyvecs(nullptr), kzvecs(nullptr), ug(nullptr), eg(nullptr), vg(nullptr), + ek(nullptr), sfacrl(nullptr), sfacim(nullptr), sfacrl_all(nullptr), sfacim_all(nullptr), + cs(nullptr), sn(nullptr), sfacrl_A(nullptr), sfacim_A(nullptr), sfacrl_A_all(nullptr), + sfacim_A_all(nullptr), sfacrl_B(nullptr), sfacim_B(nullptr), sfacrl_B_all(nullptr), + sfacim_B_all(nullptr) { group_allocate_flag = 0; kmax_created = 0; @@ -53,14 +53,14 @@ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), accuracy_relative = 0.0; kmax = 0; - kxvecs = kyvecs = kzvecs = NULL; - ug = NULL; - eg = vg = NULL; - sfacrl = sfacim = sfacrl_all = sfacim_all = NULL; + kxvecs = kyvecs = kzvecs = nullptr; + ug = nullptr; + eg = vg = nullptr; + sfacrl = sfacim = sfacrl_all = sfacim_all = nullptr; nmax = 0; - ek = NULL; - cs = sn = NULL; + ek = nullptr; + cs = sn = nullptr; kcount = 0; } @@ -121,7 +121,7 @@ void Ewald::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 33d21b416e..ae2596ffee 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -40,12 +40,12 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDipole::EwaldDipole(LAMMPS *lmp) : Ewald(lmp), - tk(NULL), vc(NULL) + tk(nullptr), vc(nullptr) { ewaldflag = dipoleflag = 1; group_group_enable = 0; - tk = NULL; - vc = NULL; + tk = nullptr; + vc = nullptr; } /* ---------------------------------------------------------------------- @@ -112,7 +112,7 @@ void EwaldDipole::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 94cacd3a75..67f49f87cf 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -102,7 +102,7 @@ void EwaldDipoleSpin::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 546ac472c9..4de393c8f6 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -43,21 +43,21 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDisp::EwaldDisp(LAMMPS *lmp) : KSpace(lmp), - kenergy(NULL), kvirial(NULL), energy_self_peratom(NULL), virial_self_peratom(NULL), - ekr_local(NULL), hvec(NULL), kvec(NULL), B(NULL), cek_local(NULL), cek_global(NULL) + kenergy(nullptr), kvirial(nullptr), energy_self_peratom(nullptr), virial_self_peratom(nullptr), + ekr_local(nullptr), hvec(nullptr), kvec(nullptr), B(nullptr), cek_local(nullptr), cek_global(nullptr) { ewaldflag = dispersionflag = dipoleflag = 1; memset(function, 0, EWALD_NFUNCS*sizeof(int)); - kenergy = kvirial = NULL; - cek_local = cek_global = NULL; - ekr_local = NULL; - hvec = NULL; - kvec = NULL; - B = NULL; + kenergy = kvirial = nullptr; + cek_local = cek_global = nullptr; + ekr_local = nullptr; + hvec = nullptr; + kvec = nullptr; + B = nullptr; first_output = 0; - energy_self_peratom = NULL; - virial_self_peratom = NULL; + energy_self_peratom = nullptr; + virial_self_peratom = nullptr; nmax = 0; q2 = 0; b2 = 0; @@ -109,8 +109,8 @@ void EwaldDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; if (!(ptr||cutoff)) error->all(FLERR,"KSpace style is incompatible with Pair style"); int ewald_order = ptr ? *((int *) ptr) : 1<<1; @@ -423,12 +423,12 @@ void EwaldDisp::deallocate_peratom() // free memory { if (energy_self_peratom) { memory->destroy(energy_self_peratom); - energy_self_peratom = NULL; + energy_self_peratom = nullptr; } if (virial_self_peratom) { memory->destroy(virial_self_peratom); - virial_self_peratom = NULL; + virial_self_peratom = nullptr; } } @@ -436,12 +436,12 @@ void EwaldDisp::deallocate_peratom() // free memory void EwaldDisp::deallocate() // free memory { - delete [] hvec; hvec = NULL; - delete [] kvec; kvec = NULL; - delete [] kenergy; kenergy = NULL; - delete [] kvirial; kvirial = NULL; - delete [] cek_local; cek_local = NULL; - delete [] cek_global; cek_global = NULL; + delete [] hvec; hvec = nullptr; + delete [] kvec; kvec = nullptr; + delete [] kenergy; kenergy = nullptr; + delete [] kvirial; kvirial = nullptr; + delete [] cek_local; cek_local = nullptr; + delete [] cek_global; cek_global = nullptr; } /* ---------------------------------------------------------------------- */ @@ -726,7 +726,7 @@ void EwaldDisp::compute_ek() { cvector *ekr = ekr_local; int lbytes = (2*nbox+1)*sizeof(cvector); - hvector *h = NULL; + hvector *h = nullptr; kvector *k, *nk = kvec+nkvec; cvector *z = new cvector[2*nbox+1]; cvector z1, *zx, *zy, *zz, *zn = z+2*nbox; @@ -734,7 +734,7 @@ void EwaldDisp::compute_ek() vector mui; double *x = atom->x[0], *xn = x+3*atom->nlocal, *q = atom->q, qi = 0.0; double bi = 0.0, ci[7]; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; int i, kx, ky, n = nkvec*nsums, *type = atom->type, tri = domain->triclinic; int func[EWALD_NFUNCS]; @@ -806,8 +806,8 @@ void EwaldDisp::compute_force() vector sum[EWALD_MAX_NSUMS], mui = COMPLEX_NULL; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { 8.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(12.0*volume), @@ -1002,7 +1002,7 @@ void EwaldDisp::compute_energy_peratom() complex *cek_coul; double *q = atom->q; double *eatomj = eatom; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke = kenergy; double c[EWALD_NFUNCS] = { @@ -1159,8 +1159,8 @@ void EwaldDisp::compute_virial_dipole() double sum_total[6]; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *mu = atom->mu ? atom->mu[0] : NULL; - double *vatomj = NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; + double *vatomj = nullptr; if (vflag_atom && vatom) vatomj = vatom[0]; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { @@ -1255,8 +1255,8 @@ void EwaldDisp::compute_virial_peratom() complex *cek_coul; double *kv; double *q = atom->q; - double *vatomj = vatom ? vatom[0] : NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *vatomj = vatom ? vatom[0] : nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double c[EWALD_NFUNCS] = { 4.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(24.0*volume), diff --git a/src/KSPACE/fft3d.cpp b/src/KSPACE/fft3d.cpp index 477f8c759e..d5ca88c0df 100644 --- a/src/KSPACE/fft3d.cpp +++ b/src/KSPACE/fft3d.cpp @@ -279,7 +279,7 @@ struct fft_plan_3d *fft_3d_create_plan( // allocate memory for plan data struct plan = (struct fft_plan_3d *) malloc(sizeof(struct fft_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -299,7 +299,7 @@ struct fft_plan_3d *fft_3d_create_plan( first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; first_ihi = nfast - 1; @@ -311,7 +311,7 @@ struct fft_plan_3d *fft_3d_create_plan( remap_3d_create_plan(comm,in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION,0); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -336,7 +336,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -377,7 +377,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi, third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION,usecollective); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -398,7 +398,7 @@ struct fft_plan_3d *fft_3d_create_plan( MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remap_3d_create_plan(comm, @@ -406,7 +406,7 @@ struct fft_plan_3d *fft_3d_create_plan( third_jlo,third_jhi, out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION,0); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -467,15 +467,15 @@ struct fft_plan_3d *fft_3d_create_plan( if (copy_size) { plan->copy = (FFT_DATA *) malloc(copy_size*sizeof(FFT_DATA)); - if (plan->copy == NULL) return NULL; + if (plan->copy == nullptr) return nullptr; } - else plan->copy = NULL; + else plan->copy = nullptr; if (scratch_size) { plan->scratch = (FFT_DATA *) malloc(scratch_size*sizeof(FFT_DATA)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } - else plan->scratch = NULL; + else plan->scratch = nullptr; // system specific pre-computation of 1d FFT coeffs // and scaling normalization @@ -527,47 +527,47 @@ struct fft_plan_3d *fft_3d_create_plan( plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #else /* FFT_KISS */ - plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,NULL,NULL); - plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,NULL,NULL); + plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,NULL,NULL); - plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,NULL,NULL); + plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -579,8 +579,8 @@ struct fft_plan_3d *fft_3d_create_plan( plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,NULL,NULL); - plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,NULL,NULL); + plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index d0e3a2b50c..28af7aabbd 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -30,7 +30,7 @@ FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/gridcomm.cpp b/src/KSPACE/gridcomm.cpp index 0f899d31cf..1c013716ca 100644 --- a/src/KSPACE/gridcomm.cpp +++ b/src/KSPACE/gridcomm.cpp @@ -211,13 +211,13 @@ void GridComm::initialize(MPI_Comm gcomm, // internal data initializations nswap = maxswap = 0; - swap = NULL; + swap = nullptr; nsend = nrecv = ncopy = 0; - send = NULL; - recv = NULL; - copy = NULL; - requests = NULL; + send = nullptr; + recv = nullptr; + copy = nullptr; + requests = nullptr; } /* ---------------------------------------------------------------------- */ @@ -575,7 +575,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KSPACE/kissfft.h b/src/KSPACE/kissfft.h index c95b648dcb..119dc17f66 100644 --- a/src/KSPACE/kissfft.h +++ b/src/KSPACE/kissfft.h @@ -420,14 +420,14 @@ static void kf_factor(int n, int *facbuf) */ static kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem) { - kiss_fft_cfg st=NULL; + kiss_fft_cfg st=nullptr; size_t memneeded = sizeof(struct kiss_fft_state) + sizeof(FFT_DATA)*(nfft-1); /* twiddle factors */ - if (lenmem==NULL) { + if (lenmem==nullptr) { st=(kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); } else { - if (mem != NULL && *lenmem >= memneeded) + if (mem != nullptr && *lenmem >= memneeded) st = (kiss_fft_cfg)mem; *lenmem = memneeded; } diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index d0f4d38686..4c5b615a10 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -45,19 +45,19 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; MSM::MSM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), delxinv(NULL), delyinv(NULL), delzinv(NULL), nx_msm(NULL), - ny_msm(NULL), nz_msm(NULL), nxlo_in(NULL), nylo_in(NULL), nzlo_in(NULL), - nxhi_in(NULL), nyhi_in(NULL), nzhi_in(NULL), nxlo_out(NULL), nylo_out(NULL), - nzlo_out(NULL), nxhi_out(NULL), nyhi_out(NULL), nzhi_out(NULL), ngrid(NULL), - active_flag(NULL), alpha(NULL), betax(NULL), betay(NULL), betaz(NULL), - peratom_allocate_flag(0),levels(0),world_levels(NULL),qgrid(NULL),egrid(NULL), - v0grid(NULL), v1grid(NULL),v2grid(NULL),v3grid(NULL),v4grid(NULL),v5grid(NULL), - g_direct(NULL),v0_direct(NULL),v1_direct(NULL),v2_direct(NULL),v3_direct(NULL), - v4_direct(NULL),v5_direct(NULL),g_direct_top(NULL),v0_direct_top(NULL), - v1_direct_top(NULL),v2_direct_top(NULL),v3_direct_top(NULL),v4_direct_top(NULL), - v5_direct_top(NULL),phi1d(NULL),dphi1d(NULL),procneigh_levels(NULL),gcall(NULL), - gc(NULL),gcall_buf1(NULL),gcall_buf2(NULL),gc_buf1(NULL),gc_buf2(NULL), - ngc_buf1(NULL),ngc_buf2(NULL),part2grid(NULL),boxlo(NULL) + factors(nullptr), delxinv(nullptr), delyinv(nullptr), delzinv(nullptr), nx_msm(nullptr), + ny_msm(nullptr), nz_msm(nullptr), nxlo_in(nullptr), nylo_in(nullptr), nzlo_in(nullptr), + nxhi_in(nullptr), nyhi_in(nullptr), nzhi_in(nullptr), nxlo_out(nullptr), nylo_out(nullptr), + nzlo_out(nullptr), nxhi_out(nullptr), nyhi_out(nullptr), nzhi_out(nullptr), ngrid(nullptr), + active_flag(nullptr), alpha(nullptr), betax(nullptr), betay(nullptr), betaz(nullptr), + peratom_allocate_flag(0),levels(0),world_levels(nullptr),qgrid(nullptr),egrid(nullptr), + v0grid(nullptr), v1grid(nullptr),v2grid(nullptr),v3grid(nullptr),v4grid(nullptr),v5grid(nullptr), + g_direct(nullptr),v0_direct(nullptr),v1_direct(nullptr),v2_direct(nullptr),v3_direct(nullptr), + v4_direct(nullptr),v5_direct(nullptr),g_direct_top(nullptr),v0_direct_top(nullptr), + v1_direct_top(nullptr),v2_direct_top(nullptr),v3_direct_top(nullptr),v4_direct_top(nullptr), + v5_direct_top(nullptr),phi1d(nullptr),dphi1d(nullptr),procneigh_levels(nullptr),gcall(nullptr), + gc(nullptr),gcall_buf1(nullptr),gcall_buf2(nullptr),gc_buf1(nullptr),gc_buf2(nullptr), + ngc_buf1(nullptr),ngc_buf2(nullptr),part2grid(nullptr),boxlo(nullptr) { msmflag = 1; @@ -67,32 +67,32 @@ MSM::MSM(LAMMPS *lmp) MPI_Comm_rank(world,&me); - phi1d = dphi1d = NULL; + phi1d = dphi1d = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; - g_direct = NULL; - g_direct_top = NULL; + g_direct = nullptr; + g_direct_top = nullptr; - v0_direct = v1_direct = v2_direct = NULL; - v3_direct = v4_direct = v5_direct = NULL; + v0_direct = v1_direct = v2_direct = nullptr; + v3_direct = v4_direct = v5_direct = nullptr; - v0_direct_top = v1_direct_top = v2_direct_top = NULL; - v3_direct_top = v4_direct_top = v5_direct_top = NULL; + v0_direct_top = v1_direct_top = v2_direct_top = nullptr; + v3_direct_top = v4_direct_top = v5_direct_top = nullptr; - ngrid = NULL; + ngrid = nullptr; - alpha = betax = betay = betaz = NULL; - nx_msm = ny_msm = nz_msm = NULL; - nxlo_in = nylo_in = nzlo_in = NULL; - nxhi_in = nyhi_in = nzhi_in = NULL; - nxlo_out = nylo_out = nzlo_out = NULL; - nxhi_out = nyhi_out = nzhi_out = NULL; - delxinv = delyinv = delzinv = NULL; - qgrid = NULL; - egrid = NULL; - v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = NULL; + alpha = betax = betay = betaz = nullptr; + nx_msm = ny_msm = nz_msm = nullptr; + nxlo_in = nylo_in = nzlo_in = nullptr; + nxhi_in = nyhi_in = nzhi_in = nullptr; + nxlo_out = nylo_out = nzlo_out = nullptr; + nxhi_out = nyhi_out = nzhi_out = nullptr; + delxinv = delyinv = delzinv = nullptr; + qgrid = nullptr; + egrid = nullptr; + v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = nullptr; peratom_allocate_flag = 0; scalar_pressure_flag = 1; @@ -176,7 +176,7 @@ void MSM::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -825,18 +825,18 @@ void MSM::allocate_levels() v5grid = new double***[levels]; for (int n=0; nkspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -383,7 +383,7 @@ void PairBornCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -423,16 +423,16 @@ void PairBornCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -466,13 +466,13 @@ void PairBornCoulLong::write_restart_settings(FILE *fp) void PairBornCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -577,5 +577,5 @@ void *PairBornCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_born_coul_msm.cpp b/src/KSPACE/pair_born_coul_msm.cpp index 7300cd92e0..707f7f7959 100644 --- a/src/KSPACE/pair_born_coul_msm.cpp +++ b/src/KSPACE/pair_born_coul_msm.cpp @@ -34,7 +34,7 @@ PairBornCoulMSM::PairBornCoulMSM(LAMMPS *lmp) : PairBornCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -251,5 +251,5 @@ void *PairBornCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 8d15a6480a..2733bc31cd 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -364,7 +364,7 @@ void PairBuckCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -372,7 +372,7 @@ void PairBuckCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -410,14 +410,14 @@ void PairBuckCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -449,13 +449,13 @@ void PairBuckCoulLong::write_restart_settings(FILE *fp) void PairBuckCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -558,5 +558,5 @@ void *PairBuckCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_msm.cpp b/src/KSPACE/pair_buck_coul_msm.cpp index 1355a2f13a..87c852b5aa 100644 --- a/src/KSPACE/pair_buck_coul_msm.cpp +++ b/src/KSPACE/pair_buck_coul_msm.cpp @@ -31,7 +31,7 @@ PairBuckCoulMSM::PairBuckCoulMSM(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,5 +246,5 @@ void *PairBuckCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index a845ddd1d2..744232dd8e 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -50,9 +50,9 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; - cut_respa = NULL; + ftable = nullptr; + fdisptable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairBuckLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style buck/long/coul/long command"); @@ -177,10 +177,10 @@ void PairBuckLongCoulLong::allocate() void *PairBuckLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { - "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", NULL}; + "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_buck_global, - NULL}; + nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -240,7 +240,7 @@ void PairBuckLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -250,7 +250,7 @@ void PairBuckLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -359,14 +359,14 @@ void PairBuckLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck_a_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck_rho_read[i][j],1,MPI_DOUBLE,0,world); @@ -399,14 +399,14 @@ void PairBuckLongCoulLong::write_restart_settings(FILE *fp) void PairBuckLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_buck_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 2520da2654..68b9a8cbe2 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -44,9 +44,9 @@ using namespace LAMMPS_NS; PairCoulLong::PairCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -242,13 +242,13 @@ void PairCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -291,10 +291,10 @@ void PairCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); } } @@ -320,11 +320,11 @@ void PairCoulLong::write_restart_settings(FILE *fp) void PairCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -393,5 +393,5 @@ void *PairCoulLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_coul_msm.cpp b/src/KSPACE/pair_coul_msm.cpp index 5d42e1f046..bf689d403d 100644 --- a/src/KSPACE/pair_coul_msm.cpp +++ b/src/KSPACE/pair_coul_msm.cpp @@ -217,5 +217,5 @@ void *PairCoulMSM::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 261e93fbc9..b4455ff9b8 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -47,11 +47,11 @@ PairLJCharmmCoulLong::PairLJCharmmCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -738,11 +738,11 @@ void PairLJCharmmCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -824,14 +824,14 @@ void PairLJCharmmCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -863,13 +863,13 @@ void PairLJCharmmCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -994,5 +994,5 @@ void *PairLJCharmmCoulLong::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.cpp b/src/KSPACE/pair_lj_charmm_coul_msm.cpp index a93a1275f4..fe3ce441a1 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_msm.cpp @@ -35,7 +35,7 @@ PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -537,5 +537,5 @@ void *PairLJCharmmCoulMSM::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 9df9862c11..abc8888e59 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -51,11 +51,11 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; // short-range/long-range flag accessed by DihedralCharmmfsw @@ -786,11 +786,11 @@ void PairLJCharmmfswCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -872,14 +872,14 @@ void PairLJCharmmfswCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -911,13 +911,13 @@ void PairLJCharmmfswCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -1055,5 +1055,5 @@ void *PairLJCharmmfswCoulLong::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 7fd8a72559..7ae60acc86 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -51,9 +51,9 @@ PairLJCutCoulLong::PairLJCutCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -676,11 +676,11 @@ void PairLJCutCoulLong::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -792,13 +792,13 @@ void PairLJCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -829,13 +829,13 @@ void PairLJCutCoulLong::write_restart_settings(FILE *fp) void PairLJCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -943,5 +943,5 @@ void *PairLJCutCoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_msm.cpp b/src/KSPACE/pair_lj_cut_coul_msm.cpp index 4ebbcb9a3f..00aa88152d 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.cpp +++ b/src/KSPACE/pair_lj_cut_coul_msm.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSM::PairLJCutCoulMSM(LAMMPS *lmp) : PairLJCutCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -478,5 +478,5 @@ void *PairLJCutCoulMSM::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index a62c1bd55b..0d7778c93a 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -55,8 +55,8 @@ PairLJCutTIP4PLong::PairLJCutTIP4PLong(LAMMPS *lmp) : writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -464,9 +464,9 @@ void PairLJCutTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLong::init_style(); @@ -529,19 +529,19 @@ void PairLJCutTIP4PLong::write_restart_settings(FILE *fp) void PairLJCutTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -594,7 +594,7 @@ void *PairLJCutTIP4PLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index b6727c2c99..960a47e685 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -53,10 +53,10 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -65,7 +65,7 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/coul/long command"); @@ -176,10 +176,10 @@ void *PairLJLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_LJ", NULL}; + "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, - &cut_coul, &cut_lj_global, NULL}; + &cut_coul, &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -235,7 +235,7 @@ void PairLJLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -245,7 +245,7 @@ void PairLJLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -360,13 +360,13 @@ void PairLJLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -398,14 +398,14 @@ void PairLJLongCoulLong::write_restart_settings(FILE *fp) void PairLJLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index 8f17bda008..790e318160 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -52,8 +52,8 @@ PairLJLongTIP4PLong::PairLJLongTIP4PLong(LAMMPS *lmp) : respa_enable = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to find_M() finding bonded H atoms which are not near O atom @@ -1479,9 +1479,9 @@ void PairLJLongTIP4PLong::init_style() error->all(FLERR,"Pair style lj/long/tip4p/long requires newton pair on"); if (!atom->q_flag) error->all(FLERR,"Pair style lj/long/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJLongCoulLong::init_style(); @@ -1544,20 +1544,20 @@ void PairLJLongTIP4PLong::write_restart_settings(FILE *fp) void PairLJLongTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -1611,14 +1611,14 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "cut_coul", - "ewald_mix", "cut_LJ", NULL}; + "ewald_mix", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &cut_coul, - &mix_flag, &cut_lj_global, NULL}; + &mix_flag, &cut_lj_global, nullptr}; int i; i=0; - while (ids[i] != NULL) { + while (ids[i] != nullptr) { if (i <=2) dim = 2; else dim = 0; @@ -1627,7 +1627,7 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) ++i; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index 54973c69c2..80785d3551 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -51,8 +51,8 @@ PairTIP4PLong::PairTIP4PLong(LAMMPS *lmp) : PairCoulLong(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -421,9 +421,9 @@ void PairTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLong::init_style(); @@ -468,11 +468,11 @@ void PairTIP4PLong::read_restart_settings(FILE *fp) PairCoulLong::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -514,7 +514,7 @@ void *PairTIP4PLong::extract(const char *str, int &dim) if (strcmp(str,"typeA") == 0) return (void *) &typeA; if (strcmp(str,"typeB") == 0) return (void *) &typeB; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 41ffec4f3b..89d308eaa3 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -63,16 +63,16 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), density_brick(NULL), vdx_brick(NULL), vdy_brick(NULL), vdz_brick(NULL), - u_brick(NULL), v0_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), - v4_brick(NULL), v5_brick(NULL), greensfn(NULL), vg(NULL), fkx(NULL), fky(NULL), - fkz(NULL), density_fft(NULL), work1(NULL), work2(NULL), gf_b(NULL), rho1d(NULL), - rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), - acons(NULL), fft1(NULL), fft2(NULL), remap(NULL), gc(NULL), - gc_buf1(NULL), gc_buf2(NULL), density_A_brick(NULL), density_B_brick(NULL), density_A_fft(NULL), - density_B_fft(NULL), part2grid(NULL), boxlo(NULL) + factors(nullptr), density_brick(nullptr), vdx_brick(nullptr), vdy_brick(nullptr), vdz_brick(nullptr), + u_brick(nullptr), v0_brick(nullptr), v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), + v4_brick(nullptr), v5_brick(nullptr), greensfn(nullptr), vg(nullptr), fkx(nullptr), fky(nullptr), + fkz(nullptr), density_fft(nullptr), work1(nullptr), work2(nullptr), gf_b(nullptr), rho1d(nullptr), + rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), + acons(nullptr), fft1(nullptr), fft2(nullptr), remap(nullptr), gc(nullptr), + gc_buf1(nullptr), gc_buf2(nullptr), density_A_brick(nullptr), density_B_brick(nullptr), density_A_fft(nullptr), + density_B_fft(nullptr), part2grid(nullptr), boxlo(nullptr) { peratom_allocate_flag = 0; group_allocate_flag = 0; @@ -95,31 +95,31 @@ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), nyhi_in = nylo_in = nyhi_out = nylo_out = 0; nzhi_in = nzlo_in = nzhi_out = nzlo_out = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; - u_brick = NULL; - v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = NULL; - greensfn = NULL; - work1 = work2 = NULL; - vg = NULL; - fkx = fky = fkz = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; + u_brick = nullptr; + v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = nullptr; + greensfn = nullptr; + work1 = work2 = nullptr; + vg = nullptr; + fkx = fky = fkz = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; - density_A_brick = density_B_brick = NULL; - density_A_fft = density_B_fft = NULL; + density_A_brick = density_B_brick = nullptr; + density_A_fft = density_B_fft = nullptr; - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; - gc_buf1 = gc_buf2 = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; + gc_buf1 = gc_buf2 = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; // define acons coefficients for estimation of kspace errors // see JCP 109, pg 7698 for derivation of coefficients @@ -229,7 +229,7 @@ void PPPM::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -254,8 +254,8 @@ void PPPM::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL || - force->angle->setflag == NULL || force->bond->setflag == NULL) + if (force->angle == nullptr || force->bond == nullptr || + force->angle->setflag == nullptr || force->bond->setflag == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -292,7 +292,7 @@ void PPPM::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -867,7 +867,7 @@ void PPPM::deallocate() } memory->destroy(gf_b); - if (stagger_flag) gf_b = NULL; + if (stagger_flag) gf_b = nullptr; memory->destroy2d_offset(rho1d,-order_allocated/2); memory->destroy2d_offset(drho1d,-order_allocated/2); memory->destroy2d_offset(rho_coeff,(1-order_allocated)/2); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index b319014c78..62f816a94d 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -47,7 +47,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMCG::PPPMCG(LAMMPS *lmp) : PPPM(lmp), - is_charged(NULL) + is_charged(nullptr) { num_charged = -1; group_group_enable = 1; diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 1b7d325326..feb17e522e 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -58,25 +58,25 @@ enum{FORWARD_MU,FORWARD_MU_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMDipole::PPPMDipole(LAMMPS *lmp) : PPPM(lmp), - densityx_brick_dipole(NULL), densityy_brick_dipole(NULL), - densityz_brick_dipole(NULL), - vdxx_brick_dipole(NULL), vdyy_brick_dipole(NULL), vdzz_brick_dipole(NULL), - vdxy_brick_dipole(NULL), vdxz_brick_dipole(NULL), vdyz_brick_dipole(NULL), - ux_brick_dipole(NULL), uy_brick_dipole(NULL), uz_brick_dipole(NULL), - v0x_brick_dipole(NULL), v1x_brick_dipole(NULL), - v2x_brick_dipole(NULL), v3x_brick_dipole(NULL), v4x_brick_dipole(NULL), - v5x_brick_dipole(NULL), v0y_brick_dipole(NULL), v1y_brick_dipole(NULL), - v2y_brick_dipole(NULL), v3y_brick_dipole(NULL), v4y_brick_dipole(NULL), - v5y_brick_dipole(NULL), v0z_brick_dipole(NULL), v1z_brick_dipole(NULL), - v2z_brick_dipole(NULL), v3z_brick_dipole(NULL), v4z_brick_dipole(NULL), - v5z_brick_dipole(NULL), work3(NULL), work4(NULL), - densityx_fft_dipole(NULL), densityy_fft_dipole(NULL), - densityz_fft_dipole(NULL) + densityx_brick_dipole(nullptr), densityy_brick_dipole(nullptr), + densityz_brick_dipole(nullptr), + vdxx_brick_dipole(nullptr), vdyy_brick_dipole(nullptr), vdzz_brick_dipole(nullptr), + vdxy_brick_dipole(nullptr), vdxz_brick_dipole(nullptr), vdyz_brick_dipole(nullptr), + ux_brick_dipole(nullptr), uy_brick_dipole(nullptr), uz_brick_dipole(nullptr), + v0x_brick_dipole(nullptr), v1x_brick_dipole(nullptr), + v2x_brick_dipole(nullptr), v3x_brick_dipole(nullptr), v4x_brick_dipole(nullptr), + v5x_brick_dipole(nullptr), v0y_brick_dipole(nullptr), v1y_brick_dipole(nullptr), + v2y_brick_dipole(nullptr), v3y_brick_dipole(nullptr), v4y_brick_dipole(nullptr), + v5y_brick_dipole(nullptr), v0z_brick_dipole(nullptr), v1z_brick_dipole(nullptr), + v2z_brick_dipole(nullptr), v3z_brick_dipole(nullptr), v4z_brick_dipole(nullptr), + v5z_brick_dipole(nullptr), work3(nullptr), work4(nullptr), + densityx_fft_dipole(nullptr), densityy_fft_dipole(nullptr), + densityz_fft_dipole(nullptr) { dipoleflag = 1; group_group_enable = 0; - gc_dipole = NULL; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -153,7 +153,7 @@ void PPPMDipole::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -187,7 +187,7 @@ void PPPMDipole::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 595c257331..a3f7aa29cf 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -75,10 +75,10 @@ PPPMDipoleSpin::~PPPMDipoleSpin() deallocate(); if (peratom_allocate_flag) deallocate_peratom(); - fft1 = NULL; - fft2 = NULL; - remap = NULL; - gc_dipole = NULL; + fft1 = nullptr; + fft2 = nullptr; + remap = nullptr; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -139,7 +139,7 @@ void PPPMDipoleSpin::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); // check the correct extract here - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -172,7 +172,7 @@ void PPPMDipoleSpin::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index a484751a81..a88a0892bc 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -63,47 +63,47 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM, /* ---------------------------------------------------------------------- */ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), csumi(NULL), cii(NULL), B(NULL), density_brick(NULL), vdx_brick(NULL), - vdy_brick(NULL), vdz_brick(NULL), density_fft(NULL), u_brick(NULL), v0_brick(NULL), - v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), v4_brick(NULL), v5_brick(NULL), - density_brick_g(NULL), vdx_brick_g(NULL), vdy_brick_g(NULL), vdz_brick_g(NULL), - density_fft_g(NULL), u_brick_g(NULL), v0_brick_g(NULL), v1_brick_g(NULL), v2_brick_g(NULL), - v3_brick_g(NULL), v4_brick_g(NULL), v5_brick_g(NULL), density_brick_a0(NULL), - vdx_brick_a0(NULL), vdy_brick_a0(NULL), vdz_brick_a0(NULL), density_fft_a0(NULL), - u_brick_a0(NULL), v0_brick_a0(NULL), v1_brick_a0(NULL), v2_brick_a0(NULL), - v3_brick_a0(NULL), v4_brick_a0(NULL), v5_brick_a0(NULL), density_brick_a1(NULL), - vdx_brick_a1(NULL), vdy_brick_a1(NULL), vdz_brick_a1(NULL), density_fft_a1(NULL), - u_brick_a1(NULL), v0_brick_a1(NULL), v1_brick_a1(NULL), v2_brick_a1(NULL), - v3_brick_a1(NULL), v4_brick_a1(NULL), v5_brick_a1(NULL), density_brick_a2(NULL), - vdx_brick_a2(NULL), vdy_brick_a2(NULL), vdz_brick_a2(NULL), density_fft_a2(NULL), - u_brick_a2(NULL), v0_brick_a2(NULL), v1_brick_a2(NULL), v2_brick_a2(NULL), - v3_brick_a2(NULL), v4_brick_a2(NULL), v5_brick_a2(NULL), density_brick_a3(NULL), - vdx_brick_a3(NULL), vdy_brick_a3(NULL), vdz_brick_a3(NULL), density_fft_a3(NULL), - u_brick_a3(NULL), v0_brick_a3(NULL), v1_brick_a3(NULL), v2_brick_a3(NULL), - v3_brick_a3(NULL), v4_brick_a3(NULL), v5_brick_a3(NULL), density_brick_a4(NULL), - vdx_brick_a4(NULL), vdy_brick_a4(NULL), vdz_brick_a4(NULL), density_fft_a4(NULL), - u_brick_a4(NULL), v0_brick_a4(NULL), v1_brick_a4(NULL), v2_brick_a4(NULL), - v3_brick_a4(NULL), v4_brick_a4(NULL), v5_brick_a4(NULL), density_brick_a5(NULL), - vdx_brick_a5(NULL), vdy_brick_a5(NULL), vdz_brick_a5(NULL), density_fft_a5(NULL), - u_brick_a5(NULL), v0_brick_a5(NULL), v1_brick_a5(NULL), v2_brick_a5(NULL), - v3_brick_a5(NULL), v4_brick_a5(NULL), v5_brick_a5(NULL), density_brick_a6(NULL), - vdx_brick_a6(NULL), vdy_brick_a6(NULL), vdz_brick_a6(NULL), density_fft_a6(NULL), - u_brick_a6(NULL), v0_brick_a6(NULL), v1_brick_a6(NULL), v2_brick_a6(NULL), - v3_brick_a6(NULL), v4_brick_a6(NULL), v5_brick_a6(NULL), density_brick_none(NULL), - vdx_brick_none(NULL), vdy_brick_none(NULL), vdz_brick_none(NULL), - density_fft_none(NULL), u_brick_none(NULL), v0_brick_none(NULL), v1_brick_none(NULL), - v2_brick_none(NULL), v3_brick_none(NULL), v4_brick_none(NULL), v5_brick_none(NULL), - greensfn(NULL), vg(NULL), vg2(NULL), greensfn_6(NULL), vg_6(NULL), vg2_6(NULL), - fkx(NULL), fky(NULL), fkz(NULL), fkx2(NULL), fky2(NULL), fkz2(NULL), fkx_6(NULL), - fky_6(NULL), fkz_6(NULL), fkx2_6(NULL), fky2_6(NULL), fkz2_6(NULL), gf_b(NULL), - gf_b_6(NULL), sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), sf_precoeff1_6(NULL), - sf_precoeff2_6(NULL), sf_precoeff3_6(NULL), sf_precoeff4_6(NULL), sf_precoeff5_6(NULL), - sf_precoeff6_6(NULL), rho1d(NULL), rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - rho1d_6(NULL), rho_coeff_6(NULL), drho1d_6(NULL), drho_coeff_6(NULL), work1(NULL), - work2(NULL), work1_6(NULL), work2_6(NULL), fft1(NULL), fft2(NULL), fft1_6(NULL), - fft2_6(NULL), remap(NULL), remap_6(NULL), gc(NULL), gc6(NULL), - part2grid(NULL), part2grid_6(NULL), boxlo(NULL) + factors(nullptr), csumi(nullptr), cii(nullptr), B(nullptr), density_brick(nullptr), vdx_brick(nullptr), + vdy_brick(nullptr), vdz_brick(nullptr), density_fft(nullptr), u_brick(nullptr), v0_brick(nullptr), + v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), v4_brick(nullptr), v5_brick(nullptr), + density_brick_g(nullptr), vdx_brick_g(nullptr), vdy_brick_g(nullptr), vdz_brick_g(nullptr), + density_fft_g(nullptr), u_brick_g(nullptr), v0_brick_g(nullptr), v1_brick_g(nullptr), v2_brick_g(nullptr), + v3_brick_g(nullptr), v4_brick_g(nullptr), v5_brick_g(nullptr), density_brick_a0(nullptr), + vdx_brick_a0(nullptr), vdy_brick_a0(nullptr), vdz_brick_a0(nullptr), density_fft_a0(nullptr), + u_brick_a0(nullptr), v0_brick_a0(nullptr), v1_brick_a0(nullptr), v2_brick_a0(nullptr), + v3_brick_a0(nullptr), v4_brick_a0(nullptr), v5_brick_a0(nullptr), density_brick_a1(nullptr), + vdx_brick_a1(nullptr), vdy_brick_a1(nullptr), vdz_brick_a1(nullptr), density_fft_a1(nullptr), + u_brick_a1(nullptr), v0_brick_a1(nullptr), v1_brick_a1(nullptr), v2_brick_a1(nullptr), + v3_brick_a1(nullptr), v4_brick_a1(nullptr), v5_brick_a1(nullptr), density_brick_a2(nullptr), + vdx_brick_a2(nullptr), vdy_brick_a2(nullptr), vdz_brick_a2(nullptr), density_fft_a2(nullptr), + u_brick_a2(nullptr), v0_brick_a2(nullptr), v1_brick_a2(nullptr), v2_brick_a2(nullptr), + v3_brick_a2(nullptr), v4_brick_a2(nullptr), v5_brick_a2(nullptr), density_brick_a3(nullptr), + vdx_brick_a3(nullptr), vdy_brick_a3(nullptr), vdz_brick_a3(nullptr), density_fft_a3(nullptr), + u_brick_a3(nullptr), v0_brick_a3(nullptr), v1_brick_a3(nullptr), v2_brick_a3(nullptr), + v3_brick_a3(nullptr), v4_brick_a3(nullptr), v5_brick_a3(nullptr), density_brick_a4(nullptr), + vdx_brick_a4(nullptr), vdy_brick_a4(nullptr), vdz_brick_a4(nullptr), density_fft_a4(nullptr), + u_brick_a4(nullptr), v0_brick_a4(nullptr), v1_brick_a4(nullptr), v2_brick_a4(nullptr), + v3_brick_a4(nullptr), v4_brick_a4(nullptr), v5_brick_a4(nullptr), density_brick_a5(nullptr), + vdx_brick_a5(nullptr), vdy_brick_a5(nullptr), vdz_brick_a5(nullptr), density_fft_a5(nullptr), + u_brick_a5(nullptr), v0_brick_a5(nullptr), v1_brick_a5(nullptr), v2_brick_a5(nullptr), + v3_brick_a5(nullptr), v4_brick_a5(nullptr), v5_brick_a5(nullptr), density_brick_a6(nullptr), + vdx_brick_a6(nullptr), vdy_brick_a6(nullptr), vdz_brick_a6(nullptr), density_fft_a6(nullptr), + u_brick_a6(nullptr), v0_brick_a6(nullptr), v1_brick_a6(nullptr), v2_brick_a6(nullptr), + v3_brick_a6(nullptr), v4_brick_a6(nullptr), v5_brick_a6(nullptr), density_brick_none(nullptr), + vdx_brick_none(nullptr), vdy_brick_none(nullptr), vdz_brick_none(nullptr), + density_fft_none(nullptr), u_brick_none(nullptr), v0_brick_none(nullptr), v1_brick_none(nullptr), + v2_brick_none(nullptr), v3_brick_none(nullptr), v4_brick_none(nullptr), v5_brick_none(nullptr), + greensfn(nullptr), vg(nullptr), vg2(nullptr), greensfn_6(nullptr), vg_6(nullptr), vg2_6(nullptr), + fkx(nullptr), fky(nullptr), fkz(nullptr), fkx2(nullptr), fky2(nullptr), fkz2(nullptr), fkx_6(nullptr), + fky_6(nullptr), fkz_6(nullptr), fkx2_6(nullptr), fky2_6(nullptr), fkz2_6(nullptr), gf_b(nullptr), + gf_b_6(nullptr), sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), sf_precoeff1_6(nullptr), + sf_precoeff2_6(nullptr), sf_precoeff3_6(nullptr), sf_precoeff4_6(nullptr), sf_precoeff5_6(nullptr), + sf_precoeff6_6(nullptr), rho1d(nullptr), rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + rho1d_6(nullptr), rho_coeff_6(nullptr), drho1d_6(nullptr), drho_coeff_6(nullptr), work1(nullptr), + work2(nullptr), work1_6(nullptr), work2_6(nullptr), fft1(nullptr), fft2(nullptr), fft1_6(nullptr), + fft2_6(nullptr), remap(nullptr), remap_6(nullptr), gc(nullptr), gc6(nullptr), + part2grid(nullptr), part2grid_6(nullptr), boxlo(nullptr) { triclinic_support = 0; pppmflag = dispersionflag = 1; @@ -125,98 +125,98 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), nzhi_in_6 = nzlo_in_6 = nzhi_out_6 = nzlo_out_6 = 0; csumflag = 0; - B = NULL; - cii = NULL; - csumi = NULL; + B = nullptr; + cii = nullptr; + csumi = nullptr; peratom_allocate_flag = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; u_brick = v0_brick = v1_brick = v2_brick = v3_brick = - v4_brick = v5_brick = NULL; + v4_brick = v5_brick = nullptr; - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = v3_brick_g = - v4_brick_g = v5_brick_g = NULL; + v4_brick_g = v5_brick_g = nullptr; - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = v3_brick_a0 = - v4_brick_a0 = v5_brick_a0 = NULL; + v4_brick_a0 = v5_brick_a0 = nullptr; - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = v3_brick_a1 = - v4_brick_a1 = v5_brick_a1 = NULL; + v4_brick_a1 = v5_brick_a1 = nullptr; - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = - v4_brick_a2 = v5_brick_a2 = NULL; + v4_brick_a2 = v5_brick_a2 = nullptr; - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = - v4_brick_a3 = v5_brick_a3 = NULL; + v4_brick_a3 = v5_brick_a3 = nullptr; - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = - v4_brick_a4 = v5_brick_a4 = NULL; + v4_brick_a4 = v5_brick_a4 = nullptr; - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = v3_brick_a5 = - v4_brick_a5 = v5_brick_a5 = NULL; + v4_brick_a5 = v5_brick_a5 = nullptr; - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = v3_brick_a6 = - v4_brick_a6 = v5_brick_a6 = NULL; + v4_brick_a6 = v5_brick_a6 = nullptr; - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = v3_brick_none = - v4_brick_none = v5_brick_none = NULL; - - greensfn = NULL; - greensfn_6 = NULL; - work1 = work2 = NULL; - work1_6 = work2_6 = NULL; - vg = NULL; - vg2 = NULL; - vg_6 = NULL; - vg2_6 = NULL; - fkx = fky = fkz = NULL; - fkx2 = fky2 = fkz2 = NULL; - fkx_6 = fky_6 = fkz_6 = NULL; - fkx2_6 = fky2_6 = fkz2_6 = NULL; + v4_brick_none = v5_brick_none = nullptr; + + greensfn = nullptr; + greensfn_6 = nullptr; + work1 = work2 = nullptr; + work1_6 = work2_6 = nullptr; + vg = nullptr; + vg2 = nullptr; + vg_6 = nullptr; + vg2_6 = nullptr; + fkx = fky = fkz = nullptr; + fkx2 = fky2 = fkz2 = nullptr; + fkx_6 = fky_6 = fkz_6 = nullptr; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = - sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff5 = sf_precoeff6 = nullptr; sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = sf_precoeff4_6 = - sf_precoeff5_6 = sf_precoeff6_6 = NULL; - - gf_b = NULL; - gf_b_6 = NULL; - rho1d = rho_coeff = NULL; - drho1d = drho_coeff = NULL; - rho1d_6 = rho_coeff_6 = NULL; - drho1d_6 = drho_coeff_6 = NULL; - fft1 = fft2 = NULL; - fft1_6 = fft2_6 = NULL; - remap = NULL; - remap_6 = NULL; - gc = gc6 = NULL; - gc_buf1 = gc_buf2 = NULL; - gc6_buf1 = gc6_buf2 = NULL; + sf_precoeff5_6 = sf_precoeff6_6 = nullptr; + + gf_b = nullptr; + gf_b_6 = nullptr; + rho1d = rho_coeff = nullptr; + drho1d = drho_coeff = nullptr; + rho1d_6 = rho_coeff_6 = nullptr; + drho1d_6 = drho_coeff_6 = nullptr; + fft1 = fft2 = nullptr; + fft1_6 = fft2_6 = nullptr; + remap = nullptr; + remap_6 = nullptr; + gc = gc6 = nullptr; + gc_buf1 = gc_buf2 = nullptr; + gc6_buf1 = gc6_buf2 = nullptr; ngc_buf1 = ngc_buf2 = ngc6_buf1 = ngc6_buf2 = 0; ngrid = ngrid_6 = npergrid = npergrid6 = 0; nmax = 0; - part2grid = NULL; - part2grid_6 = NULL; + part2grid = nullptr; + part2grid_6 = nullptr; memset(function,0,EWALD_FUNCS*sizeof(int)); } @@ -237,16 +237,16 @@ PPPMDisp::~PPPMDisp() { delete [] factors; delete [] B; - B = NULL; + B = nullptr; delete [] cii; - cii = NULL; + cii = nullptr; delete [] csumi; - csumi = NULL; + csumi = nullptr; deallocate(); deallocate_peratom(); memory->destroy(part2grid); memory->destroy(part2grid_6); - part2grid = part2grid_6 = NULL; + part2grid = part2grid_6 = nullptr; } /* ---------------------------------------------------------------------- @@ -295,9 +295,9 @@ void PPPMDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; - double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; + double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : nullptr; if (!(ptr||p_cutoff||p_cutoff_lj)) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -377,7 +377,7 @@ void PPPMDisp::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL) + if (force->angle == nullptr || force->bond == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -411,7 +411,7 @@ void PPPMDisp::init() int iteration = 0; if (function[0]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order >= minorder) { if (iteration && me == 0) @@ -492,7 +492,7 @@ void PPPMDisp::init() iteration = 0; if (function[1] + function[2] + function[3]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order_6 >= minorder) { if (iteration && me == 0) @@ -1281,14 +1281,14 @@ void PPPMDisp::init_coeffs() // local pair coeffs int n = atom->ntypes; int converged; delete [] B; - B = NULL; + B = nullptr; if (function[3] + function[2]) { // no mixing rule or arithmetic if (function[2] && me == 0) utils::logmesg(lmp," Optimizing splitting of Dispersion coefficients\n"); // allocate data for eigenvalue decomposition - double **A=NULL; - double **Q=NULL; + double **A=nullptr; + double **Q=nullptr; if ( n > 1 ) { // get dispersion coefficients double **b = (double **) force->pair->extract("B",tmp); @@ -2299,80 +2299,80 @@ void PPPMDisp::deallocate() memory->destroy3d_offset(vdy_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy3d_offset(vdz_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy(density_fft); - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; memory->destroy3d_offset(density_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_g); - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; memory->destroy3d_offset(density_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a0); - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; memory->destroy3d_offset(density_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a1); - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; memory->destroy3d_offset(density_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a2); - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; memory->destroy3d_offset(density_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a3); - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; memory->destroy3d_offset(density_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a4); - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; memory->destroy3d_offset(density_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a5); - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; memory->destroy3d_offset(density_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a6); - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; memory->destroy4d_offset(density_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdx_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdy_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdz_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_none); - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; memory->destroy(sf_precoeff1); memory->destroy(sf_precoeff2); @@ -2381,7 +2381,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5); memory->destroy(sf_precoeff6); sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; memory->destroy(sf_precoeff1_6); memory->destroy(sf_precoeff2_6); @@ -2390,7 +2390,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5_6); memory->destroy(sf_precoeff6_6); sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = - sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = NULL; + sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = nullptr; memory->destroy(greensfn); memory->destroy(greensfn_6); @@ -2402,45 +2402,45 @@ void PPPMDisp::deallocate() memory->destroy(vg2); memory->destroy(vg_6); memory->destroy(vg2_6); - greensfn = greensfn_6 = NULL; - work1 = work2 = work1_6 = work2_6 = NULL; - vg = vg2 = vg_6 = vg2_6 = NULL; + greensfn = greensfn_6 = nullptr; + work1 = work2 = work1_6 = work2_6 = nullptr; + vg = vg2 = vg_6 = vg2_6 = nullptr; memory->destroy1d_offset(fkx,nxlo_fft); memory->destroy1d_offset(fky,nylo_fft); memory->destroy1d_offset(fkz,nzlo_fft); - fkx = fky = fkz = NULL; + fkx = fky = fkz = nullptr; memory->destroy1d_offset(fkx2,nxlo_fft); memory->destroy1d_offset(fky2,nylo_fft); memory->destroy1d_offset(fkz2,nzlo_fft); - fkx2 = fky2 = fkz2 = NULL; + fkx2 = fky2 = fkz2 = nullptr; memory->destroy1d_offset(fkx_6,nxlo_fft_6); memory->destroy1d_offset(fky_6,nylo_fft_6); memory->destroy1d_offset(fkz_6,nzlo_fft_6); - fkx_6 = fky_6 = fkz_6 = NULL; + fkx_6 = fky_6 = fkz_6 = nullptr; memory->destroy1d_offset(fkx2_6,nxlo_fft_6); memory->destroy1d_offset(fky2_6,nylo_fft_6); memory->destroy1d_offset(fkz2_6,nzlo_fft_6); - fkx2_6 = fky2_6 = fkz2_6 = NULL; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; memory->destroy(gf_b); memory->destroy2d_offset(rho1d,-order/2); memory->destroy2d_offset(rho_coeff,(1-order)/2); memory->destroy2d_offset(drho1d,-order/2); memory->destroy2d_offset(drho_coeff, (1-order)/2); - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; memory->destroy(gf_b_6); memory->destroy2d_offset(rho1d_6,-order_6/2); memory->destroy2d_offset(rho_coeff_6,(1-order_6)/2); memory->destroy2d_offset(drho1d_6,-order_6/2); memory->destroy2d_offset(drho_coeff_6,(1-order_6)/2); - gf_b_6 = NULL; - rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = NULL; + gf_b_6 = nullptr; + rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = nullptr; memory->destroy(gc_buf1); memory->destroy(gc_buf2); @@ -2474,7 +2474,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick, nzlo_out, nylo_out, nxlo_out); memory->destroy3d_offset(v5_brick, nzlo_out, nylo_out, nxlo_out); u_brick = v0_brick = v1_brick = v2_brick = - v3_brick = v4_brick = v5_brick = NULL; + v3_brick = v4_brick = v5_brick = nullptr; memory->destroy3d_offset(u_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2484,7 +2484,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = - v3_brick_g = v4_brick_g = v5_brick_g = NULL; + v3_brick_g = v4_brick_g = v5_brick_g = nullptr; memory->destroy3d_offset(u_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2494,7 +2494,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = - v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = NULL; + v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = nullptr; memory->destroy3d_offset(u_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2504,7 +2504,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = - v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = NULL; + v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = nullptr; memory->destroy3d_offset(u_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2513,7 +2513,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = NULL; + u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = nullptr; memory->destroy3d_offset(u_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2522,7 +2522,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = NULL; + u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = nullptr; memory->destroy3d_offset(u_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2532,7 +2532,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = - v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = NULL; + v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = nullptr; memory->destroy3d_offset(u_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2542,7 +2542,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = - v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = NULL; + v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = nullptr; memory->destroy3d_offset(u_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2552,7 +2552,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = - v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = NULL; + v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = nullptr; memory->destroy4d_offset(u_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v0_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2562,7 +2562,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy4d_offset(v4_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v5_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = - v3_brick_none = v4_brick_none = v5_brick_none = NULL; + v3_brick_none = v4_brick_none = v5_brick_none = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index f71529ae83..afdc97e374 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -50,7 +50,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; PPPMStagger::PPPMStagger(LAMMPS *lmp) : PPPM(lmp), - gf_b2(NULL) + gf_b2(nullptr) { stagger_flag = 1; group_group_enable = 0; diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index d4cfdea2b0..41ba1a6782 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -252,7 +252,7 @@ struct remap_plan_3d *remap_3d_create_plan( // allocate memory for plan data struct plan = (struct remap_plan_3d *) malloc(sizeof(struct remap_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; // store parameters in local data structs @@ -284,10 +284,10 @@ struct remap_plan_3d *remap_3d_create_plan( // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -313,8 +313,8 @@ struct remap_plan_3d *remap_3d_create_plan( plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -395,9 +395,9 @@ struct remap_plan_3d *remap_3d_create_plan( plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -456,7 +456,7 @@ struct remap_plan_3d *remap_3d_create_plan( // create sub-comm rank list if (plan->usecollective) { - plan->commringlist = NULL; + plan->commringlist = nullptr; // merge recv and send rank lists // ask Steve Plimpton about method to more accurately determine @@ -578,7 +578,7 @@ struct remap_plan_3d *remap_3d_create_plan( // find biggest send message (not including self) and malloc space for it - plan->sendbuf = NULL; + plan->sendbuf = nullptr; size = 0; for (nsend = 0; nsend < plan->nsend; nsend++) @@ -586,20 +586,20 @@ struct remap_plan_3d *remap_3d_create_plan( if (size) { plan->sendbuf = (FFT_SCALAR *) malloc(size*sizeof(FFT_SCALAR)); - if (plan->sendbuf == NULL) return NULL; + if (plan->sendbuf == nullptr) return nullptr; } // if requested, allocate internal scratch space for recvs, // only need it if I will receive any data (including self) - plan->scratch = NULL; + plan->scratch = nullptr; if (memory == 1) { if (nrecv > 0) { plan->scratch = (FFT_SCALAR *) malloc(nqty*out.isize*out.jsize*out.ksize * sizeof(FFT_SCALAR)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } } @@ -643,7 +643,7 @@ void remap_3d_destroy_plan(struct remap_plan_3d *plan) MPI_Comm_free(&plan->comm); if (plan->usecollective) { - if (plan->commringlist != NULL) + if (plan->commringlist != nullptr) free(plan->commringlist); } diff --git a/src/KSPACE/remap_wrap.cpp b/src/KSPACE/remap_wrap.cpp index 4aaaa1329e..de85339474 100644 --- a/src/KSPACE/remap_wrap.cpp +++ b/src/KSPACE/remap_wrap.cpp @@ -31,7 +31,7 @@ Remap::Remap(LAMMPS *lmp, MPI_Comm comm, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 7d4e89272d..0581f1e359 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -74,10 +74,10 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : thermo_virial = 1; // store ID of compute pe/atom used to generate Coulomb potential for LATTE - // NULL means LATTE will compute Coulombic potential + // nullptr means LATTE will compute Coulombic potential coulomb = 0; - id_pe = NULL; + id_pe = nullptr; if (strcmp(arg[3],"NULL") != 0) { coulomb = 1; @@ -97,8 +97,8 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : // initializations nmax = 0; - qpotential = NULL; - flatte = NULL; + qpotential = nullptr; + flatte = nullptr; latte_energy = 0.0; } @@ -136,7 +136,7 @@ void FixLatte::init() error->all(FLERR,"Fix latte requires 3d problem"); if (coulomb) { - if (atom->q_flag == 0 || force->pair == NULL || force->kspace == NULL) + if (atom->q_flag == 0 || force->pair == nullptr || force->kspace == nullptr) error->all(FLERR,"Fix latte cannot compute Coulomb potential"); int ipe = modify->find_compute(id_pe); @@ -154,7 +154,7 @@ void FixLatte::init() // create qpotential & flatte if needed // for now, assume nlocal will never change - if (coulomb && qpotential == NULL) { + if (coulomb && qpotential == nullptr) { memory->create(qpotential,atom->nlocal,"latte:qpotential"); memory->create(flatte,atom->nlocal,3,"latte:flatte"); } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 54169d08d7..bddec9e2ec 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -39,7 +39,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), comb(NULL), comb3(NULL), qf(NULL), q1(NULL), q2(NULL) + fp(nullptr), comb(nullptr), comb3(nullptr), qf(nullptr), q1(nullptr), q2(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix qeq/comb command"); @@ -65,7 +65,7 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/comb command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,std::string("Cannot open fix qeq/comb file ") + arg[iarg+1]); } @@ -85,8 +85,8 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) qf[i] = 0.0; - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; comm_forward = 1; } @@ -121,7 +121,7 @@ void FixQEQComb::init() comb = (PairComb *) force->pair_match("^comb",0); comb3 = (PairComb3 *) force->pair_match("^comb3",0); - if (comb == NULL && comb3 == NULL) + if (comb == nullptr && comb3 == nullptr) error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb"); if (utils::strmatch(update->integrate_style,"^respa")) { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index ff30ac7b1e..4eeab89381 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -41,25 +41,25 @@ PairADP::PairADP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nmax = 0; - rho = NULL; - fp = NULL; - mu = NULL; - lambda = NULL; - map = NULL; - - setfl = NULL; - - frho = NULL; - rhor = NULL; - z2r = NULL; - u2r = NULL; - w2r = NULL; - - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; - u2r_spline = NULL; - w2r_spline = NULL; + rho = nullptr; + fp = nullptr; + mu = nullptr; + lambda = nullptr; + map = nullptr; + + setfl = nullptr; + + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + u2r = nullptr; + w2r = nullptr; + + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; + u2r_spline = nullptr; + w2r_spline = nullptr; // set comm size needed by this Pair @@ -465,7 +465,7 @@ void PairADP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 7ab2eaa27b..8643f54812 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -61,13 +61,13 @@ PairAIREBO::PairAIREBO(LAMMPS *lmp) pvector = new double[nextra]; maxlocal = 0; - REBO_numneigh = NULL; - REBO_firstneigh = NULL; - ipage = NULL; + REBO_numneigh = nullptr; + REBO_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - nC = nH = NULL; - map = NULL; + nC = nH = nullptr; + map = nullptr; manybody_flag = 1; sigwid = 0.84; @@ -185,7 +185,7 @@ void PairAIREBO::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and H - // map[i] = which element (0,1) the Ith atom type is, -1 if NULL + // map[i] = which element (0,1) the Ith atom type is, -1 if nullptr for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -245,7 +245,7 @@ void PairAIREBO::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index ab02533cec..d605ddc2d8 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -40,7 +40,7 @@ class PairAIREBO : public Pair { enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code protected: - int *map; // 0 (C), 1 (H), or -1 (NULL) for each type + int *map; // 0 (C), 1 (H), or -1 (nullptr) for each type int variant; int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index 2a69e70b81..a6bf0ac400 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -311,10 +311,10 @@ void PairATM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) for (k = j; k <= atom->ntypes; k++) { - if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&nu[i][j][k],1,MPI_DOUBLE,0,world); } } @@ -339,8 +339,8 @@ void PairATM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_triple,1,MPI_DOUBLE,0,world); diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index e7c2f64672..4c7d30e457 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -64,114 +64,114 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; allocated = 0; - BOP_index = NULL; - BOP_index3 = NULL; - BOP_total = NULL; - BOP_total3 = NULL; - map = NULL; - pi_a = NULL; - pro_delta = NULL; - pi_delta = NULL; - pi_p = NULL; - pi_c = NULL; - r1 = NULL; - sigma_r0 = NULL; - pi_r0 = NULL; - phi_r0 = NULL; - sigma_rc = NULL; - pi_rc = NULL; - phi_rc = NULL; - sigma_beta0 = NULL; - pi_beta0 = NULL; - phi0 = NULL; - sigma_n = NULL; - pi_n = NULL; - phi_m = NULL; - sigma_nc = NULL; - pi_nc = NULL; - phi_nc = NULL; - pro = NULL; - sigma_delta = NULL; - sigma_c = NULL; - sigma_a = NULL; - sigma_f = NULL; - sigma_k = NULL; - small3 = NULL; - rcut = NULL; - rcut3 = NULL; - rcutsq = NULL; - rcutsq3 = NULL; - dr = NULL; - rdr = NULL; - dr3 = NULL; - rdr3 = NULL; - disij = NULL; - rij = NULL; - neigh_index = NULL; - neigh_index3 = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - cosAng = NULL; - betaS = NULL; - dBetaS = NULL; - betaP = NULL; - dBetaP = NULL; - repul = NULL; - dRepul = NULL; - itypeSigBk = NULL; - itypePiBk = NULL; - pBetaS = NULL; - pBetaS1 = NULL; - pBetaS2 = NULL; - pBetaS3 = NULL; - pBetaS4 = NULL; - pBetaS5 = NULL; - pBetaS6 = NULL; - pLong = NULL; - pLong1 = NULL; - pLong2 = NULL; - pLong3 = NULL; - pLong4 = NULL; - pLong5 = NULL; - pLong6 = NULL; - pBetaP = NULL; - pBetaP1 = NULL; - pBetaP2 = NULL; - pBetaP3 = NULL; - pBetaP4 = NULL; - pBetaP5 = NULL; - pBetaP6 = NULL; - pRepul = NULL; - pRepul1 = NULL; - pRepul2 = NULL; - pRepul3 = NULL; - pRepul4 = NULL; - pRepul5 = NULL; - pRepul6 = NULL; - FsigBO = NULL; - FsigBO1 = NULL; - FsigBO2 = NULL; - FsigBO3 = NULL; - FsigBO4 = NULL; - FsigBO5 = NULL; - FsigBO6 = NULL; - rcmin = NULL; - rcmax = NULL; - rcmaxp = NULL; - setflag = NULL; - cutsq = NULL; - cutghost = NULL; - - gfunc = NULL; - gfunc1 = NULL; - gfunc2 = NULL; - gfunc3 = NULL; - gfunc4 = NULL; - gfunc5 = NULL; - gfunc6 = NULL; - gpara = NULL; - bt_sg=NULL; - bt_pi=NULL; + BOP_index = nullptr; + BOP_index3 = nullptr; + BOP_total = nullptr; + BOP_total3 = nullptr; + map = nullptr; + pi_a = nullptr; + pro_delta = nullptr; + pi_delta = nullptr; + pi_p = nullptr; + pi_c = nullptr; + r1 = nullptr; + sigma_r0 = nullptr; + pi_r0 = nullptr; + phi_r0 = nullptr; + sigma_rc = nullptr; + pi_rc = nullptr; + phi_rc = nullptr; + sigma_beta0 = nullptr; + pi_beta0 = nullptr; + phi0 = nullptr; + sigma_n = nullptr; + pi_n = nullptr; + phi_m = nullptr; + sigma_nc = nullptr; + pi_nc = nullptr; + phi_nc = nullptr; + pro = nullptr; + sigma_delta = nullptr; + sigma_c = nullptr; + sigma_a = nullptr; + sigma_f = nullptr; + sigma_k = nullptr; + small3 = nullptr; + rcut = nullptr; + rcut3 = nullptr; + rcutsq = nullptr; + rcutsq3 = nullptr; + dr = nullptr; + rdr = nullptr; + dr3 = nullptr; + rdr3 = nullptr; + disij = nullptr; + rij = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + cosAng = nullptr; + betaS = nullptr; + dBetaS = nullptr; + betaP = nullptr; + dBetaP = nullptr; + repul = nullptr; + dRepul = nullptr; + itypeSigBk = nullptr; + itypePiBk = nullptr; + pBetaS = nullptr; + pBetaS1 = nullptr; + pBetaS2 = nullptr; + pBetaS3 = nullptr; + pBetaS4 = nullptr; + pBetaS5 = nullptr; + pBetaS6 = nullptr; + pLong = nullptr; + pLong1 = nullptr; + pLong2 = nullptr; + pLong3 = nullptr; + pLong4 = nullptr; + pLong5 = nullptr; + pLong6 = nullptr; + pBetaP = nullptr; + pBetaP1 = nullptr; + pBetaP2 = nullptr; + pBetaP3 = nullptr; + pBetaP4 = nullptr; + pBetaP5 = nullptr; + pBetaP6 = nullptr; + pRepul = nullptr; + pRepul1 = nullptr; + pRepul2 = nullptr; + pRepul3 = nullptr; + pRepul4 = nullptr; + pRepul5 = nullptr; + pRepul6 = nullptr; + FsigBO = nullptr; + FsigBO1 = nullptr; + FsigBO2 = nullptr; + FsigBO3 = nullptr; + FsigBO4 = nullptr; + FsigBO5 = nullptr; + FsigBO6 = nullptr; + rcmin = nullptr; + rcmax = nullptr; + rcmaxp = nullptr; + setflag = nullptr; + cutsq = nullptr; + cutghost = nullptr; + + gfunc = nullptr; + gfunc1 = nullptr; + gfunc2 = nullptr; + gfunc3 = nullptr; + gfunc4 = nullptr; + gfunc5 = nullptr; + gfunc6 = nullptr; + gpara = nullptr; + bt_sg=nullptr; + bt_pi=nullptr; } /* ---------------------------------------------------------------------- @@ -5627,12 +5627,12 @@ void PairBOP::memory_theta_destroy() memory->destroy(neigh_flag3); memory->destroy(neigh_index); memory->destroy(neigh_index3); - itypeSigBk = NULL; - itypePiBk = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - neigh_index = NULL; - neigh_index3 = NULL; + itypeSigBk = nullptr; + itypePiBk = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; if(otfly==0) { memory->destroy(cosAng); memory->destroy(dcAng); @@ -5680,7 +5680,7 @@ void PairBOP::grow_pi(int n1, int n2) } } memory->destroy(bt_pi); - bt_pi=NULL; + bt_pi=nullptr; bt_pi = (B_PI *) memory->smalloc(n2*sizeof(B_PI),"BOP:bt_pi"); for(i=0;idestroy(bt_sg); - bt_sg=NULL; + bt_sg=nullptr; bt_sg = (B_SG *) memory->smalloc(n2*sizeof(B_SG),"BOP:bt_sg"); for(i=0;iall(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -465,7 +465,7 @@ void PairComb::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -542,7 +542,7 @@ void PairComb::init_style() //for (i = 0; i < modify->nfix; i++) // if (strcmp(modify->fix[i]->style,"qeq") == 0) break; //if (i < modify->nfix) fixqeq = (FixQEQ *) modify->fix[i]; - //else fixqeq = NULL; + //else fixqeq = nullptr; // need a full neighbor list @@ -554,7 +554,7 @@ void PairComb::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 265d30c6f7..fd4f1b3822 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -54,38 +54,38 @@ PairComb3::PairComb3(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nmax = 0; - NCo = NULL; - bbij = NULL; - map = NULL; - esm = NULL; + NCo = nullptr; + bbij = nullptr; + map = nullptr; + esm = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; - - intype = NULL; - afb = NULL; - dafb = NULL; - fafb = NULL; - dfafb = NULL; - ddfafb = NULL; - phin = NULL; - dphin = NULL; - erpaw = NULL; - vvdw = NULL; - vdvdw = NULL; - dpl = NULL; - xcctmp = NULL; - xchtmp = NULL; - xcotmp = NULL; - - sht_num = NULL; - sht_first = NULL; - - ipage = NULL; + params = nullptr; + elem2param = nullptr; + + intype = nullptr; + afb = nullptr; + dafb = nullptr; + fafb = nullptr; + dfafb = nullptr; + ddfafb = nullptr; + phin = nullptr; + dphin = nullptr; + erpaw = nullptr; + vvdw = nullptr; + vdvdw = nullptr; + dpl = nullptr; + xcctmp = nullptr; + xchtmp = nullptr; + xcotmp = nullptr; + + sht_num = nullptr; + sht_first = nullptr; + + ipage = nullptr; pgsize = oneatom = 0; cflag = 0; @@ -192,7 +192,7 @@ void PairComb3::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -201,7 +201,7 @@ void PairComb3::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -277,7 +277,7 @@ void PairComb3::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 999384ea2f..ac96c040bb 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -46,26 +46,26 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nmax = 0; - rho = NULL; - fp = NULL; - numforce = NULL; - map = NULL; - type2frho = NULL; + rho = nullptr; + fp = nullptr; + numforce = nullptr; + map = nullptr; + type2frho = nullptr; nfuncfl = 0; - funcfl = NULL; + funcfl = nullptr; - setfl = NULL; - fs = NULL; + setfl = nullptr; + fs = nullptr; - frho = NULL; - rhor = NULL; - z2r = NULL; - scale = NULL; + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + scale = nullptr; - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; // set comm size needed by this Pair @@ -90,8 +90,8 @@ PairEAM::~PairEAM() memory->destroy(cutsq); delete [] map; delete [] type2frho; - map = NULL; - type2frho = NULL; + map = nullptr; + type2frho = nullptr; memory->destroy(type2rhor); memory->destroy(type2z2r); memory->destroy(scale); @@ -105,7 +105,7 @@ PairEAM::~PairEAM() memory->destroy(funcfl[i].zr); } memory->sfree(funcfl); - funcfl = NULL; + funcfl = nullptr; } if (setfl) { @@ -116,7 +116,7 @@ PairEAM::~PairEAM() memory->destroy(setfl->rhor); memory->destroy(setfl->z2r); delete setfl; - setfl = NULL; + setfl = nullptr; } if (fs) { @@ -127,7 +127,7 @@ PairEAM::~PairEAM() memory->destroy(fs->rhor); memory->destroy(fs->z2r); delete fs; - fs = NULL; + fs = nullptr; } memory->destroy(frho); @@ -937,5 +937,5 @@ void *PairEAM::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index d30f46aa36..055a2baf11 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -70,7 +70,7 @@ void PairEAMAlloy::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index dc36c73272..01ec02dd2e 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -44,9 +44,9 @@ PairEAMCD::PairEAMCD(LAMMPS *lmp, int _cdeamVersion) restartinfo = 0; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - rhoB = NULL; - D_values = NULL; - hcoeff = NULL; + rhoB = nullptr; + D_values = nullptr; + hcoeff = nullptr; // Set communication buffer sizes needed by this pair style. @@ -505,14 +505,14 @@ void PairEAMCD::read_h_coeff(char *filename) char nextline[MAXLINE]; int convert_flag = unit_convert_flag; fptr = utils::open_potential(filename, lmp, &convert_flag); - if (fptr == NULL) + if (fptr == nullptr) error->one(FLERR,fmt::format("Cannot open EAMCD potential file {}", filename)); // h coefficients are stored at the end of the file. // Skip to last line of file. - while(fgets(nextline, MAXLINE, fptr) != NULL) { + while(fgets(nextline, MAXLINE, fptr) != nullptr) { strcpy(line, nextline); } diff --git a/src/MANYBODY/pair_eam_cd.h b/src/MANYBODY/pair_eam_cd.h index ee84fb09c5..8f306d1019 100644 --- a/src/MANYBODY/pair_eam_cd.h +++ b/src/MANYBODY/pair_eam_cd.h @@ -49,7 +49,7 @@ public: /// Reports the memory usage of this pair style to LAMMPS. double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } /// Parses the coefficients of the h polynomial from the end of the EAM file. void read_h_coeff(char* filename); diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index dd45d12da3..90c24bb254 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -70,7 +70,7 @@ void PairEAMFS::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index cb5a95faa2..69e2832b37 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -41,25 +41,25 @@ PairEIM::PairEIM(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - setfl = NULL; + setfl = nullptr; nmax = 0; - rho = NULL; - fp = NULL; - map = NULL; + rho = nullptr; + fp = nullptr; + map = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; - negativity = NULL; - q0 = NULL; - cutforcesq = NULL; - Fij = NULL; - Gij = NULL; - phiij = NULL; + negativity = nullptr; + q0 = nullptr; + cutforcesq = nullptr; + Fij = nullptr; + Gij = nullptr; + phiij = nullptr; - Fij_spline = NULL; - Gij_spline = NULL; - phiij_spline = NULL; + Fij_spline = nullptr; + Gij_spline = nullptr; + phiij_spline = nullptr; // set comm size needed by this Pair @@ -388,7 +388,7 @@ void PairEIM::coeff(int narg, char **arg) read_file(arg[2+nelements]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3 + nelements; i < narg; i++) { m = i - (3+nelements) + 1; @@ -1062,7 +1062,7 @@ EIMPotentialFileReader::EIMPotentialFileReader(LAMMPS *lmp, FILE *fp = utils::open_potential(filename, lmp, &unit_convert); conversion_factor = utils::get_conversion_factor(utils::ENERGY,unit_convert); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR, fmt::format("cannot open eim potential file {}", filename)); } diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 051c30f873..dd9b55b7bf 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -51,11 +51,11 @@ PairGW::PairGW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void PairGW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -292,7 +292,7 @@ void PairGW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -370,7 +370,7 @@ double PairGW::init_one(int i, int j) void PairGW::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index ee3bebda13..69c677d0cf 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -61,7 +61,7 @@ PairGWZBL::PairGWZBL(LAMMPS *lmp) : PairGW(lmp) void PairGWZBL::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index d2e478b37d..c84361d7a6 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -48,13 +48,13 @@ PairLCBOP::PairLCBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - N = NULL; - M = NULL; + N = nullptr; + M = nullptr; } /* ---------------------------------------------------------------------- @@ -135,8 +135,8 @@ void PairLCBOP::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read args that map atom types to C and NULL - // map[i] = which element (0 for C) the Ith atom type is, -1 if NULL + // read args that map atom types to C and nullptr + // map[i] = which element (0 for C) the Ith atom type is, -1 if nullptr for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -193,7 +193,7 @@ void PairLCBOP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -970,7 +970,7 @@ void PairLCBOP::read_file(char *filename) if (me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open LCBOP potential file %s",filename); error->one(FLERR,str); diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index c7a7fab46d..9ca2e3d55e 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,7 +39,7 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 (NULL) for each type + int *map; // 0 (C) or -1 (nullptr) for each type int me; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 0a197a1576..a361955fa7 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -50,11 +50,11 @@ PairNb3bHarmonic::PairNb3bHarmonic(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -207,7 +207,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 0f7fd7a1c7..cdf9a7f23a 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -909,7 +909,7 @@ void PairPolymorphic::write_tables(int npts) { char tag[6] = ""; if (comm->me != 0) sprintf(tag,"%d",comm->me); - FILE* fp = NULL; + FILE* fp = nullptr; double xmin,xmax,x,uf,vf,wf,pf,gf,ff,ufp,vfp,wfp,pfp,gfp,ffp; char line[MAXLINE]; for (int i = 0; i < nelements; i++) { diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 2deb45ac75..9db9adf423 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -46,14 +46,14 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ void PairSW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -271,7 +271,7 @@ void PairSW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index c08c722e5f..21a8f7de67 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -50,14 +50,14 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -306,7 +306,7 @@ void PairTersoff::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -315,7 +315,7 @@ void PairTersoff::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 63765234b3..fea414f5fb 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -48,15 +48,15 @@ PairVashishta::PairVashishta(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; r0max = 0.0; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void PairVashishta::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -278,7 +278,7 @@ void PairVashishta::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index 5e0c2c16f7..8939efc78f 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; PairVashishtaTable::PairVashishtaTable(LAMMPS *lmp) : PairVashishta(lmp) { - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; } /* ---------------------------------------------------------------------- @@ -252,8 +252,8 @@ void PairVashishtaTable::create_tables() { memory->destroy(forceTable); memory->destroy(potentialTable); - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; tabinnersq = tabinner*tabinner; diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index f786179aa4..217646b92d 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -50,10 +50,10 @@ using namespace FixConst; FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), type_list(NULL), mu(NULL), qtype(NULL), - sqrt_mass_ratio(NULL), local_swap_iatom_list(NULL), - local_swap_jatom_list(NULL), local_swap_atom_list(NULL), - random_equal(NULL), random_unequal(NULL), c_pe(NULL) + idregion(nullptr), type_list(nullptr), mu(nullptr), qtype(nullptr), + sqrt_mass_ratio(nullptr), local_swap_iatom_list(nullptr), + local_swap_jatom_list(nullptr), local_swap_atom_list(nullptr), + random_equal(nullptr), random_unequal(nullptr), c_pe(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix atom/swap command"); @@ -105,9 +105,9 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : nswap_successes = 0.0; atom_swap_nmax = 0; - local_swap_atom_list = NULL; - local_swap_iatom_list = NULL; - local_swap_jatom_list = NULL; + local_swap_atom_list = nullptr; + local_swap_iatom_list = nullptr; + local_swap_jatom_list = nullptr; // set comm size needed by this Fix diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 8a7cd20b0f..a024bc20de 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -33,8 +33,8 @@ using namespace FixConst; FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - partner(NULL), finalpartner(NULL), distsq(NULL), probability(NULL), - broken(NULL), copy(NULL), random(NULL) + partner(nullptr), finalpartner(nullptr), distsq(nullptr), probability(nullptr), + broken(nullptr), copy(nullptr), random(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix bond/break command"); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index a2c2eee2c5..e485d370d8 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -40,8 +40,8 @@ using namespace MathConst; FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - bondcount(NULL), partner(NULL), finalpartner(NULL), distsq(NULL), - probability(NULL), created(NULL), copy(NULL), random(NULL), list(NULL) + bondcount(nullptr), partner(nullptr), finalpartner(nullptr), distsq(nullptr), + probability(nullptr), created(nullptr), copy(nullptr), random(nullptr), list(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix bond/create command"); @@ -163,7 +163,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // register with Atom class // bondcount values will be initialized in setup() - bondcount = NULL; + bondcount = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); countflag = 0; @@ -177,11 +177,11 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; maxcreate = 0; - created = NULL; + created = nullptr; // copy = special list for one atom // size = ms^2 + ms is sufficient @@ -237,7 +237,7 @@ void FixBondCreate::init() // check cutoff for iatomtype,jatomtype - if (force->pair == NULL || cutsq > force->pair->cutsq[iatomtype][jatomtype]) + if (force->pair == nullptr || cutsq > force->pair->cutsq[iatomtype][jatomtype]) error->all(FLERR,"Fix bond/create cutoff is longer than pairwise cutoff"); // warn if more than one fix bond/create or also a fix bond/break diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 270a497772..9b1f14516a 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -52,8 +52,8 @@ static const char cite_fix_bond_swap[] = FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tflag(0), alist(NULL), id_temp(NULL), type(NULL), x(NULL), list(NULL), - temperature(NULL), random(NULL) + tflag(0), alist(nullptr), id_temp(nullptr), type(nullptr), x(nullptr), list(nullptr), + temperature(nullptr), random(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_swap); @@ -96,7 +96,7 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : // initialize atom list nmax = 0; - alist = NULL; + alist = nullptr; naccept = foursome = 0; } @@ -130,7 +130,7 @@ void FixBondSwap::init() { // require an atom style with molecule IDs - if (atom->molecule == NULL) + if (atom->molecule == nullptr) error->all(FLERR, "Must use atom style with molecule IDs with fix bond/swap"); @@ -143,13 +143,13 @@ void FixBondSwap::init() // no dihedral or improper potentials allowed // special bonds must be 0 1 1 - if (force->pair == NULL || force->bond == NULL) + if (force->pair == nullptr || force->bond == nullptr) error->all(FLERR,"Fix bond/swap requires pair and bond styles"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support fix bond/swap"); - if (force->angle == NULL && atom->nangles > 0 && comm->me == 0) + if (force->angle == nullptr && atom->nangles > 0 && comm->me == 0) error->warning(FLERR,"Fix bond/swap will ignore defined angles"); if (force->dihedral || force->improper) diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index fc306696ed..670a1ff583 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -66,10 +66,10 @@ enum{MOVEATOM,MOVEMOL}; // movemode FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), ngroups(0), groupstrings(NULL), ngrouptypes(0), grouptypestrings(NULL), - grouptypebits(NULL), grouptypes(NULL), local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL), random_unequal(NULL), - fixrigid(NULL), fixshake(NULL), idrigid(NULL), idshake(NULL) + idregion(nullptr), full_flag(0), ngroups(0), groupstrings(nullptr), ngrouptypes(0), grouptypestrings(nullptr), + grouptypebits(nullptr), grouptypes(nullptr), local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr), random_unequal(nullptr), + fixrigid(nullptr), fixshake(nullptr), idrigid(nullptr), idshake(nullptr) { if (narg < 11) error->all(FLERR,"Illegal fix gcmc command"); @@ -167,7 +167,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix gcmc molecule must have atom types"); if (ngcmc_type != 0) error->all(FLERR,"Atom type must be zero in fix gcmc mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix gcmc molecule has charges, but atom style does not"); if (atom->molecular == 2 && onemols != atom->avec->onemols) @@ -176,7 +176,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) + if (charge_flag && atom->q == nullptr) error->all(FLERR,"Fix gcmc atom has charge, but atom style does not"); if (rigidflag && exchmode == EXCHATOM) @@ -219,7 +219,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : ninsertion_successes = 0.0; gcmc_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -258,12 +258,12 @@ void FixGCMC::options(int narg, char **arg) full_flag = false; ngroups = 0; int ngroupsmax = 0; - groupstrings = NULL; + groupstrings = nullptr; ngrouptypes = 0; int ngrouptypesmax = 0; - grouptypestrings = NULL; - grouptypes = NULL; - grouptypebits = NULL; + grouptypestrings = nullptr; + grouptypes = nullptr; + grouptypebits = nullptr; energy_intra = 0.0; tfac_insert = 1.0; overlap_cutoffsq = 0.0; @@ -481,7 +481,7 @@ void FixGCMC::init() if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("^hybrid",0)) || (force->pair_match("^eam",0)) || @@ -542,7 +542,7 @@ void FixGCMC::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix gcmc rigid fix does not exist"); @@ -557,7 +557,7 @@ void FixGCMC::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix gcmc shake fix does not exist"); diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index b855c0b79e..20b72dc269 100644 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xd(NULL), rotflag(0), random_num(NULL) + xd(nullptr), rotflag(0), random_num(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tfmc command"); @@ -83,7 +83,7 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : comflag = 0; if (rotflag) { - xd = NULL; + xd = nullptr; nmax = -1; } @@ -97,7 +97,7 @@ FixTFMC::~FixTFMC() delete random_num; if (rotflag) { memory->destroy(xd); - xd = NULL; + xd = nullptr; nmax = -1; } } diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 94b2481742..919cf6d3c3 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -58,9 +58,9 @@ enum{EXCHATOM,EXCHMOL}; // exchmode FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), - local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL) + idregion(nullptr), full_flag(0), + local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix Widom command"); @@ -151,7 +151,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix Widom molecule must have atom types"); if (nwidom_type != 0) error->all(FLERR,"Atom type must be zero in fix Widom mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix Widom molecule has charges, but atom style does not"); if (atom->molecular == 2 && onemols != atom->avec->onemols) @@ -160,7 +160,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) + if (charge_flag && atom->q == nullptr) error->all(FLERR,"Fix Widom atom has charge, but atom style does not"); // setup of array of coordinates for molecule insertion @@ -177,7 +177,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : // zero out counters widom_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void FixWidom::init() // decide whether to switch to the full_energy option if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("hybrid",0)) || (force->pair_match("eam",0)) || diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index 588d57f324..f4bac9b8cb 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -38,8 +38,8 @@ PairDSMC::PairDSMC(LAMMPS *lmp) : Pair(lmp) total_number_of_collisions = 0; max_particles = max_particle_list = 0; - next_particle = NULL; - random = NULL; + next_particle = nullptr; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -342,12 +342,12 @@ void PairDSMC::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -375,11 +375,11 @@ void PairDSMC::write_restart_settings(FILE *fp) void PairDSMC::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/MESSAGE/fix_client_md.cpp b/src/MESSAGE/fix_client_md.cpp index 1cbce3a7f9..aee8b2a069 100644 --- a/src/MESSAGE/fix_client_md.cpp +++ b/src/MESSAGE/fix_client_md.cpp @@ -62,7 +62,7 @@ FixClientMD::FixClientMD(LAMMPS *lmp, int narg, char **arg) : box[0][2] = box[1][2] = box[2][0] = box[2][1] = box[2][2] = 0.0; maxatom = 0; - xpbc = NULL; + xpbc = nullptr; // unit conversion factors for REAL // otherwise not needed diff --git a/src/MESSAGE/message.cpp b/src/MESSAGE/message.cpp index b83be0339c..b43a2686a2 100644 --- a/src/MESSAGE/message.cpp +++ b/src/MESSAGE/message.cpp @@ -116,6 +116,6 @@ void Message::quit() // clean-up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; lmp->clientserver = 0; } diff --git a/src/MESSAGE/server_mc.cpp b/src/MESSAGE/server_mc.cpp index af7850a0e9..44e4a628a0 100644 --- a/src/MESSAGE/server_mc.cpp +++ b/src/MESSAGE/server_mc.cpp @@ -77,7 +77,7 @@ void ServerMC::loop() cs->send(msgID,2); cs->pack_double(1,dval); - double *coords = NULL; + double *coords = nullptr; if (atom->nlocal) coords = &atom->x[0][0]; cs->pack_parallel(2,4,atom->nlocal,atom->tag,3,coords); @@ -143,5 +143,5 @@ void ServerMC::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } diff --git a/src/MESSAGE/server_md.cpp b/src/MESSAGE/server_md.cpp index 418162e5d9..d2bbb088b8 100644 --- a/src/MESSAGE/server_md.cpp +++ b/src/MESSAGE/server_md.cpp @@ -64,7 +64,7 @@ ServerMD::ServerMD(LAMMPS *lmp) : Pointers(lmp) pconvert = 1.0 / 0.986923; // atmospheres -> bars } - fcopy = NULL; + fcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -107,15 +107,15 @@ void ServerMD::loop() if (msgID == SETUP) { int dim = 0; - int *periodicity = NULL; + int *periodicity = nullptr; int natoms = -1; int ntypes = -1; - double *origin = NULL; - double *box = NULL; - int *types = NULL; - double *coords = NULL; - char *unit_style = NULL; - double *charge = NULL; + double *origin = nullptr; + double *box = nullptr; + int *types = nullptr; + double *coords = nullptr; + char *unit_style = nullptr; + double *charge = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == DIM) { @@ -185,7 +185,7 @@ void ServerMD::loop() int nlocal = 0; for (int i = 0; i < natoms; i++) { - if (!domain->ownatom(i+1,&coords[3*i],NULL,0)) continue; + if (!domain->ownatom(i+1,&coords[3*i],nullptr,0)) continue; atom->avec->create_atom(types[i],&coords[3*i]); atom->tag[nlocal] = i+1; if (charge) atom->q[nlocal] = charge[i]; @@ -226,9 +226,9 @@ void ServerMD::loop() } else if (msgID == STEP) { - double *coords = NULL; - double *origin = NULL; - double *box = NULL; + double *coords = nullptr; + double *origin = nullptr; + double *box = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == COORDS) { @@ -314,7 +314,7 @@ void ServerMD::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void ServerMD::send_fev(int msgID) cs->send(msgID,3); - double *forces = NULL; + double *forces = nullptr; if (atom->nlocal) { if (units != REAL) forces = &atom->f[0][0]; else { diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index d8be8679c6..f984aeac2e 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -36,8 +36,8 @@ enum{PAIR,TAIL,KSPACE}; /* ---------------------------------------------------------------------- */ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), nterms(0), which(NULL), ivar1(NULL), ivar2(NULL), - ilo(NULL), ihi(NULL), var1(NULL), var2(NULL), pptr(NULL), pstyle(NULL) + Compute(lmp, narg, arg), nterms(0), which(nullptr), ivar1(nullptr), ivar2(nullptr), + ilo(nullptr), ihi(nullptr), var1(nullptr), var2(nullptr), pptr(nullptr), pstyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute ti command"); @@ -64,7 +64,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : pptr = new Pair*[nterms]; pstyle = new char*[nterms]; - for (int m = 0; m < nterms; m++) pstyle[m] = NULL; + for (int m = 0; m < nterms; m++) pstyle[m] = nullptr; // parse keywords @@ -136,16 +136,16 @@ void ComputeTI::init() if (which[m] == PAIR) { pptr[m] = force->pair_match(pstyle[m],1); - if (pptr[m] == NULL) + if (pptr[m] == nullptr) error->all(FLERR,"Compute ti pair style does not exist"); } else if (which[m] == TAIL) { - if (force->pair == NULL || force->pair->tail_flag == 0) + if (force->pair == nullptr || force->pair->tail_flag == 0) error->all(FLERR,"Compute ti tail when pair style does not " "compute tail corrections"); } else if (which[m] == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Compute ti kspace style does not exist"); } } diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 9f2bbfe424..5c3ca7264e 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -53,7 +53,7 @@ int xdr3dfcoord(XDR *, float *, int *, float *); /* ---------------------------------------------------------------------- */ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xtc command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), size_one = 3; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; precision = 1000.0; @@ -137,9 +137,9 @@ void DumpXTC::init_style() void DumpXTC::openfile() { // XTC maintains it's own XDR file ptr - // set fp to NULL so parent dump class will not use it + // set fp to nullptr so parent dump class will not use it - fp = NULL; + fp = nullptr; if (me == 0) if (xdropen(&xd,filename,"w") == 0) error->one(FLERR,"Cannot open dump file"); } @@ -364,8 +364,8 @@ void DumpXTC::write_frame() static FILE *xdrfiles[MAXID]; static XDR *xdridptr[MAXID]; static char xdrmodes[MAXID]; -static int *ip = NULL; -static int *buf = NULL; +static int *ip = nullptr; +static int *buf = nullptr; /*___________________________________________________________________________ | @@ -414,12 +414,12 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) if (init_done == 0) { for (xdrid = 1; xdrid < MAXID; xdrid++) { - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; } init_done = 1; } xdrid = 1; - while (xdrid < MAXID && xdridptr[xdrid] != NULL) { + while (xdrid < MAXID && xdridptr[xdrid] != nullptr) { xdrid++; } if (xdrid == MAXID) { @@ -433,8 +433,8 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) lmode = XDR_DECODE; } xdrfiles[xdrid] = fopen(filename, type); - if (xdrfiles[xdrid] == NULL) { - xdrs = NULL; + if (xdrfiles[xdrid] == nullptr) { + xdrs = nullptr; return 0; } xdrmodes[xdrid] = *type; @@ -444,7 +444,7 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) * (C users are expected to pass the address of an already allocated * XDR staructure) */ - if (xdrs == NULL) { + if (xdrs == nullptr) { xdridptr[xdrid] = (XDR *) malloc(sizeof(XDR)); xdrstdio_create(xdridptr[xdrid], xdrfiles[xdrid], lmode); } else { @@ -468,7 +468,7 @@ int xdrclose(XDR *xdrs) { int xdrid; - if (xdrs == NULL) { + if (xdrs == nullptr) { fprintf(stderr, "xdrclose: passed a NULL pointer\n"); exit(1); } @@ -477,7 +477,7 @@ int xdrclose(XDR *xdrs) xdr_destroy(xdrs); fclose(xdrfiles[xdrid]); - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; return 1; } } @@ -495,8 +495,8 @@ void xdrfreebuf() { if (ip) free(ip); if (buf) free(buf); - ip = NULL; - buf = NULL; + ip = nullptr; + buf = nullptr; } @@ -815,28 +815,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *) realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } @@ -1059,28 +1059,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) (xdrproc_t)xdr_float)); } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *)realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *)realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 7ee6fce1b9..35b5e0e405 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -44,9 +44,9 @@ enum{DIST_UNIFORM,DIST_GAUSSIAN}; /* ---------------------------------------------------------------------- */ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), idrigid(NULL), - idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), imageflags(NULL), - fixrigid(NULL), fixshake(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), idrigid(nullptr), + idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), imageflags(nullptr), + fixrigid(nullptr), fixshake(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix deposit command"); @@ -233,7 +233,7 @@ void FixDeposit::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix deposit rigid fix does not exist"); @@ -248,7 +248,7 @@ void FixDeposit::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix deposit shake fix does not exist"); @@ -658,13 +658,13 @@ void FixDeposit::options(int narg, char **arg) // defaults iregion = -1; - idregion = NULL; + idregion = nullptr; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; globalflag = localflag = 0; lo = hi = deltasq = 0.0; @@ -904,5 +904,5 @@ void *FixDeposit::extract(const char *str, int &itype) return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index bd2f9acfb9..d3836f52a5 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -40,8 +40,8 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), - estr(NULL), idregion(NULL), efield(NULL) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), + estr(nullptr), idregion(nullptr), efield(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix efield command"); @@ -57,7 +57,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -89,8 +89,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; - estr = NULL; + idregion = nullptr; + estr = nullptr; int iarg = 6; while (iarg < narg) { @@ -272,7 +272,7 @@ void FixEfield::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index 6396d139a0..0d3b400106 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -33,7 +33,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), list(NULL), mark(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), list(nullptr), mark(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix evaporate command"); @@ -84,8 +84,8 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : ndeleted = 0; nmax = 0; - list = NULL; - mark = NULL; + list = nullptr; + mark = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 75642b632f..6f56eb4d5c 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - step_respa(NULL), prony_c(NULL), prony_tau(NULL), s_gld(NULL), random(NULL) + step_respa(nullptr), prony_c(nullptr), prony_tau(nullptr), s_gld(nullptr), random(nullptr) { int narg_min = 8; // Check to make sure we have the minimal number of inputs @@ -89,7 +89,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : // allocate memory for Prony series timescale coefficients memory->create(prony_tau, prony_terms, "gld:prony_tau"); // allocate memory for Prony series extended variables - s_gld = NULL; + s_gld = nullptr; grow_arrays(atom->nmax); // add callbacks to enable restarts atom->add_callback(0); diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index 1ca24a5906..3508c2fd7e 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -35,7 +35,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { direction = NONE; regionidx = 0; - regionstr = NULL; + regionstr = nullptr; if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index cc22a509ba..7d9463f77c 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -56,7 +56,7 @@ static const char cite_fix_orient_bcc[] = FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_bcc); @@ -114,7 +114,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); @@ -124,7 +124,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index f391eab91e..0677b8d57c 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -53,8 +53,8 @@ static const char cite_fix_orient_fcc[] = FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), - sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), + sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_fcc); @@ -112,7 +112,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); @@ -122,7 +122,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); diff --git a/src/MISC/fix_thermal_conductivity.cpp b/src/MISC/fix_thermal_conductivity.cpp index 115045db81..ac86162e31 100644 --- a/src/MISC/fix_thermal_conductivity.cpp +++ b/src/MISC/fix_thermal_conductivity.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - index_lo(NULL), index_hi(NULL), ke_lo(NULL), ke_hi(NULL) + index_lo(nullptr), index_hi(nullptr), ke_lo(nullptr), ke_hi(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix thermal/conductivity command"); diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index 2d38f3c6c6..31585cea9e 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -42,11 +42,11 @@ using namespace FixConst; FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (narg < 15) error->all(FLERR,"Illegal fix ttm command"); @@ -74,7 +74,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : if (narg != 16) error->all(FLERR,"Illegal fix ttm command"); if (comm->me == 0) { fp = fopen(arg[15],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open output file {}: {}", arg[15], utils::getsyserror())); } @@ -128,7 +128,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "TTM:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -341,7 +341,7 @@ void FixTTM::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/MISC/fix_viscosity.cpp b/src/MISC/fix_viscosity.cpp index 5dcd2d291d..90e6fcda63 100644 --- a/src/MISC/fix_viscosity.cpp +++ b/src/MISC/fix_viscosity.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pos_index(NULL), neg_index(NULL), pos_delta(NULL), neg_delta(NULL) + pos_index(nullptr), neg_index(nullptr), pos_delta(nullptr), neg_delta(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix viscosity command"); diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 4fc1fb0628..4090677a03 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -319,15 +319,15 @@ void PairNMCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -357,10 +357,10 @@ void PairNMCut::write_restart_settings(FILE *fp) void PairNMCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -422,5 +422,5 @@ void *PairNMCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 4a18680415..1f0ae96324 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -370,16 +370,16 @@ void PairNMCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -411,11 +411,11 @@ void PairNMCutCoulCut::write_restart_settings(FILE *fp) void PairNMCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -493,5 +493,5 @@ void *PairNMCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index 576637c593..a981204af6 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -46,7 +46,7 @@ using namespace MathConst; PairNMCutCoulLong::PairNMCutCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -308,13 +308,13 @@ void PairNMCutCoulLong::init_style() cut_coulsq = cut_coul * cut_coul; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -414,15 +414,15 @@ void PairNMCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -455,13 +455,13 @@ void PairNMCutCoulLong::write_restart_settings(FILE *fp) void PairNMCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -576,5 +576,5 @@ void *PairNMCutCoulLong::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/xdr_compat.cpp b/src/MISC/xdr_compat.cpp index 9806b0bbd2..7483b4aa18 100644 --- a/src/MISC/xdr_compat.cpp +++ b/src/MISC/xdr_compat.cpp @@ -352,7 +352,7 @@ xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt) /* * XDR null terminated ASCII strings * xdr_string deals with "C strings" - arrays of bytes that are - * terminated by a NULL character. The parameter cpp references a + * terminated by a nullptr character. The parameter cpp references a * pointer to storage; If the pointer is null, then the necessary * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. @@ -370,13 +370,13 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) switch (xdrs->x_op) { case XDR_FREE: - if (sp == NULL) + if (sp == nullptr) { return TRUE; /* already free */ } /* fall through... */ case XDR_ENCODE: - if (sp == NULL) + if (sp == nullptr) return FALSE; size = strlen (sp); break; @@ -404,9 +404,9 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) { return TRUE; } - if (sp == NULL) + if (sp == nullptr) *cpp = sp = (char *) malloc (nodesize); - if (sp == NULL) + if (sp == nullptr) { (void) fputs ("xdr_string: out of memory\n", stderr); return FALSE; @@ -419,7 +419,7 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) case XDR_FREE: free (sp); - *cpp = NULL; + *cpp = nullptr; return TRUE; } return FALSE; @@ -660,7 +660,7 @@ xdrstdio_inline (XDR * /*xdrs*/, int /*len*/) * most of the gains to be had here and require storage * management on this buffer, so we don't do this. */ - return NULL; + return nullptr; } static bool_t diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp index 956cb0196f..fe406772ca 100644 --- a/src/MLIAP/compute_mliap.cpp +++ b/src/MLIAP/compute_mliap.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), mliaparray(NULL), - mliaparrayall(NULL), map(NULL) + Compute(lmp, narg, arg), mliaparray(nullptr), + mliaparrayall(nullptr), map(nullptr) { array_flag = 1; extarray = 0; @@ -127,7 +127,7 @@ ComputeMLIAP::~ComputeMLIAP() void ComputeMLIAP::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute mliap requires a pair style be defined"); if (descriptor->cutmax > force->pair->cutforce) diff --git a/src/MLIAP/mliap_data.cpp b/src/MLIAP/mliap_data.cpp index a7e50012cb..cb29dffd46 100644 --- a/src/MLIAP/mliap_data.cpp +++ b/src/MLIAP/mliap_data.cpp @@ -25,10 +25,10 @@ MLIAPData::MLIAPData(LAMMPS *lmp, int gradgradflag_in, int *map_in, class MLIAPModel* model_in, class MLIAPDescriptor* descriptor_in, class PairMLIAP* pairmliap_in) : - Pointers(lmp), gradforce(NULL), betas(NULL), descriptors(NULL), gamma(NULL), - gamma_row_index(NULL), gamma_col_index(NULL), egradient(NULL), - numneighs(NULL), iatoms(NULL), ielems(NULL), jatoms(NULL), jelems(NULL), - rij(NULL), graddesc(NULL), model(NULL), descriptor(NULL), list(NULL) + Pointers(lmp), gradforce(nullptr), betas(nullptr), descriptors(nullptr), gamma(nullptr), + gamma_row_index(nullptr), gamma_col_index(nullptr), egradient(nullptr), + numneighs(nullptr), iatoms(nullptr), ielems(nullptr), jatoms(nullptr), jelems(nullptr), + rij(nullptr), graddesc(nullptr), model(nullptr), descriptor(nullptr), list(nullptr) { gradgradflag = gradgradflag_in; map = map_in; diff --git a/src/MLIAP/mliap_data.h b/src/MLIAP/mliap_data.h index 0307d93aee..ffac9ccd4c 100644 --- a/src/MLIAP/mliap_data.h +++ b/src/MLIAP/mliap_data.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class MLIAPData : protected Pointers { public: - MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = NULL); + MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = nullptr); ~MLIAPData(); void init(); diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 5f0ee33c8c..21ba68e9a8 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -35,10 +35,10 @@ MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): MLIAPDescriptor(lmp) { nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - snaptr = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + snaptr = nullptr; read_paramfile(paramfilename); snaptr = new SNA(lmp, rfac0, twojmax, @@ -374,7 +374,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) + if (fpparam == nullptr) error->one(FLERR,fmt::format("Cannot open SNAP parameter file {}: {}", paramfilename, utils::getsyserror())); } @@ -386,7 +386,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -406,7 +406,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { utils::logmesg(lmp, fmt::format("SNAP keyword {} {} \n", keywd, keyval)); @@ -427,19 +427,19 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) int n = strlen(elemtmp) + 1; elements[ielem] = new char[n]; strcpy(elements[ielem],elemtmp); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } elementsflag = 1; } else if (strcmp(keywd,"radelems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { radelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } radelemflag = 1; } else if (strcmp(keywd,"welems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { wjelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } wjelemflag = 1; } diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index b731e1c9f8..7ac1013c4f 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp) { - coeffelem = NULL; + coeffelem = nullptr; if (coefffilename) read_coeffs(coefffilename); else { nparams = 0; @@ -81,7 +81,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) + if (fpcoeff == nullptr) error->one(FLERR,fmt::format("Cannot open MLIAPModel coeff file {}: {}", coefffilename,utils::getsyserror())); } @@ -94,7 +94,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -119,7 +119,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); nparams = atoi(words[1]); @@ -134,7 +134,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) for (int icoeff = 0; icoeff < nparams; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; diff --git a/src/MLIAP/mliap_model_quadratic.h b/src/MLIAP/mliap_model_quadratic.h index 188d78661f..b41df18a07 100644 --- a/src/MLIAP/mliap_model_quadratic.h +++ b/src/MLIAP/mliap_model_quadratic.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { class MLIAPModelQuadratic : public MLIAPModel { public: - MLIAPModelQuadratic(LAMMPS*, char* = NULL); + MLIAPModelQuadratic(LAMMPS*, char* = nullptr); ~MLIAPModelQuadratic(); virtual int get_nparams(); virtual int get_gamma_nnz(class MLIAPData*); diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 6cd550384d..61051084bb 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -246,10 +246,10 @@ void AngleCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 0288a61d83..b4190d902d 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -194,7 +194,7 @@ void AngleCosine::read_restart(FILE *fp) { allocate(); - if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1; diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 1a05edc20b..1cf0cb8873 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -247,9 +247,9 @@ void AngleCosinePeriodic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 5fb40b54c9..dc1a20fd8b 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -37,8 +37,8 @@ using namespace MathConst; AngleCosineSquared::AngleCosineSquared(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleCosineSquared::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index eb5e48ec9b..19142f94c8 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -33,8 +33,8 @@ using namespace MathConst; AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 100b75cb0a..6e47bf7877 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -47,7 +47,7 @@ AngleTable::AngleTable(LAMMPS *lmp) : Angle(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -205,7 +205,7 @@ void AngleTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -311,8 +311,8 @@ void AngleTable::write_restart_settings(FILE *fp) void AngleTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -351,10 +351,10 @@ double AngleTable::single(int type, int i1, int i2, int i3) void AngleTable::null_table(Table *tb) { - tb->afile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->ang = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->afile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->ang = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 3dc8c90882..5e3e2df070 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -55,7 +55,7 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = 0; - bond_negative = angle_negative = NULL; + bond_negative = angle_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index 2fa445c8ee..22f47e5693 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -50,7 +50,7 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = 0; - bond_negative = NULL; + bond_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 866cf796c9..a69007cea6 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -75,7 +75,7 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index e90bec5108..da75316a75 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -75,7 +75,7 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index b2271d45fc..f79c56b636 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -215,10 +215,10 @@ void BondFENE::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -279,5 +279,5 @@ void *BondFENE::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 676d5f6871..8166e63e24 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -225,11 +225,11 @@ void BondFENEExpand::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 89b3830cb5..85653a60f3 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -167,8 +167,8 @@ void BondGromos::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -204,5 +204,5 @@ void *BondGromos::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 28100512a8..6e523b4923 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -168,8 +168,8 @@ void BondHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -208,7 +208,7 @@ void *BondHarmonic::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 49074e1cdc..f7e4e6c919 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -173,9 +173,9 @@ void BondMorse::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&d0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -213,5 +213,5 @@ void *BondMorse::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 63b640730a..7c74d8f418 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -168,9 +168,9 @@ void BondNonlinear::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&epsilon[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -211,5 +211,5 @@ void *BondNonlinear::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"epsilon")==0) return (void*) epsilon; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index c8d182e4ff..4fd22f3778 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -229,7 +229,7 @@ void BondQuartic::coeff(int narg, char **arg) void BondQuartic::init_style() { - if (force->pair == NULL || force->pair->single_enable == 0) + if (force->pair == nullptr || force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support bond_style quartic"); if (force->angle || force->dihedral || force->improper) error->all(FLERR, @@ -276,11 +276,11 @@ void BondQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&b1[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 5cc91ceae0..a7fbbb84d7 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -43,7 +43,7 @@ BondTable::BondTable(LAMMPS *lmp) : Bond(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -157,7 +157,7 @@ void BondTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -254,8 +254,8 @@ void BondTable::write_restart_settings(FILE *fp) void BondTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -278,10 +278,10 @@ double BondTable::single(int type, double rsq, int /*i*/, int /*j*/, void BondTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 11422e0820..cc615213a0 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -389,7 +389,7 @@ void DihedralCharmm::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmm is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -424,11 +424,11 @@ void DihedralCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 408be8ef99..a124212117 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -407,7 +407,7 @@ void DihedralCharmmfsw::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -428,8 +428,8 @@ void DihedralCharmmfsw::init_style() double *p_cutlj = (double *) force->pair->extract("cut_lj",itmp); double *p_cutcoul = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutcoul == NULL || p_cutljinner == NULL || - p_cutlj == NULL || p_dihedflag == NULL) + if (p_cutcoul == nullptr || p_cutljinner == nullptr || + p_cutlj == nullptr || p_dihedflag == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); dihedflag = *p_dihedflag; @@ -467,11 +467,11 @@ void DihedralCharmmfsw::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 55e2f25006..87ade01be3 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -328,9 +328,9 @@ void DihedralHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 40e026c2f1..8c4ba07fb6 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -323,9 +323,9 @@ void DihedralHelix::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&aphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&bphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 963304da80..57c017bd95 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -319,11 +319,11 @@ void DihedralMultiHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&a1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index fe05dc7c3d..39b979ff23 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -331,10 +331,10 @@ void DihedralOPLS::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 2de6dd4183..0de406120d 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -62,11 +62,11 @@ using namespace MathConst; FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - crosstermlist(NULL), num_crossterm(NULL), crossterm_type(NULL), - crossterm_atom1(NULL), crossterm_atom2(NULL), crossterm_atom3(NULL), - crossterm_atom4(NULL), crossterm_atom5(NULL), - g_axis(NULL), cmapgrid(NULL), d1cmapgrid(NULL), d2cmapgrid(NULL), - d12cmapgrid(NULL) + crosstermlist(nullptr), num_crossterm(nullptr), crossterm_type(nullptr), + crossterm_atom1(nullptr), crossterm_atom2(nullptr), crossterm_atom3(nullptr), + crossterm_atom4(nullptr), crossterm_atom5(nullptr), + g_axis(nullptr), cmapgrid(nullptr), d1cmapgrid(nullptr), d2cmapgrid(nullptr), + d12cmapgrid(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix cmap command"); @@ -101,13 +101,13 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - num_crossterm = NULL; - crossterm_type = NULL; - crossterm_atom1 = NULL; - crossterm_atom2 = NULL; - crossterm_atom3 = NULL; - crossterm_atom4 = NULL; - crossterm_atom5 = NULL; + num_crossterm = nullptr; + crossterm_type = nullptr; + crossterm_atom1 = nullptr; + crossterm_atom2 = nullptr; + crossterm_atom3 = nullptr; + crossterm_atom4 = nullptr; + crossterm_atom5 = nullptr; nmax_previous = 0; grow_arrays(atom->nmax); @@ -118,7 +118,7 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : ncmap = 0; maxcrossterm = 0; - crosstermlist = NULL; + crosstermlist = nullptr; } /* --------------------------------------------------------------------- */ @@ -631,10 +631,10 @@ void FixCMAP::read_grid_map(char *cmapfile) char *chunk,*line; int i1, i2, i3, i4, i5, i6, j1, j2, j3, j4, j5, j6, counter; - FILE *fp = NULL; + FILE *fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(cmapfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix cmap file {}: {}", cmapfile, utils::getsyserror())); @@ -654,7 +654,7 @@ void FixCMAP::read_grid_map(char *cmapfile) while (!done) { // only read on rank 0 and broadcast to all other ranks if (comm->me == 0) - done = (fgets(linebuf,MAXLINE,fp) == NULL); + done = (fgets(linebuf,MAXLINE,fp) == nullptr); MPI_Bcast(&done,1,MPI_INT,0,world); if (done) continue; @@ -681,13 +681,13 @@ void FixCMAP::read_grid_map(char *cmapfile) // 6. Glycine before proline map chunk = strtok(line, " \r\n"); - while (chunk != NULL) { + while (chunk != nullptr) { // alanine map if (counter < CMAPDIM*CMAPDIM) { cmapgrid[0][i1][j1] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j1++; if (j1 == CMAPDIM) { j1 = 0; @@ -701,7 +701,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= CMAPDIM*CMAPDIM && counter < 2*CMAPDIM*CMAPDIM) { cmapgrid[1][i2][j2]= atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j2++; if (j2 == CMAPDIM) { j2 = 0; @@ -715,7 +715,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 2*CMAPDIM*CMAPDIM && counter < 3*CMAPDIM*CMAPDIM) { cmapgrid[2][i3][j3] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j3++; if (j3 == CMAPDIM) { j3 = 0; @@ -729,7 +729,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 3*CMAPDIM*CMAPDIM && counter < 4*CMAPDIM*CMAPDIM) { cmapgrid[3][i4][j4] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j4++; if (j4 == CMAPDIM) { j4 = 0; @@ -743,7 +743,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 4*CMAPDIM*CMAPDIM && counter < 5*CMAPDIM*CMAPDIM) { cmapgrid[4][i5][j5] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j5++; if (j5 == CMAPDIM) { j5 = 0; @@ -757,7 +757,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 5*CMAPDIM*CMAPDIM && counter < 6*CMAPDIM*CMAPDIM) { cmapgrid[5][i6][j6] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j6++; if (j6 == CMAPDIM) { j6 = 0; diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 90cf3eee39..75eeb4a45a 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -334,9 +334,9 @@ void ImproperCvff::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->nimpropertypes,MPI_INT,0,world); diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 6327ea8b06..159574a12d 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -275,8 +275,8 @@ void ImproperHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 7b2c4e0b09..7a7c07ab02 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -316,9 +316,9 @@ void ImproperUmbrella::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 6d9c851422..307fe37728 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -50,7 +50,7 @@ PairHbondDreidingLJ::PairHbondDreidingLJ(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nparams = maxparam = 0; - params = NULL; + params = nullptr; nextra = 2; pvector = new double[2]; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index dea6bd6251..9b3805a8b6 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -375,14 +375,14 @@ void PairLJCharmmCoulCharmm::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -436,12 +436,12 @@ void PairLJCharmmCoulCharmm::write_restart_settings(FILE *fp) void PairLJCharmmCoulCharmm::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -523,5 +523,5 @@ void *PairLJCharmmCoulCharmm::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"implicit") == 0) return (void *) &implicit; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 31083312a9..c311c76f55 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -433,14 +433,14 @@ void PairLJCharmmfswCoulCharmmfsh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -470,11 +470,11 @@ void PairLJCharmmfswCoulCharmmfsh::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulCharmmfsh::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -560,5 +560,5 @@ void *PairLJCharmmfswCoulCharmmfsh::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index b5ed255789..d8ab817e7d 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -43,8 +43,8 @@ PairLJCutTIP4PCut::PairLJCutTIP4PCut(LAMMPS *lmp) : Pair(lmp) writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -494,9 +494,9 @@ void PairLJCutTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -618,13 +618,13 @@ void PairLJCutTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -660,17 +660,17 @@ void PairLJCutTIP4PCut::write_restart_settings(FILE *fp) void PairLJCutTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -740,7 +740,7 @@ void *PairLJCutTIP4PCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- memory usage of hneigh diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 8d8f5ec78e..7757e96496 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -39,8 +39,8 @@ PairTIP4PCut::PairTIP4PCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -423,9 +423,9 @@ void PairTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -475,7 +475,7 @@ void PairTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -502,13 +502,13 @@ void PairTIP4PCut::write_restart_settings(FILE *fp) void PairTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 62d940af37..812cec21a3 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -186,7 +186,7 @@ void DumpAtomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 6d5fc3da8e..f598f25998 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -207,7 +207,7 @@ void DumpCFGMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index b623df82d0..065b04801e 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -202,7 +202,7 @@ void DumpCustomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -247,8 +247,8 @@ void DumpCustomMPIIO::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index 139245e4b0..959a454103 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -198,7 +198,7 @@ void DumpXYZMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -239,7 +239,7 @@ void DumpXYZMPIIO::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index 29d6d550e4..650c25cd4d 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -65,7 +65,7 @@ FixMSCG::FixMSCG(LAMMPS *lmp, int narg, char **arg) : nframes = n_frames = block_size = 0; range_flag = 0; name_flag = 0; - f = NULL; + f = nullptr; type_names = new char*[natoms]; for (int i = 0; i < natoms; i++) type_names[i] = new char[24]; diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 8bea52f1cf..9e4c886900 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDamageAtom::ComputeDamageAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), damage(NULL) + Compute(lmp, narg, arg), damage(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute damage/atom command"); diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 65a25cda03..bf8d345f29 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -43,7 +43,7 @@ ComputeDilatationAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dilatation = NULL; + dilatation = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index d90e211506..5d0d554986 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -44,7 +44,7 @@ ComputePlasticityAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - plasticity = NULL; + plasticity = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 2950381197..d741aca856 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -56,15 +56,15 @@ FixPeriNeigh::FixPeriNeigh(LAMMPS *lmp,int narg, char **arg) : // set maxpartner = 1 as placeholder maxpartner = 1; - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; - vinter = NULL; - wvolume = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; + vinter = nullptr; + wvolume = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -228,13 +228,13 @@ void FixPeriNeigh::setup(int /*vflag*/) memory->destroy(r0); memory->destroy(npartner); - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; grow_arrays(atom->nmax); // create partner list and r0 values from neighbor list @@ -301,9 +301,9 @@ void FixPeriNeigh::setup(int /*vflag*/) double **x0 = atom->x0; double half_lc = 0.5*(domain->lattice->xlattice); double vfrac_scale; - PairPeriLPS *pairlps = NULL; - PairPeriVES *pairves = NULL; - PairPeriEPS *paireps = NULL; + PairPeriLPS *pairlps = nullptr; + PairPeriVES *pairves = nullptr; + PairPeriEPS *paireps = nullptr; if (isLPS) pairlps = static_cast(anypair); else if (isVES) diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 0e5760ac8d..c6f3c1ada5 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -47,14 +47,14 @@ PairPeriEPS::PairPeriEPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = -1; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_yieldstress = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_yieldstress = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -219,7 +219,7 @@ void PairPeriEPS::compute(int eflag, int vflag) // ******** temp array to store Plastic extension *********** /// // create on heap to reduce stack use and to allow for faster zeroing - double **deviatorPlasticExtTemp = NULL; + double **deviatorPlasticExtTemp = nullptr; if (nlocal*maxpartner > 0) { memory->create(deviatorPlasticExtTemp,nlocal,maxpartner,"pair:plastext"); memset(&(deviatorPlasticExtTemp[0][0]),0,sizeof(double)*nlocal*maxpartner); @@ -505,7 +505,7 @@ void PairPeriEPS::init_style() if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -559,16 +559,16 @@ void PairPeriEPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index b60f28d9f1..65f43ad669 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -45,13 +45,13 @@ PairPeriLPS::PairPeriLPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -481,15 +481,15 @@ void PairPeriLPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 5d6973a915..f29671a421 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -44,12 +44,12 @@ PairPeriPMB::PairPeriPMB(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; + s0_new = nullptr; - kspring = NULL; - s00 = NULL; - alpha = NULL; - cut = NULL; + kspring = nullptr; + s00 = nullptr; + alpha = nullptr; + cut = nullptr; } /* ---------------------------------------------------------------------- */ @@ -410,14 +410,14 @@ void PairPeriPMB::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&kspring[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&s00[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index 93c980702b..ff131eae53 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -45,15 +45,15 @@ PairPeriVES::PairPeriVES(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_lambdai = NULL; - m_taubi = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_lambdai = nullptr; + m_taubi = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -484,7 +484,7 @@ void PairPeriVES::init_style() if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -539,17 +539,17 @@ void PairPeriVES::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 12dc59c286..6dadb2866e 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -62,12 +62,12 @@ static const char cite_fix_poems[] = ------------------------------------------------------------------------- */ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), natom2body(NULL), - atom2body(NULL), displace(NULL), nrigid(NULL), masstotal(NULL), - xcm(NULL), vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), sum(NULL), all(NULL), jointbody(NULL), - xjoint(NULL), freelist(NULL), poems(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), natom2body(nullptr), + atom2body(nullptr), displace(nullptr), nrigid(nullptr), masstotal(nullptr), + xcm(nullptr), vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), sum(nullptr), all(nullptr), jointbody(nullptr), + xjoint(nullptr), freelist(nullptr), poems(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_poems); @@ -84,9 +84,9 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with atom class - natom2body = NULL; - atom2body = NULL; - displace = NULL; + natom2body = nullptr; + atom2body = nullptr; + displace = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -944,7 +944,7 @@ void FixPOEMS::readfile(char *file) if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix poems file %s",file); error->one(FLERR,str); @@ -952,7 +952,7 @@ void FixPOEMS::readfile(char *file) } nbody = 0; - char *line = NULL; + char *line = nullptr; int maxline = 0; char *ptr; int nlocal = atom->nlocal; @@ -965,10 +965,10 @@ void FixPOEMS::readfile(char *file) MPI_Bcast(line,nlen,MPI_CHAR,0,world); ptr = strtok(line," ,\t\n\0"); - if (ptr == NULL || ptr[0] == '#') continue; - ptr = strtok(NULL," ,\t\n\0"); + if (ptr == nullptr || ptr[0] == '#') continue; + ptr = strtok(nullptr," ,\t\n\0"); - while ((ptr = strtok(NULL," ,\t\n\0"))) { + while ((ptr = strtok(nullptr," ,\t\n\0"))) { id = atoi(ptr); i = atom->map(id); if (i < 0 || i >= nlocal) continue; @@ -995,7 +995,7 @@ int FixPOEMS::readline(FILE *fp, char **pline, int *pmaxline) maxline += DELTA; memory->grow(line,maxline,"fix_poems:line"); } - if (fgets(&line[n],maxline-n,fp) == NULL) { + if (fgets(&line[n],maxline-n,fp) == nullptr) { n = 0; break; } @@ -1030,7 +1030,7 @@ void FixPOEMS::jointbuild() mjoint += natom2body[i]-1; } - tagint **mylist = NULL; + tagint **mylist = nullptr; if (mjoint) memory->create(mylist,mjoint,3,"poems:mylist"); mjoint = 0; @@ -1047,7 +1047,7 @@ void FixPOEMS::jointbuild() // jlist = mylist concatenated across all procs via MPI_Allgatherv MPI_Allreduce(&mjoint,&njoint,1,MPI_INT,MPI_SUM,world); - tagint **jlist = NULL; + tagint **jlist = nullptr; if (njoint) memory->create(jlist,njoint,3,"poems:jlist"); int nprocs; @@ -1069,7 +1069,7 @@ void FixPOEMS::jointbuild() MPI_Allgatherv(mylist[0],3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); else - MPI_Allgatherv(NULL,3*mjoint,MPI_LMP_TAGINT,jlist[0], + MPI_Allgatherv(nullptr,3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); } @@ -1107,9 +1107,9 @@ void FixPOEMS::jointbuild() // each proc sets myjoint if it owns joint atom // MPI_Allreduce gives all procs the xjoint coords - jointbody = NULL; - xjoint = NULL; - double **myjoint = NULL; + jointbody = nullptr; + xjoint = nullptr; + double **myjoint = nullptr; if (njoint) { memory->create(jointbody,njoint,2,"poems:jointbody"); memory->create(xjoint,njoint,3,"poems:xjoint"); @@ -1146,7 +1146,7 @@ void FixPOEMS::jointbuild() for (i = 0; i < nbody; i++) if (mark[i]) nfree++; if (nfree) freelist = new int[nfree]; - else freelist = NULL; + else freelist = nullptr; nfree = 0; for (i = 0; i < nbody; i++) if (mark[i]) freelist[nfree++] = i + 1; diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index 53bde5e804..6aec1d785a 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -37,7 +37,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : python->init(); - py_move = NULL; + py_move = nullptr; PyGILState_STATE gstate = PyGILState_Ensure(); @@ -50,7 +50,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : char * full_cls_name = arg[3]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Fix python/integrate requires fully qualified class name"); } @@ -138,7 +138,7 @@ void FixPythonMove::init() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'init' method'"); } - PyObject * result = PyEval_CallObject(py_init, NULL); + PyObject * result = PyEval_CallObject(py_init, nullptr); PyGILState_Release(gstate); } @@ -174,7 +174,7 @@ void FixPythonMove::final_integrate() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'final_integrate' method'"); } - PyObject * result = PyEval_CallObject(py_final_integrate, NULL); + PyObject * result = PyEval_CallObject(py_final_integrate, nullptr); PyGILState_Release(gstate); } @@ -229,6 +229,6 @@ void FixPythonMove::reset_dt() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'reset_dt' method'"); } - PyObject * result = PyEval_CallObject(py_reset_dt, NULL); + PyObject * result = PyEval_CallObject(py_reset_dt, nullptr); PyGILState_Release(gstate); } diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 074de2f39a..e24daf3116 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -43,8 +43,8 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { cut_global = 0.0; centroidstressflag = 1; - py_potential = NULL; - skip_types = NULL; + py_potential = nullptr; + skip_types = nullptr; python->init(); @@ -54,7 +54,7 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { // if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well const char * potentials_path = getenv("LAMMPS_POTENTIALS"); - if (potentials_path != NULL) { + if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); } } @@ -259,7 +259,7 @@ void PairPython::coeff(int narg, char **arg) char * full_cls_name = arg[2]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Python pair style requires fully qualified class name"); } @@ -297,7 +297,7 @@ void PairPython::coeff(int narg, char **arg) delete [] module_name; delete [] cls_name; - PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, NULL); + PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, nullptr); if (!py_pair_instance) { PyErr_Print(); PyErr_Clear(); diff --git a/src/PYTHON/python_compat.h b/src/PYTHON/python_compat.h index effac81cef..97946349b2 100644 --- a/src/PYTHON/python_compat.h +++ b/src/PYTHON/python_compat.h @@ -21,14 +21,14 @@ #define PY_INT_FROM_LONG(X) PyInt_FromLong(X) #define PY_INT_AS_LONG(X) PyInt_AsLong(X) #define PY_STRING_FROM_STRING(X) PyString_FromString(X) -#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, NULL) +#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, nullptr) #define PY_STRING_AS_STRING(X) PyString_AsString(X) #elif PY_MAJOR_VERSION == 3 #define PY_INT_FROM_LONG(X) PyLong_FromLong(X) #define PY_INT_AS_LONG(X) PyLong_AsLong(X) #define PY_STRING_FROM_STRING(X) PyUnicode_FromString(X) -#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, NULL, NULL) +#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, nullptr, nullptr) #define PY_STRING_AS_STRING(X) PyUnicode_AsUTF8(X) #endif diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index cb35cba85a..5a94d33e98 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -38,15 +38,15 @@ enum{NONE,INT,DOUBLE,STRING,PTR}; PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) { ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; // pfuncs stores interface info for each Python function nfunc = 0; - pfuncs = NULL; + pfuncs = nullptr; // one-time initialization of Python interpreter // pyMain stores pointer to main module @@ -104,7 +104,7 @@ void PythonImpl::command(int narg, char **arg) int ifunc = find(arg[0]); if (ifunc < 0) error->all(FLERR,"Python invoke of undefined function"); - char *str = NULL; + char *str = nullptr; if (noutput) { str = input->variable->pythonstyle(pfuncs[ifunc].ovarname, pfuncs[ifunc].name); @@ -122,7 +122,7 @@ void PythonImpl::command(int narg, char **arg) int err; FILE *fp = fopen(arg[2],"r"); - if (fp == NULL) + if (fp == nullptr) err = execute_string(arg[2]); else err = execute_file(arg[2]); @@ -136,12 +136,12 @@ void PythonImpl::command(int narg, char **arg) // parse optional args, invoke is not allowed in this mode ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; - char *pyfile = NULL; - char *herestr = NULL; + char *pyfile = nullptr; + char *herestr = nullptr; int existflag = 0; int iarg = 1; @@ -206,7 +206,7 @@ void PythonImpl::command(int narg, char **arg) if (pyfile) { FILE *fp = fopen(pyfile,"r"); - if (fp == NULL) { + if (fp == nullptr) { PyGILState_Release(gstate); error->all(FLERR,"Could not open Python file"); } @@ -422,7 +422,7 @@ int PythonImpl::create_entry(char *name) pfuncs[ifunc].svalue = new char*[ninput]; for (int i = 0; i < ninput; i++) { - pfuncs[ifunc].svalue[i] = NULL; + pfuncs[ifunc].svalue[i] = nullptr; char type = format[i]; if (type == 'i') { pfuncs[ifunc].itype[i] = INT; @@ -470,8 +470,8 @@ int PythonImpl::create_entry(char *name) // process output as value or variable - pfuncs[ifunc].ovarname = NULL; - pfuncs[ifunc].longstr = NULL; + pfuncs[ifunc].ovarname = nullptr; + pfuncs[ifunc].longstr = nullptr; if (!noutput) return ifunc; char type = format[ninput]; @@ -512,7 +512,7 @@ int PythonImpl::execute_string(char *cmd) int PythonImpl::execute_file(char *fname) { FILE *fp = fopen(fname,"r"); - if (fp == NULL) return -1; + if (fp == nullptr) return -1; PyGILState_STATE gstate = PyGILState_Ensure(); int err = PyRun_SimpleFile(fp,fname); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 5cadce617f..9f8b6c3442 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -37,11 +37,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), list(NULL), chi(NULL), eta(NULL), - gamma(NULL), zeta(NULL), zcore(NULL), chizj(NULL), shld(NULL), - s(NULL), t(NULL), s_hist(NULL), t_hist(NULL), Hdia_inv(NULL), b_s(NULL), - b_t(NULL), p(NULL), q(NULL), r(NULL), d(NULL), - qf(NULL), q1(NULL), q2(NULL), qv(NULL) + Fix(lmp, narg, arg), list(nullptr), chi(nullptr), eta(nullptr), + gamma(nullptr), zeta(nullptr), zcore(nullptr), chizj(nullptr), shld(nullptr), + s(nullptr), t(nullptr), s_hist(nullptr), t_hist(nullptr), Hdia_inv(nullptr), b_s(nullptr), + b_t(nullptr), p(nullptr), q(nullptr), r(nullptr), d(nullptr), + qf(nullptr), q1(nullptr), q2(nullptr), qv(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); @@ -58,48 +58,48 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : swa = 0.0; swb = cutoff; - shld = NULL; + shld = nullptr; nlocal = n_cap = 0; nall = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 5; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // others cutoff_sq = cutoff*cutoff; - chizj = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; + chizj = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; streitz_flag = 0; reax_flag = 0; - qv = NULL; + qv = nullptr; comm_forward = comm_reverse = 1; // perform initial allocation of atom-based arrays // register with Atom class - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -708,7 +708,7 @@ void FixQEq::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix qeq parameter file %s",file); error->one(FLERR,str); @@ -726,7 +726,7 @@ void FixQEq::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -751,7 +751,7 @@ void FixQEq::read_file(char *file) for (n=0, words[n] = strtok(line," \t\n\r\f"); n < 6; - words[++n] = strtok(NULL," \t\n\r\f")); + words[++n] = strtok(nullptr," \t\n\r\f")); utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); for (n=nlo; n <=nhi; ++n) { diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 6dcc5e9cdc..10cdc5d3ca 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -66,8 +66,8 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix qeq/fire command"); } - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 37951adb1a..306f3f61e3 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -78,12 +78,12 @@ void FixQEqShielded::init() void FixQEqShielded::extract_reax() { Pair *pair = force->pair_match("^reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair reax/c"); } diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 327a9c5b3a..7c7dc159b1 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -88,15 +88,15 @@ void FixQEqSlater::init() void FixQEqSlater::extract_streitz() { Pair *pair = force->pair_match("coul/streitz",1); - if (pair == NULL) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); + if (pair == nullptr) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); zeta = (double *) pair->extract("zeta",tmp); zcore = (double *) pair->extract("zcore",tmp); - if (chi == NULL || eta == NULL || gamma == NULL - || zeta == NULL || zcore == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr + || zeta == nullptr || zcore == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair coul/streitz"); diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 531f488e60..8efaab7c7a 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_event(NULL), fix_event(NULL) + Compute(lmp, narg, arg), id_event(nullptr), fix_event(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute event/displace command"); @@ -47,7 +47,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : // fix event ID will be set later by accelerated dynamics method - id_event = NULL; + id_event = nullptr; } /* ---------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ void ComputeEventDisplace::init() // if set by PRD, then find fix which stores original atom coords // check if it is correct style - if (id_event != NULL) { + if (id_event != nullptr) { int ifix = modify->find_fix(id_event); if (ifix < 0) error->all(FLERR, "Could not find compute event/displace fix ID"); @@ -88,7 +88,7 @@ double ComputeEventDisplace::compute_scalar() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; double event = 0.0; double **xevent = fix_event->array_atom; @@ -150,7 +150,7 @@ int ComputeEventDisplace::all_events() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; int event = 0; double **xevent = fix_event->array_atom; @@ -204,8 +204,8 @@ int ComputeEventDisplace::all_events() void ComputeEventDisplace::reset_extra_compute_fix(const char *id_new) { delete [] id_event; - id_event = NULL; - if (id_new == NULL) return; + id_event = nullptr; + if (id_new == nullptr) return; int n = strlen(id_new) + 1; id_event = new char[n]; diff --git a/src/REPLICA/fix_event.cpp b/src/REPLICA/fix_event.cpp index 41f91332cb..7e6a82bdd3 100644 --- a/src/REPLICA/fix_event.cpp +++ b/src/REPLICA/fix_event.cpp @@ -27,8 +27,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvent::FixEvent(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xevent(NULL), xold(NULL), vold(NULL), - imageold(NULL), xorig(NULL), vorig(NULL), imageorig(NULL) + Fix(lmp, narg, arg), xevent(nullptr), xold(nullptr), vold(nullptr), + imageold(nullptr), xorig(nullptr), vorig(nullptr), imageorig(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix event command"); diff --git a/src/REPLICA/fix_hyper.cpp b/src/REPLICA/fix_hyper.cpp index 472d0bbb44..733578caa1 100644 --- a/src/REPLICA/fix_hyper.cpp +++ b/src/REPLICA/fix_hyper.cpp @@ -35,6 +35,6 @@ void *FixHyper::extract(const char *str, int &dim) if (strcmp(str,"hyperflag") == 0) { return &hyperflag; } - return NULL; + return nullptr; } diff --git a/src/REPLICA/fix_hyper_global.cpp b/src/REPLICA/fix_hyper_global.cpp index f104d14c2f..abc16618c5 100644 --- a/src/REPLICA/fix_hyper_global.cpp +++ b/src/REPLICA/fix_hyper_global.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), xold(NULL), tagold(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), xold(nullptr), tagold(nullptr) { if (atom->map_style == 0) error->all(FLERR,"Fix hyper/global command requires atom map"); @@ -70,12 +70,12 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : maxbond = 0; nblocal = 0; - blist = NULL; + blist = nullptr; maxold = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; me = comm->me; firstflag = 1; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index da444bc451..2eb18a0c8a 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -47,10 +47,10 @@ enum{IGNORE,WARN,ERROR}; /* ---------------------------------------------------------------------- */ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), biascoeff(NULL), numbond(NULL), - maxhalf(NULL), eligible(NULL), maxhalfstrain(NULL), old2now(NULL), - tagold(NULL), xold(NULL), maxstrain(NULL), maxstrain_domain(NULL), - biasflag(NULL), bias(NULL), cpage(NULL), clist(NULL), numcoeff(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), biascoeff(nullptr), numbond(nullptr), + maxhalf(nullptr), eligible(nullptr), maxhalfstrain(nullptr), old2now(nullptr), + tagold(nullptr), xold(nullptr), maxstrain(nullptr), maxstrain_domain(nullptr), + biasflag(nullptr), bias(nullptr), cpage(nullptr), clist(nullptr), numcoeff(nullptr) { // error checks @@ -132,28 +132,28 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : // per-atom data structs maxbond = nblocal = 0; - blist = NULL; - biascoeff = NULL; + blist = nullptr; + biascoeff = nullptr; allbonds = 0; maxatom = 0; - maxstrain = NULL; - maxstrain_domain = NULL; - biasflag = NULL; + maxstrain = nullptr; + maxstrain_domain = nullptr; + biasflag = nullptr; maxlocal = nlocal_old = 0; - numbond = NULL; - maxhalf = NULL; - eligible = NULL; - maxhalfstrain = NULL; + numbond = nullptr; + maxhalf = nullptr; + eligible = nullptr; + maxhalfstrain = nullptr; maxall = nall_old = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; nbias = maxbias = 0; - bias = NULL; + bias = nullptr; // data structs for persisting bias coeffs when bond list is reformed // maxbondperatom = max # of bonds any atom is part of @@ -162,8 +162,8 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : maxcoeff = 0; maxbondperatom = FCCBONDS; - numcoeff = NULL; - clist = NULL; + numcoeff = nullptr; + clist = nullptr; cpage = new MyPage; cpage->init(maxbondperatom,1024*maxbondperatom,1); @@ -983,7 +983,7 @@ void FixHyperLocal::build_bond_list(int natom) while (1) { if (firstflag) break; for (i = 0; i < nall; i++) numcoeff[i] = 0; - for (i = 0; i < nall; i++) clist[i] = NULL; + for (i = 0; i < nall; i++) clist[i] = nullptr; cpage->reset(); for (m = 0; m < nblocal; m++) { diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index b8fd0f6442..a739ec754c 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -45,12 +45,12 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), xnext(NULL), - fnext(NULL), springF(NULL), tangent(NULL), xsend(NULL), xrecv(NULL), - fsend(NULL), frecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), - tagsendall(NULL), tagrecvall(NULL), counts(NULL), - displacements(NULL) + id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), xnext(nullptr), + fnext(nullptr), springF(nullptr), tangent(nullptr), xsend(nullptr), xrecv(nullptr), + fsend(nullptr), frecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), + tagsendall(nullptr), tagrecvall(nullptr), counts(nullptr), + displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb command"); @@ -237,7 +237,7 @@ void FixNEB::init() if (atom->nmax > maxlocal) reallocate(); - if ((cmode == MULTI_PROC) && (counts == NULL)) { + if ((cmode == MULTI_PROC) && (counts == nullptr)) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -785,9 +785,9 @@ void FixNEB::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index 6c4cba4ab8..b015839f64 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -38,7 +38,7 @@ enum{NOHYPER,GLOBAL,LOCAL}; /* ---------------------------------------------------------------------- */ -Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(NULL) {} +Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(nullptr) {} /* ---------------------------------------------------------------------- perform hyperdynamics simulation @@ -91,7 +91,7 @@ void Hyper::command(int narg, char **arg) fix_hyper = (FixHyper *) modify->fix[ifix]; int dim; int *hyperflag = (int *) fix_hyper->extract("hyperflag",dim); - if (hyperflag == NULL || *hyperflag == 0) + if (hyperflag == nullptr || *hyperflag == 0) error->all(FLERR,"Hyper fix is not a valid hyperdynamics fix"); if (*hyperflag == 1) hyperstyle = GLOBAL; if (*hyperflag == 2) hyperstyle = LOCAL; @@ -353,7 +353,7 @@ void Hyper::command(int narg, char **arg) delete finish; modify->delete_fix("hyper_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -449,7 +449,7 @@ void Hyper::options(int narg, char **arg) maxeval = 50; dumpflag = 0; ndump = 0; - dumplist = NULL; + dumplist = nullptr; rebond = 0; int iarg = 0; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 2d1dd6eea7..31ce61f4c2 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -391,7 +391,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -407,7 +407,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -460,7 +460,7 @@ void NEB::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust atom coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -561,7 +561,7 @@ void NEB::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index cdb1eb9b02..6417141151 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -117,9 +117,9 @@ void PRD::command(int narg, char **arg) natoms = atom->natoms; - tagall = NULL; - xall = NULL; - imageall = NULL; + tagall = nullptr; + xall = nullptr; + imageall = nullptr; if (cmode != SINGLE_PROC_DIRECT) { memory->create(tagall,natoms,"prd:tagall"); @@ -127,8 +127,8 @@ void PRD::command(int narg, char **arg) memory->create(imageall,natoms,"prd:imageall"); } - counts = NULL; - displacements = NULL; + counts = nullptr; + displacements = nullptr; if (cmode == MULTI_PROC) { memory->create(counts,nprocs,"prd:counts"); @@ -465,7 +465,7 @@ void PRD::command(int narg, char **arg) modify->delete_compute("prd_temp"); modify->delete_fix("prd_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -908,16 +908,16 @@ void PRD::options(int narg, char **arg) delete [] loop_setting; delete [] dist_setting; - if (strcmp(arg[iarg+1],"all") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = NULL; + if (strcmp(arg[iarg+1],"all") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = nullptr; else error->all(FLERR,"Illegal prd command"); int n = strlen(arg[iarg+1]) + 1; loop_setting = new char[n]; strcpy(loop_setting,arg[iarg+1]); - if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = NULL; - else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = NULL; + if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = nullptr; + else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = nullptr; else error->all(FLERR,"Illegal prd command"); n = strlen(arg[iarg+2]) + 1; dist_setting = new char[n]; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index db74b63c35..3deda0c506 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -50,7 +50,7 @@ TAD::TAD(LAMMPS *lmp) : Pointers(lmp) {} TAD::~TAD() { memory->sfree(fix_event_list); - if (neb_logfilename != NULL) delete [] neb_logfilename; + if (neb_logfilename != nullptr) delete [] neb_logfilename; delete [] min_style; delete [] min_style_neb; } @@ -62,7 +62,7 @@ TAD::~TAD() void TAD::command(int narg, char **arg) { - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; nmin_event_list = 10; @@ -226,8 +226,8 @@ void TAD::command(int narg, char **arg) ulogfile_lammps = universe->ulogfile; uscreen_lammps = universe->uscreen; - ulogfile_neb = NULL; - uscreen_neb = NULL; + ulogfile_neb = nullptr; + uscreen_neb = nullptr; if (me_universe == 0 && neb_logfilename) ulogfile_neb = fopen(neb_logfilename,"w"); @@ -421,7 +421,7 @@ void TAD::command(int narg, char **arg) modify->delete_fix("tad_revert"); delete_event_list(); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -586,7 +586,7 @@ void TAD::options(int narg, char **arg) min_style_neb = new char[n]; strcpy(min_style_neb,"quickmin"); dt_neb = update->dt; - neb_logfilename = NULL; + neb_logfilename = nullptr; int iarg = 0; while (iarg < narg) { @@ -630,7 +630,7 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb_log") == 0) { delete [] neb_logfilename; if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); - if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = NULL; + if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = nullptr; else { int n = strlen(arg[iarg+1]) + 1; neb_logfilename = new char[n]; @@ -885,7 +885,7 @@ void TAD::delete_event_list() { modify->delete_fix(str); } memory->sfree(fix_event_list); - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 0cce389bf0..0d15be2aa6 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -147,7 +147,7 @@ void Temper::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index a5ed1a671d..f6a8f59944 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : - Verlet(lmp, narg, arg), qsize(NULL), qdisp(NULL), xsize(NULL), xdisp(NULL), f_kspace(NULL) + Verlet(lmp, narg, arg), qsize(nullptr), qdisp(nullptr), xsize(nullptr), xdisp(nullptr), f_kspace(nullptr) { // error checks on partitions @@ -194,7 +194,7 @@ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : // allocate dummy version for Kspace partition maxatom = 0; - f_kspace = NULL; + f_kspace = nullptr; if (!master) memory->create(f_kspace,1,1,"verlet/split:f_kspace"); } @@ -289,7 +289,7 @@ void VerletSplit::run(int n) Fix *fix_omp; int ifix = modify->find_fix("package_omp"); - if (ifix < 0) fix_omp = NULL; + if (ifix < 0) fix_omp = nullptr; else fix_omp = modify->fix[ifix]; // flags for timestepping iterations diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index e15c0deb82..43e636963f 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute erotate/rigid command"); diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index 031919b7a9..6ce4440d05 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute ke/rigid command"); diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index 57f69a64e2..c100db82e8 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -33,7 +33,7 @@ enum{ID,MOL,MASS,X,Y,Z,XU,YU,ZU,VX,VY,VZ,FX,FY,FZ,IX,IY,IZ, ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rstyle(NULL), idrigid(NULL), fixrigid(NULL), vlocal(NULL), alocal(NULL) + rstyle(nullptr), idrigid(nullptr), fixrigid(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute rigid/local command"); @@ -89,8 +89,8 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; ncount = nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,8 +115,8 @@ void ComputeRigidLocal::init() fixrigid = (FixRigidSmall *) modify->fix[ifix]; int flag = 0; - if (strstr(fixrigid->style,"rigid/") == NULL) flag = 1; - if (strstr(fixrigid->style,"/small") == NULL) flag = 1; + if (strstr(fixrigid->style,"rigid/") == nullptr) flag = 1; + if (strstr(fixrigid->style,"/small") == nullptr) flag = 1; if (flag) error->all(FLERR,"Compute rigid/local does not use fix rigid/small fix"); diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 03b79cc750..6b283b2f85 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -45,8 +45,8 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), x(NULL), f(NULL), v(NULL), - mass(NULL), rmass(NULL), type(NULL), scalingmask(NULL) + idregion(nullptr), x(nullptr), f(nullptr), v(nullptr), + mass(nullptr), rmass(nullptr), type(nullptr), scalingmask(nullptr) { MPI_Comm_rank(world, &me); @@ -127,7 +127,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), error->all(FLERR, "You can only use the keyword 'com' together with the keyword 'constrain' "); scale = 1.0; - scalingmask = NULL; + scalingmask = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -177,7 +177,7 @@ void FixEHEX::init() if (group->count(igroup) == 0) error->all(FLERR,"Fix ehex group has no atoms"); - fshake = NULL; + fshake = nullptr; if (constraints) { // check if constraining algorithm is used (FixRattle inherits from FixShake) @@ -335,7 +335,7 @@ void FixEHEX::update_scalingmask() { // prematch region - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -354,7 +354,7 @@ void FixEHEX::update_scalingmask() { m = fshake->list[i]; // check if the centre of mass of the cluster is inside the region - // if region == NULL, just check the group information of all sites + // if region == nullptr, just check the group information of all sites if (fshake->shake_flag[m] == 1) nsites = 3; else if (fshake->shake_flag[m] == 2) nsites = 2; diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index 436b2191ff..07787bcbfe 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -59,7 +59,7 @@ FixRattle::FixRattle(LAMMPS *lmp, int narg, char **arg) : // allocate memory for unconstrained velocity update - vp = NULL; + vp = nullptr; grow_arrays(atom->nmax); // default communication mode diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index f74cce8233..c40c3b13d8 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -46,16 +46,16 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL), - body(NULL), displace(NULL), masstotal(NULL), xcm(NULL), - vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), quat(NULL), imagebody(NULL), fflag(NULL), - tflag(NULL), langextra(NULL), sum(NULL), all(NULL), - remapflag(NULL), xcmimage(NULL), eflags(NULL), orient(NULL), - dorient(NULL), id_dilate(NULL), id_gravity(NULL), random(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), nrigid(nullptr), mol2body(nullptr), body2mol(nullptr), + body(nullptr), displace(nullptr), masstotal(nullptr), xcm(nullptr), + vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), quat(nullptr), imagebody(nullptr), fflag(nullptr), + tflag(nullptr), langextra(nullptr), sum(nullptr), all(nullptr), + remapflag(nullptr), xcmimage(nullptr), eflags(nullptr), orient(nullptr), + dorient(nullptr), id_dilate(nullptr), id_gravity(nullptr), random(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr) { int i,ibody; @@ -76,12 +76,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = 0; - body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -91,8 +91,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix rigid command"); int iarg; - mol2body = NULL; - body2mol = NULL; + mol2body = nullptr; + body2mol = nullptr; // single rigid body // nbody = 1 @@ -322,9 +322,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : t_order = 3; p_chain = 10; - inpfile = NULL; - id_gravity = NULL; - id_dilate = NULL; + inpfile = nullptr; + id_gravity = nullptr; + id_dilate = nullptr; pcouple = NONE; pstyle = ANISO; @@ -567,7 +567,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed if (langflag) random = new RanMars(lmp,seed + me); - else random = NULL; + else random = nullptr; // initialize vector output quantities in case accessed before run @@ -1930,7 +1930,7 @@ void FixRigid::setup_bodies_static() // overwrite Cartesian inertia tensor with file values - if (inpfile) readfile(1,NULL,all,NULL,NULL,NULL,inbody); + if (inpfile) readfile(1,nullptr,all,nullptr,nullptr,nullptr,inbody); // diagonalize inertia tensor for each body via Jacobi rotations // inertia = 3 eigenvalues = principal moments of inertia @@ -2281,12 +2281,12 @@ void FixRigid::readfile(int which, double *vec, if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of fix rigid file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -2327,7 +2327,7 @@ void FixRigid::readfile(int which, double *vec, values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = atoi(values[0]); if (rstyle == MOLECULE) { @@ -2390,7 +2390,7 @@ void FixRigid::write_restart_file(const char *file) auto outfile = std::string(file) + ".rigid"; FILE *fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -2711,7 +2711,7 @@ void *FixRigid::extract(const char *str, int &dim) return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 1df7f34532..0aa5f99765 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -42,12 +42,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : - FixRigid(lmp, narg, arg), conjqm(NULL), w(NULL), - wdti1(NULL), wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), - eta_t(NULL), eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), - f_eta_t(NULL), f_eta_r(NULL), q_b(NULL), eta_b(NULL), - eta_dot_b(NULL), f_eta_b(NULL), rfix(NULL), id_temp(NULL), - id_press(NULL), temperature(NULL), pressure(NULL) + FixRigid(lmp, narg, arg), conjqm(nullptr), w(nullptr), + wdti1(nullptr), wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), + eta_t(nullptr), eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), + f_eta_t(nullptr), f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), + eta_dot_b(nullptr), f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), + id_press(nullptr), temperature(nullptr), pressure(nullptr) { // error checks: could be moved up to FixRigid @@ -145,7 +145,7 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -153,8 +153,8 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -304,7 +304,7 @@ void FixRigidNH::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index d1204e2bbc..b599868ecd 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -44,12 +44,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : - FixRigidSmall(lmp, narg, arg), w(NULL), wdti1(NULL), - wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), eta_t(NULL), - eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), f_eta_t(NULL), - f_eta_r(NULL), q_b(NULL), eta_b(NULL), eta_dot_b(NULL), - f_eta_b(NULL), rfix(NULL), id_temp(NULL), id_press(NULL), - temperature(NULL), pressure(NULL) + FixRigidSmall(lmp, narg, arg), w(nullptr), wdti1(nullptr), + wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), eta_t(nullptr), + eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), f_eta_t(nullptr), + f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), eta_dot_b(nullptr), + f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), id_press(nullptr), + temperature(nullptr), pressure(nullptr) { // error checks @@ -159,7 +159,7 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -167,8 +167,8 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -301,7 +301,7 @@ void FixRigidNHSmall::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 85cadc826e..e7f67ab2b4 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -54,12 +54,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL), - xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL), - itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL), - id_dilate(NULL), id_gravity(NULL), onemols(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), body(nullptr), bodyown(nullptr), bodytag(nullptr), atom2body(nullptr), + xcmimage(nullptr), displace(nullptr), eflags(nullptr), orient(nullptr), dorient(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr), counts(nullptr), + itensor(nullptr), mass_body(nullptr), langextra(nullptr), random(nullptr), + id_dilate(nullptr), id_gravity(nullptr), onemols(nullptr) { int i; @@ -82,21 +82,21 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = customflag = 0; - bodyown = NULL; - bodytag = NULL; - atom2body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + bodyown = nullptr; + bodytag = nullptr; + atom2body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); // parse args for rigid body specification int *mask = atom->mask; - tagint *bodyID = NULL; + tagint *bodyID = nullptr; int nlocal = atom->nlocal; if (narg < 4) error->all(FLERR,"Illegal fix rigid/small command"); @@ -178,14 +178,14 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : int seed; langflag = 0; - inpfile = NULL; - onemols = NULL; + inpfile = nullptr; + onemols = nullptr; reinitflag = 1; tstat_flag = 0; pstat_flag = 0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; t_chain = 10; t_iter = 1; t_order = 3; @@ -477,13 +477,13 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed maxlang = 0; - langextra = NULL; - random = NULL; + langextra = nullptr; + random = nullptr; if (langflag) random = new RanMars(lmp,seed + comm->me); // mass vector for granular pair styles - mass_body = NULL; + mass_body = nullptr; nmax_mass = 0; // wait to setup bodies until comm stencils are defined @@ -1965,7 +1965,7 @@ void FixRigidSmall::setup_bodies_static() if (inpfile) { memory->create(inbody,nlocal_body,"rigid/small:inbody"); for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0; - readfile(0,NULL,inbody); + readfile(0,nullptr,inbody); } // remap the xcm of each body back into simulation box @@ -2445,12 +2445,12 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid/small file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid/small file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; @@ -2490,7 +2490,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = ATOTAGINT(values[0]); if (id <= 0 || id > maxmol) @@ -2559,7 +2559,7 @@ void FixRigidSmall::write_restart_file(const char *file) if (me == 0) { auto outfile = std::string(file) + ".rigid"; fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -3432,7 +3432,7 @@ void *FixRigidSmall::extract(const char *str, int &dim) return mass_body; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index ee88f57341..c4b0c68f3e 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -47,16 +47,16 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), bond_flag(NULL), angle_flag(NULL), - type_flag(NULL), mass_list(NULL), bond_distance(NULL), angle_distance(NULL), - loop_respa(NULL), step_respa(NULL), x(NULL), v(NULL), f(NULL), ftmp(NULL), - vtmp(NULL), mass(NULL), rmass(NULL), type(NULL), shake_flag(NULL), - shake_atom(NULL), shake_type(NULL), xshake(NULL), nshake(NULL), - list(NULL), b_count(NULL), b_count_all(NULL), b_ave(NULL), b_max(NULL), - b_min(NULL), b_ave_all(NULL), b_max_all(NULL), b_min_all(NULL), - a_count(NULL), a_count_all(NULL), a_ave(NULL), a_max(NULL), a_min(NULL), - a_ave_all(NULL), a_max_all(NULL), a_min_all(NULL), atommols(NULL), - onemols(NULL) + Fix(lmp, narg, arg), bond_flag(nullptr), angle_flag(nullptr), + type_flag(nullptr), mass_list(nullptr), bond_distance(nullptr), angle_distance(nullptr), + loop_respa(nullptr), step_respa(nullptr), x(nullptr), v(nullptr), f(nullptr), ftmp(nullptr), + vtmp(nullptr), mass(nullptr), rmass(nullptr), type(nullptr), shake_flag(nullptr), + shake_atom(nullptr), shake_type(nullptr), xshake(nullptr), nshake(nullptr), + list(nullptr), b_count(nullptr), b_count_all(nullptr), b_ave(nullptr), b_max(nullptr), + b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), + a_count(nullptr), a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), + a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), + onemols(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -76,13 +76,13 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; - xshake = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; + xshake = nullptr; - ftmp = NULL; - vtmp = NULL; + ftmp = nullptr; + vtmp = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -161,7 +161,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // parse optional args - onemols = NULL; + onemols = nullptr; int iarg = next; while (iarg < narg) { @@ -233,7 +233,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // initialize list of SHAKE clusters to constrain maxlist = 0; - list = NULL; + list = nullptr; } /* ---------------------------------------------------------------------- */ @@ -367,7 +367,7 @@ void FixShake::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for SHAKE"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -378,7 +378,7 @@ void FixShake::init() for (i = 1; i <= atom->nangletypes; i++) { if (angle_flag[i] == 0) continue; - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle potential must be defined for SHAKE"); // scan all atoms for a SHAKE angle cluster @@ -2976,7 +2976,7 @@ void *FixShake::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"onemol") == 0) return onemols; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 509e45202c..3061962105 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -35,8 +35,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomx(NULL), randomt(NULL), basistype(NULL), - spatialid(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomx(nullptr), randomt(nullptr), basistype(nullptr), + spatialid(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; @@ -48,7 +48,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : scaleflag = 1; spatflag=0; - spatialid = NULL; + spatialid = nullptr; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; tempflag = 0; @@ -58,8 +58,8 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : rany = 0.0; ranz = 0.0; - randomx = NULL; - randomt = NULL; + randomx = nullptr; + randomt = nullptr; if (domain->lattice->nbasis == 0) error->all(FLERR,"Fix append/atoms requires a lattice be defined"); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 3930133221..1b2e73726b 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -41,9 +41,9 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), old_velocity(NULL), rfix(NULL), - id_temp(NULL), id_press(NULL), id_pe(NULL), temperature(NULL), - pressure(NULL), pe(NULL) + Fix(lmp, narg, arg), old_velocity(nullptr), rfix(nullptr), + id_temp(nullptr), id_press(nullptr), id_pe(nullptr), temperature(nullptr), + pressure(nullptr), pe(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix msst command"); @@ -206,10 +206,10 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : omega[0] = omega[1] = omega[2] = 0.0; nrigid = 0; - rfix = NULL; + rfix = nullptr; maxold = -1; - old_velocity = NULL; + old_velocity = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,7 +246,7 @@ int FixMSST::setmask() void FixMSST::init() { - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); // set compute ptrs @@ -287,7 +287,7 @@ void FixMSST::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^rigid") || @@ -306,7 +306,7 @@ void FixMSST::init() for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^external$")) fix_external = (FixExternal *) modify->fix[i]; - if (fix_external == NULL) + if (fix_external == nullptr) error->all(FLERR,"Fix msst dftb cannot be used w/out fix external"); } } diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 1179bb6b35..20fa909af2 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -30,7 +30,7 @@ enum{ISO,ANISO,TRICLINIC}; // same as fix_nh.cpp /* ---------------------------------------------------------------------- */ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), pe(NULL), id_pe(NULL) + FixNH(lmp, narg, arg), pe(nullptr), id_pe(nullptr) { // Prevent masses from being updated every timestep diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index a796c1a4b4..b375370226 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -31,15 +31,15 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomt(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomt(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; if (narg < 4) error->all(FLERR,"Illegal fix wall/piston command"); - randomt = NULL; - gfactor1 = gfactor2 = NULL; + randomt = nullptr; + gfactor1 = gfactor2 = nullptr; tempflag = 0; scaleflag = 1; roughflag = 0; diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index 37b82b86f0..66d6abfb78 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), sna(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), sna(nullptr), + radelem(nullptr), wjelem(nullptr) { double rmin0, rfac0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -145,7 +145,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - sna = NULL; + sna = nullptr; } /* ---------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ ComputeSNAAtom::~ComputeSNAAtom() void ComputeSNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute sna/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index bb546708b8..e08679a374 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snad(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snad(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -147,7 +147,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snad = NULL; + snad = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeSNADAtom::~ComputeSNADAtom() void ComputeSNADAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snad/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snap.cpp b/src/SNAP/compute_snap.cpp index ca989a75b4..5537d2c933 100644 --- a/src/SNAP/compute_snap.cpp +++ b/src/SNAP/compute_snap.cpp @@ -32,9 +32,9 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snap(NULL), - snapall(NULL), snap_peratom(NULL), radelem(NULL), wjelem(NULL), - snaptr(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snap(nullptr), + snapall(nullptr), snap_peratom(nullptr), radelem(nullptr), wjelem(nullptr), + snaptr(nullptr) { array_flag = 1; @@ -42,8 +42,8 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -180,7 +180,7 @@ ComputeSnap::~ComputeSnap() void ComputeSnap::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snap requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index dd562cac5c..cace5e532f 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -29,13 +29,13 @@ using namespace LAMMPS_NS; ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snav(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snav(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -140,7 +140,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snav = NULL; + snav = nullptr; } @@ -160,7 +160,7 @@ ComputeSNAVAtom::~ComputeSNAVAtom() void ComputeSNAVAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snav/atom requires a pair style be defined"); // TODO: Not sure what to do with this error check since cutoff radius is not // a single number diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index cb1a71aa45..e3b8fdfa98 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -42,15 +42,15 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - coeffelem = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + coeffelem = nullptr; beta_max = 0; - beta = NULL; - bispectrum = NULL; - snaptr = NULL; + beta = nullptr; + bispectrum = nullptr; + snaptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -516,7 +516,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) { + if (fpcoeff == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); error->one(FLERR,str); @@ -531,7 +531,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -556,7 +556,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); ncoeffall = atoi(words[1]); @@ -574,7 +574,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -592,9 +592,9 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); char* elemtmp = words[0]; int n = strlen(elemtmp) + 1; @@ -615,7 +615,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -663,7 +663,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) { + if (fpparam == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); error->one(FLERR,str); @@ -674,7 +674,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -697,7 +697,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); diff --git a/src/SNAP/sna.cpp b/src/SNAP/sna.cpp index e003ec7ca8..ae250c6f76 100644 --- a/src/SNAP/sna.cpp +++ b/src/SNAP/sna.cpp @@ -134,16 +134,16 @@ SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in, compute_ncoeff(); - rij = NULL; - inside = NULL; - wj = NULL; - rcutij = NULL; - element = NULL; + rij = nullptr; + inside = nullptr; + wj = nullptr; + rcutij = nullptr; + element = nullptr; nmax = 0; - idxz = NULL; - idxb = NULL; - ulist_r_ij = NULL; - ulist_i_ij = NULL; + idxz = nullptr; + idxb = nullptr; + ulist_r_ij = nullptr; + ulist_i_ij = nullptr; build_indexlist(); create_twojmax_arrays(); @@ -1332,7 +1332,7 @@ void SNA::create_twojmax_arrays() if (bzero_flag) memory->create(bzero, twojmax+1,"sna:bzero"); else - bzero = NULL; + bzero = nullptr; } diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 281100740a..32f9e73518 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -41,7 +41,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ComputeSpin::ComputeSpin(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), pair(NULL), spin_pairs(NULL) + Compute(lmp, narg, arg), pair(nullptr), spin_pairs(nullptr) { if ((narg != 3) && (narg != 4)) error->all(FLERR,"Illegal compute compute/spin command"); diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 82bf83ac10..2b3aa363f6 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_temp(NULL), random(NULL) + Fix(lmp, narg, arg), id_temp(nullptr), random(nullptr) { if (narg != 6) error->all(FLERR,"Illegal langevin/spin command"); diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp index 0b2e86e465..b2982e7bc0 100644 --- a/src/SPIN/fix_neb_spin.cpp +++ b/src/SPIN/fix_neb_spin.cpp @@ -46,13 +46,13 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; /* ---------------------------------------------------------------------- */ FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), - xnext(NULL), fnext(NULL), spprev(NULL), spnext(NULL), fmnext(NULL), springF(NULL), - tangent(NULL), xsend(NULL), xrecv(NULL), fsend(NULL), frecv(NULL), spsend(NULL), - sprecv(NULL), fmsend(NULL), fmrecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), spsendall(NULL), - sprecvall(NULL), fmsendall(NULL), fmrecvall(NULL), tagsendall(NULL), tagrecvall(NULL), - counts(NULL), displacements(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), + xnext(nullptr), fnext(nullptr), spprev(nullptr), spnext(nullptr), fmnext(nullptr), springF(nullptr), + tangent(nullptr), xsend(nullptr), xrecv(nullptr), fsend(nullptr), frecv(nullptr), spsend(nullptr), + sprecv(nullptr), fmsend(nullptr), fmrecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), spsendall(nullptr), + sprecvall(nullptr), fmsendall(nullptr), fmrecvall(nullptr), tagsendall(nullptr), tagrecvall(nullptr), + counts(nullptr), displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb_spin command"); @@ -229,7 +229,7 @@ void FixNEBSpin::init() if (atom->nmax > maxlocal) reallocate(); - if (MULTI_PROC && counts == NULL) { + if (MULTI_PROC && counts == nullptr) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -861,9 +861,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } if (spsend) { @@ -872,9 +872,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fmsend[0],3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, spsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 462a359d99..d74e82e50e 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -60,9 +60,9 @@ enum{NONE}; FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), spin_pairs(NULL), - rsec(NULL), stack_head(NULL), stack_foot(NULL), - backward_stacks(NULL), forward_stacks(NULL) + pair(nullptr), spin_pairs(nullptr), + rsec(nullptr), stack_head(nullptr), stack_foot(nullptr), + backward_stacks(nullptr), forward_stacks(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_nve_spin); diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index cbb367e438..f4dfddd3ca 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -44,7 +44,7 @@ enum{CONSTANT,EQUAL}; /* ---------------------------------------------------------------------- */ -FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(NULL) +FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(nullptr) { if (narg < 7) error->all(FLERR,"Illegal precession/spin command"); @@ -59,7 +59,7 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lm respa_level_support = 1; ilevel_respa = 0; - magstr = NULL; + magstr = nullptr; magfieldstyle = CONSTANT; H_field = 0.0; diff --git a/src/SPIN/fix_setforce_spin.cpp b/src/SPIN/fix_setforce_spin.cpp index ec738b7522..1f38ee43ec 100644 --- a/src/SPIN/fix_setforce_spin.cpp +++ b/src/SPIN/fix_setforce_spin.cpp @@ -52,7 +52,7 @@ void FixSetForceSpin::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -124,7 +124,7 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -195,7 +195,7 @@ void FixSetForceSpin::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index 4b8b745419..817c149390 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_cg[] = /* ---------------------------------------------------------------------- */ MinSpinCG::MinSpinCG(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_cg); nlocal_max = 0; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index 40029b7e71..edabcf6bbf 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_lbfgs[] = /* ---------------------------------------------------------------------- */ MinSpinLBFGS::MinSpinLBFGS(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), rho(NULL), ds(NULL), dy(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), rho(nullptr), ds(nullptr), dy(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_lbfgs); nlocal_max = 0; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index a89ca403ce..322249e02a 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -384,7 +384,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -398,7 +398,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -452,7 +452,7 @@ void NEBSpin::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust spin coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -705,7 +705,7 @@ void NEBSpin::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index b0965d1271..53dd6530bf 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -42,7 +42,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(NULL) +PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(nullptr) { hbar = force->hplanck/MY_2PI; single_enable = 0; diff --git a/src/SPIN/pair_spin.h b/src/SPIN/pair_spin.h index 8bbb27ed06..9db2bd4177 100644 --- a/src/SPIN/pair_spin.h +++ b/src/SPIN/pair_spin.h @@ -27,7 +27,7 @@ friend class FixNVESpin; virtual void coeff(int, char **) {} virtual void init_style(); virtual double init_one(int, int) {return 0.0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void compute(int, int) {} virtual void compute_single_pair(int, double *) {} diff --git a/src/SPIN/pair_spin_dipole_cut.cpp b/src/SPIN/pair_spin_dipole_cut.cpp index b27c9736b2..7444be347a 100644 --- a/src/SPIN/pair_spin_dipole_cut.cpp +++ b/src/SPIN/pair_spin_dipole_cut.cpp @@ -154,7 +154,7 @@ void *PairSpinDipoleCut::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -448,11 +448,11 @@ void PairSpinDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -477,8 +477,8 @@ void PairSpinDipoleCut::write_restart_settings(FILE *fp) void PairSpinDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dipole_long.cpp b/src/SPIN/pair_spin_dipole_long.cpp index d4b1b8e43e..28a70a047d 100644 --- a/src/SPIN/pair_spin_dipole_long.cpp +++ b/src/SPIN/pair_spin_dipole_long.cpp @@ -133,7 +133,7 @@ void PairSpinDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -174,7 +174,7 @@ void *PairSpinDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -527,11 +527,11 @@ void PairSpinDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -556,8 +556,8 @@ void PairSpinDipoleLong::write_restart_settings(FILE *fp) void PairSpinDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index e27f9fad7d..e2ddd708df 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -156,7 +156,7 @@ void *PairSpinDmi::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_dmi_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -477,18 +477,18 @@ void PairSpinDmi::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&DM[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_dmx[i][j],1,MPI_DOUBLE,0,world); @@ -522,9 +522,9 @@ void PairSpinDmi::write_restart_settings(FILE *fp) void PairSpinDmi::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_dmi_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 27da47dd0f..ba9bddb7c8 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -141,7 +141,7 @@ void *PairSpinExchange::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_exchange_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -467,15 +467,15 @@ void PairSpinExchange::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&J1_mag[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&J1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -506,9 +506,9 @@ void PairSpinExchange::write_restart_settings(FILE *fp) void PairSpinExchange::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_exchange_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 2242cf985d..849590bad2 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -149,7 +149,7 @@ void *PairSpinMagelec::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_magelec_global; - return NULL; + return nullptr; } @@ -465,15 +465,15 @@ void PairSpinMagelec::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&ME[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mex[i][j],1,MPI_DOUBLE,0,world); @@ -503,9 +503,9 @@ void PairSpinMagelec::write_restart_settings(FILE *fp) void PairSpinMagelec::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_magelec_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 33ea904c0c..1e50ee48a6 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -156,7 +156,7 @@ void *PairSpinNeel::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_neel_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -681,19 +681,19 @@ void PairSpinNeel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&g1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&g1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -727,9 +727,9 @@ void PairSpinNeel::write_restart_settings(FILE *fp) void PairSpinNeel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_neel_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 688522c1bd..50a27b5fae 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -77,12 +77,12 @@ static const char cite_fix_srd[] = /* ---------------------------------------------------------------------- */ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - wallfix(NULL), wallwhich(NULL), xwall(NULL), xwallhold(NULL), - vwall(NULL), fwall(NULL), avec_ellipsoid(NULL), avec_line(NULL), - avec_tri(NULL), random(NULL), randomshift(NULL), flocal(NULL), - tlocal(NULL), biglist(NULL), binhead(NULL), binnext(NULL), sbuf1(NULL), - sbuf2(NULL), rbuf1(NULL), rbuf2(NULL), nbinbig(NULL), binbig(NULL), - binsrd(NULL), stencil(NULL) + wallfix(nullptr), wallwhich(nullptr), xwall(nullptr), xwallhold(nullptr), + vwall(nullptr), fwall(nullptr), avec_ellipsoid(nullptr), avec_line(nullptr), + avec_tri(nullptr), random(nullptr), randomshift(nullptr), flocal(nullptr), + tlocal(nullptr), biglist(nullptr), binhead(nullptr), binnext(nullptr), sbuf1(nullptr), + sbuf2(nullptr), rbuf1(nullptr), rbuf2(nullptr), nbinbig(nullptr), binbig(nullptr), + binsrd(nullptr), stencil(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_srd); @@ -232,7 +232,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (shiftuser == SHIFT_YES || shiftuser == SHIFT_POSSIBLE) randomshift = new RanPark(lmp,shiftseed); - else randomshift = NULL; + else randomshift = nullptr; // initialize data structs and flags @@ -240,31 +240,31 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), else biggroupbit = 0; nmax = 0; - binhead = NULL; + binhead = nullptr; maxbin1 = 0; - binnext = NULL; + binnext = nullptr; maxbuf = 0; - sbuf1 = sbuf2 = rbuf1 = rbuf2 = NULL; + sbuf1 = sbuf2 = rbuf1 = rbuf2 = nullptr; shifts[0].maxvbin = shifts[1].maxvbin = 0; - shifts[0].vbin = shifts[1].vbin = NULL; + shifts[0].vbin = shifts[1].vbin = nullptr; shifts[0].maxbinsq = shifts[1].maxbinsq = 0; for (int ishift = 0; ishift < 2; ishift++) for (int iswap = 0; iswap < 6; iswap++) shifts[ishift].bcomm[iswap].sendlist = - shifts[ishift].bcomm[iswap].recvlist = NULL; + shifts[ishift].bcomm[iswap].recvlist = nullptr; maxbin2 = 0; - nbinbig = NULL; - binbig = NULL; - binsrd = NULL; + nbinbig = nullptr; + binbig = nullptr; + binsrd = nullptr; nstencil = maxstencil = 0; - stencil = NULL; + stencil = nullptr; maxbig = 0; - biglist = NULL; + biglist = nullptr; stats_flag = 1; for (int i = 0; i < size_vector; i++) stats_all[i] = 0.0; @@ -1367,7 +1367,7 @@ void FixSRD::collisions_single() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1, xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1387,7 +1387,7 @@ void FixSRD::collisions_single() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) @@ -1557,7 +1557,7 @@ void FixSRD::collisions_multi() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1,xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1576,7 +1576,7 @@ void FixSRD::collisions_multi() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index 8ffd764447..aa8a4140ab 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -34,7 +34,7 @@ enum{NONE,EDGE,CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), nwall(0), fwall(NULL), fwall_all(NULL) + Fix(lmp, narg, arg), nwall(0), fwall(nullptr), fwall_all(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/srd command"); diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 063dc542be..5df63682b7 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -50,7 +50,7 @@ extern "C" { #define MPI_GROUP_EMPTY -1 #define MPI_ANY_SOURCE -1 -#define MPI_STATUS_IGNORE NULL +#define MPI_STATUS_IGNORE nullptr #define MPI_Comm int #define MPI_Request int @@ -60,7 +60,7 @@ extern "C" { #define MPI_Group int #define MPI_Offset long -#define MPI_IN_PLACE NULL +#define MPI_IN_PLACE nullptr #define MPI_MAX_PROCESSOR_NAME 128 #define MPI_MAX_LIBRARY_VERSION_STRING 128 diff --git a/src/USER-ADIOS/dump_atom_adios.cpp b/src/USER-ADIOS/dump_atom_adios.cpp index 3012223ac7..121bb193e1 100644 --- a/src/USER-ADIOS/dump_atom_adios.cpp +++ b/src/USER-ADIOS/dump_atom_adios.cpp @@ -190,7 +190,7 @@ void DumpAtomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/dump_custom_adios.cpp b/src/USER-ADIOS/dump_custom_adios.cpp index f7015ef696..921c725bc2 100644 --- a/src/USER-ADIOS/dump_custom_adios.cpp +++ b/src/USER-ADIOS/dump_custom_adios.cpp @@ -274,7 +274,7 @@ void DumpCustomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/reader_adios.cpp b/src/USER-ADIOS/reader_adios.cpp index d1e7313439..89a9ae698a 100644 --- a/src/USER-ADIOS/reader_adios.cpp +++ b/src/USER-ADIOS/reader_adios.cpp @@ -73,7 +73,7 @@ public: ReaderADIOS::ReaderADIOS(LAMMPS *lmp) : Reader(lmp) { - fieldindex = NULL; + fieldindex = nullptr; nAtoms = 0; nAtomsTotal = 0; atomOffset = 0; @@ -230,7 +230,7 @@ void ReaderADIOS::skip() { internal->fh.EndStep(); } match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index dd02676466..e5e42115f8 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -48,7 +48,7 @@ using std::string; /* ------------------------------------------------------------------------- */ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - lammps_(lmp), atc_(NULL) + lammps_(lmp), atc_(nullptr) { // ID GROUP atc PHYSICSTYPE [PARAMETERFILE] if (narg < 4 || narg > 5) lmp->error->all(FLERR,"Illegal fix atc command"); diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 5e23b7fc69..870a154073 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -49,8 +49,8 @@ PairAWPMDCut::PairAWPMDCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_var = NULL; - min_varforce = NULL; + min_var = nullptr; + min_varforce = nullptr; nextra = 4; pvector = new double[nextra]; @@ -82,7 +82,7 @@ PairAWPMDCut::~PairAWPMDCut() struct cmp_x{ double **xx; double tol; - cmp_x(double **xx_=NULL, double tol_=1e-12):xx(xx_),tol(tol_){} + cmp_x(double **xx_=nullptr, double tol_=1e-12):xx(xx_),tol(tol_){} bool operator()(const pair &left, const pair &right) const { if(left.first==right.first){ double d=xx[left.second][0]-xx[right.second][0]; @@ -241,7 +241,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) error->all(FLERR,logfmt("Invalid spin value (%d) for particle %d !",spin[i],i)); } // ion force vector - Vector_3 *fi=NULL; + Vector_3 *fi=nullptr; if(wpmd->ni) fi= new Vector_3[wpmd->ni]; @@ -269,7 +269,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) atom->ervel[i]=pv/(m*ermscale); } } - wpmd->set_pbc(NULL); // not required for LAMMPS + wpmd->set_pbc(nullptr); // not required for LAMMPS wpmd->interaction(0x1|0x4|0x10,fi); // get forces from the AWPMD solver object @@ -602,10 +602,10 @@ void PairAWPMDCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -629,9 +629,9 @@ void PairAWPMDCut::write_restart_settings(FILE *fp) void PairAWPMDCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index a4b8de84bd..46aabf7903 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure/bocs command"); if (igroup) error->all(FLERR,"Compute pressure/bocs must use group all"); @@ -52,12 +52,12 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : timeflag = 1; p_match_flag = 0; - phi_coeff = NULL; + phi_coeff = nullptr; // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -104,15 +104,15 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure/bocs requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; } @@ -149,7 +149,7 @@ void ComputePressureBocs::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairflag && force->pair) nvirial++; if (bondflag && atom->molecular && force->bond) nvirial++; @@ -179,7 +179,7 @@ void ComputePressureBocs::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* Extra functions added for BOCS */ diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 6f7962c83f..0dad793fd2 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -75,10 +75,10 @@ const int MAX_MESSAGE_LENGTH = 255; FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_bocs_package); @@ -98,7 +98,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -113,12 +113,12 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; - p_match_coeffs = NULL; + p_match_coeffs = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; // turn on tilt factor scaling, whenever applicable @@ -385,10 +385,10 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -481,7 +481,7 @@ FixBocs::~FixBocs() if (p_match_coeffs) free(p_match_coeffs); // Free splines memory structure - if (splines != NULL) { + if (splines != nullptr) { memory->destroy(splines); spline_length = 0; } @@ -629,7 +629,7 @@ void FixBocs::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -918,7 +918,7 @@ void FixBocs::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1924,7 +1924,7 @@ void *FixBocs::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index c9540bf0c0..f135c6b7ef 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -359,9 +359,9 @@ void BondOxdnaFene::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&Delta[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 662d55c590..6ddf03518c 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -815,47 +815,47 @@ void PairOxdna2Coaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,nullptr,error); } @@ -919,9 +919,9 @@ void PairOxdna2Coaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1023,5 +1023,5 @@ void *PairOxdna2Coaxstk::extract(const char *str, int &dim) if (strcmp(str,"AA_cxst1") == 0) return (void *) AA_cxst1; if (strcmp(str,"BB_cxst1") == 0) return (void *) BB_cxst1; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index f23ca4fbf7..1c4bd3bf09 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -437,16 +437,16 @@ void PairOxdna2Dh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -479,9 +479,9 @@ void PairOxdna2Dh::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -531,5 +531,5 @@ void *PairOxdna2Dh::extract(const char *str, int &dim) if (strcmp(str,"cut_dh_ast") == 0) return (void *) cut_dh_ast; if (strcmp(str,"cut_dh_c") == 0) return (void *) cut_dh_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index f1d425a0b3..3a1ee3d127 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -974,53 +974,53 @@ void PairOxdnaCoaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1090,9 +1090,9 @@ void PairOxdnaCoaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1205,5 +1205,5 @@ void *PairOxdnaCoaxstk::extract(const char *str, int &dim) if (strcmp(str,"b_cxst4p") == 0) return (void *) b_cxst4p; if (strcmp(str,"cosphi_cxst4p_c") == 0) return (void *) cosphi_cxst4p_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index ad96186b6b..64881cae22 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -696,26 +696,26 @@ void PairOxdnaExcv::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -758,9 +758,9 @@ void PairOxdnaExcv::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -824,5 +824,5 @@ void *PairOxdnaExcv::extract(const char *str, int &dim) if (strcmp(str,"b_bb") == 0) return (void *) b_bb; if (strcmp(str,"cut_bb_c") == 0) return (void *) cut_bb_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index 7987210d7a..009b967173 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -986,58 +986,58 @@ void PairOxdnaHbond::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1112,9 +1112,9 @@ void PairOxdnaHbond::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1232,5 +1232,5 @@ void *PairOxdnaHbond::extract(const char *str, int &dim) if (strcmp(str,"b_hb8") == 0) return (void *) b_hb8; if (strcmp(str,"dtheta_hb8_c") == 0) return (void *) dtheta_hb8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index bf52d61182..87b22f4468 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -1094,49 +1094,49 @@ void PairOxdnaStk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1202,9 +1202,9 @@ void PairOxdnaStk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1308,5 +1308,5 @@ void *PairOxdnaStk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index 1751499683..29c78c103a 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -933,56 +933,56 @@ void PairOxdnaXstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1055,9 +1055,9 @@ void PairOxdnaXstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1173,5 +1173,5 @@ void *PairOxdnaXstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index fd02946134..fff552908e 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -1191,55 +1191,55 @@ void PairOxrna2Stk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1311,9 +1311,9 @@ void PairOxrna2Stk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1427,5 +1427,5 @@ void *PairOxrna2Stk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index 673ef1c9a3..9fe4bebab8 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -855,50 +855,50 @@ void PairOxrna2Xstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -965,9 +965,9 @@ void PairOxrna2Xstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1073,5 +1073,5 @@ void *PairOxrna2Xstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 6f97d2104f..bdcb03c3c3 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -290,7 +290,7 @@ void AngleSDK::init_style() if (repflag) { int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle style SDK requires use of a compatible with Pair style"); lj1 = (double **) force->pair->extract("lj1",itmp); @@ -333,9 +333,9 @@ void AngleSDK::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 8185e24876..6c3e15089f 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -374,14 +374,14 @@ void PairLJSDK::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -411,10 +411,10 @@ void PairLJSDK::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -484,7 +484,7 @@ void *PairLJSDK::extract(const char *str, int &dim) if (strcmp(str,"lj4") == 0) return (void *) lj4; if (strcmp(str,"rminsq") == 0) return (void *) rminsq; if (strcmp(str,"emin") == 0) return (void *) emin; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index 42f1ff3ce7..2e21bdd102 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -51,7 +51,7 @@ PairLJSDKCoulLong::PairLJSDKCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -361,13 +361,13 @@ void PairLJSDKCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables (no rRESPA support yet) - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -466,14 +466,14 @@ void PairLJSDKCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -505,13 +505,13 @@ void PairLJSDKCoulLong::write_restart_settings(FILE *fp) void PairLJSDKCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -643,7 +643,7 @@ void *PairLJSDKCoulLong::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp index 8aa16b4adb..9818b7c51c 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp @@ -37,7 +37,7 @@ PairLJSDKCoulMSM::PairLJSDKCoulMSM(LAMMPS *lmp) : PairLJSDKCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; respa_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,6 +308,6 @@ void *PairLJSDKCoulMSM::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp b/src/USER-COLVARS/colvarproxy_lammps.cpp index dabb0bf923..f265271bb2 100644 --- a/src/USER-COLVARS/colvarproxy_lammps.cpp +++ b/src/USER-COLVARS/colvarproxy_lammps.cpp @@ -179,9 +179,9 @@ int colvarproxy_lammps::read_state_file(char const *state_filename) colvarproxy_lammps::~colvarproxy_lammps() { delete _random; - if (colvars != NULL) { + if (colvars != nullptr) { delete colvars; - colvars = NULL; + colvars = nullptr; } } diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index fcbfb58456..eaa0d272c3 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -194,7 +194,7 @@ int inthash_lookup(void *ptr, int key) { /* find the entry in the hash table */ h=inthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -246,7 +246,7 @@ void inthash_destroy(inthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -254,7 +254,7 @@ void inthash_destroy(inthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(inthash_t)); } @@ -276,7 +276,7 @@ int FixColvars::instances=0; optional keyword value pairs: input (for restarting/continuing, defaults to - NULL, but set to at end) + nullptr, but set to at end) output (defaults to 'out') seed (seed for RNG, defaults to '1966') tstat (label of thermostatting fix) @@ -305,9 +305,9 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : rng_seed = 1966; unwrap_flag = 1; - inp_name = NULL; - out_name = NULL; - tmp_name = NULL; + inp_name = nullptr; + out_name = nullptr; + tmp_name = nullptr; /* parse optional arguments */ int argsdone = 4; @@ -346,10 +346,10 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : nlevels_respa = 0; init_flag = 0; num_coords = 0; - comm_buf = NULL; - force_buf = NULL; - proxy = NULL; - idmap = NULL; + comm_buf = nullptr; + force_buf = nullptr; + proxy = nullptr; + idmap = nullptr; /* storage required to communicate a single coordinate or force. */ size_one = sizeof(struct commdata); @@ -445,7 +445,7 @@ void FixColvars::one_time_init() if (inp_name) { if (strcmp(inp_name,"NULL") == 0) { memory->sfree(inp_name); - inp_name = NULL; + inp_name = nullptr; } } @@ -961,7 +961,7 @@ void FixColvars::write_restart(FILE *fp) proxy->serialize_status(rest_text); // TODO call write_output_files() const char *cvm_state = rest_text.c_str(); - int len = strlen(cvm_state) + 1; // need to include terminating NULL byte. + int len = strlen(cvm_state) + 1; // need to include terminating nullptr byte. fwrite(&len,sizeof(int),1,fp); fwrite(cvm_state,1,len,fp); } diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 07a8ac2d5c..37b853ba96 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -143,7 +143,7 @@ void Group2Ndx::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for writing"); if (screen) diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index bab1592b1e..e09084ebfd 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -36,13 +36,13 @@ static char *find_section(FILE *fp, const char *name) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - if ((t != NULL) && *t == '[') { - t = strtok(NULL," \t\n\r\f"); - if (t != NULL) { + if ((t != nullptr) && *t == '[') { + t = strtok(nullptr," \t\n\r\f"); + if (t != nullptr) { n = t; - t = strtok(NULL," \t\n\r\f"); - if ((t != NULL) && *t == ']') { - if ((name == NULL) || strcmp(name,n) == 0) { + t = strtok(nullptr," \t\n\r\f"); + if ((t != nullptr) && *t == ']') { + if ((name == nullptr) || strcmp(name,n) == 0) { int l = strlen(n); r = new char[l+1]; strncpy(r,n,l+1); @@ -52,7 +52,7 @@ static char *find_section(FILE *fp, const char *name) } } } - return NULL; + return nullptr; } static tagint *read_section(FILE *fp, bigint &num) @@ -68,7 +68,7 @@ static tagint *read_section(FILE *fp, bigint &num) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - while (t != NULL) { + while (t != nullptr) { // start of a new section. we are done here. if (*t == '[') return tagbuf; @@ -77,7 +77,7 @@ static tagint *read_section(FILE *fp, bigint &num) nmax += DELTA; tagbuf = (tagint *)realloc(tagbuf,sizeof(tagint)*nmax); } - t = strtok(NULL," \t\n\r\f"); + t = strtok(nullptr," \t\n\r\f"); } } return tagbuf; @@ -90,7 +90,7 @@ void Ndx2Group::command(int narg, char **arg) int len; bigint num; FILE *fp; - char *name = NULL; + char *name = nullptr; tagint *tags; if (narg < 1) error->all(FLERR,"Illegal ndx2group command"); @@ -100,7 +100,7 @@ void Ndx2Group::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for reading"); if (screen) @@ -117,15 +117,15 @@ void Ndx2Group::command(int narg, char **arg) // find the next section. // if we had processed a section, before we need to step back - if (name != NULL) { + if (name != nullptr) { rewind(fp); char *tmp = find_section(fp,name); delete[] tmp; delete[] name; - name = NULL; + name = nullptr; } - name = find_section(fp,NULL); - if (name != NULL) { + name = find_section(fp,nullptr); + if (name != nullptr) { len=strlen(name)+1; // skip over group "all", which is called "System" in gromacs @@ -171,10 +171,10 @@ void Ndx2Group::command(int narg, char **arg) len = 0; // find named section, search from beginning of file - if (name != NULL) delete[] name; + if (name != nullptr) delete[] name; rewind(fp); name = find_section(fp,arg[idx]); - if (name != NULL) len=strlen(name)+1; + if (name != nullptr) len=strlen(name)+1; if (screen) fprintf(screen," %s group '%s'\n", diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index d16fbf2876..f35ea66796 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -49,7 +49,7 @@ static const char cite_compute_saed_c[] = /* ---------------------------------------------------------------------- */ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_saed_c); diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index b48de49c81..633467fe36 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -50,7 +50,7 @@ static const char cite_compute_xrd_c[] = /* ---------------------------------------------------------------------- */ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_xrd_c); diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index 39382264c4..00cfcbf91a 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -40,8 +40,8 @@ enum{FIRST,MULTI}; /* ---------------------------------------------------------------------- */ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ids(NULL), fp(NULL), vector(NULL), - vector_total(NULL), vector_list(NULL), compute_saed(NULL), filename(NULL) + Fix(lmp, narg, arg), ids(nullptr), fp(nullptr), vector(nullptr), + vector_total(nullptr), vector_list(nullptr), compute_saed(nullptr), filename(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix saed/vtk command"); @@ -66,7 +66,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : options(narg,arg); which = 0; - ids = NULL; + ids = nullptr; nvalues = 0; @@ -136,8 +136,8 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; if (ave == WINDOW) memory->create(vector_list,nwindow,nvalues,"saed/vtk:vector_list"); @@ -145,7 +145,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : memory->create(vector,nrows,"saed/vtk:vector"); memory->create(vector_total,nrows,"saed/vtk:vector_total"); - extlist = NULL; + extlist = nullptr; vector_flag = 1; size_vector = nrows; @@ -425,7 +425,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); @@ -531,7 +531,7 @@ void FixSAEDVTK::options(int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; overwrite = 0; @@ -552,7 +552,7 @@ void FixSAEDVTK::options(int narg, char **arg) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); diff --git a/src/USER-DPD/compute_dpd_atom.cpp b/src/USER-DPD/compute_dpd_atom.cpp index 0fd732f669..95141e2de2 100644 --- a/src/USER-DPD/compute_dpd_atom.cpp +++ b/src/USER-DPD/compute_dpd_atom.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDpdAtom::ComputeDpdAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), dpdAtom(NULL) + Compute(lmp, narg, arg), dpdAtom(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dpd/atom command"); diff --git a/src/USER-DPD/fix_dpd_energy.cpp b/src/USER-DPD/fix_dpd_energy.cpp index 6ee88ea88a..674bf0e13d 100644 --- a/src/USER-DPD/fix_dpd_energy.cpp +++ b/src/USER-DPD/fix_dpd_energy.cpp @@ -28,12 +28,12 @@ FixDPDenergy::FixDPDenergy(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3 ) error->all(FLERR,"Illegal fix dpd/energy command"); - pairDPDE = NULL; + pairDPDE = nullptr; pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix dpd/energy"); if (!(atom->dpd_flag)) error->all(FLERR,"Must use atom_style dpd/fdt/energy with fix dpd/energy"); diff --git a/src/USER-DPD/fix_eos_table.cpp b/src/USER-DPD/fix_eos_table.cpp index 57cfe03dc8..00cbda1671 100644 --- a/src/USER-DPD/fix_eos_table.cpp +++ b/src/USER-DPD/fix_eos_table.cpp @@ -31,7 +31,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix eos/table command"); nevery = 1; @@ -43,7 +43,7 @@ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table entries"); ntables = 0; - tables = NULL; + tables = nullptr; int me; MPI_Comm_rank(world,&me); tables = (Table *) @@ -167,10 +167,10 @@ void FixEOStable::end_of_step() void FixEOStable::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -198,7 +198,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -207,7 +207,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -305,13 +305,13 @@ void FixEOStable::param_extract(Table *tb, Table *tb2, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); tb2->ninput = atoi(word); } else { error->one(FLERR,"Invalid keyword in fix eos/table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"fix eos/table parameters did not set N"); diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index c220d84a57..d01b2015d2 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -42,8 +42,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL), - tables2(NULL), dHf(NULL), eosSpecies(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr), + tables2(nullptr), dHf(nullptr), eosSpecies(nullptr) { if (narg != 8 && narg != 10) error->all(FLERR,"Illegal fix eos/table/rx command"); nevery = 1; @@ -64,9 +64,9 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table/rx entries"); ntables = 0; - tables = NULL; - tables2 = NULL; - eosSpecies = NULL; + tables = nullptr; + tables2 = nullptr; + eosSpecies = nullptr; int me; MPI_Comm_rank(world,&me); @@ -306,10 +306,10 @@ void FixEOStableRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open eos table/rx potential file %s",file); error->one(FLERR,str); @@ -324,7 +324,7 @@ void FixEOStableRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -346,7 +346,7 @@ void FixEOStableRX::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -366,7 +366,7 @@ void FixEOStableRX::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -388,10 +388,10 @@ void FixEOStableRX::read_file(char *file) void FixEOStableRX::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -419,7 +419,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -428,7 +428,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -482,7 +482,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) } nwords = 0; word = strtok(line," \t\n\r\f"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); for (int icolumn=0;icolumnrfile[i] = rtmp; @@ -574,11 +574,11 @@ void FixEOStableRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); if(rx_flag){ while (word) { @@ -592,7 +592,7 @@ void FixEOStableRX::param_extract(Table *tb, char *line) printf("name=%s not found in species list\n",word); error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } for (int icolumn = 0; icolumn < ncolumn; icolumn++) diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index d974d12473..07d39d0de7 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -67,23 +67,23 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; /* ---------------------------------------------------------------------- */ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mol2param(NULL), nreactions(0), - params(NULL), Arr(NULL), nArr(NULL), Ea(NULL), tempExp(NULL), - stoich(NULL), stoichReactants(NULL), stoichProducts(NULL), kR(NULL), - pairDPDE(NULL), dpdThetaLocal(NULL), sumWeights(NULL), sparseKinetics_nu(NULL), - sparseKinetics_nuk(NULL), sparseKinetics_inu(NULL), sparseKinetics_isIntegralReaction(NULL), - kineticsFile(NULL), id_fix_species(NULL), - id_fix_species_old(NULL), fix_species(NULL), fix_species_old(NULL) + Fix(lmp, narg, arg), mol2param(nullptr), nreactions(0), + params(nullptr), Arr(nullptr), nArr(nullptr), Ea(nullptr), tempExp(nullptr), + stoich(nullptr), stoichReactants(nullptr), stoichProducts(nullptr), kR(nullptr), + pairDPDE(nullptr), dpdThetaLocal(nullptr), sumWeights(nullptr), sparseKinetics_nu(nullptr), + sparseKinetics_nuk(nullptr), sparseKinetics_inu(nullptr), sparseKinetics_isIntegralReaction(nullptr), + kineticsFile(nullptr), id_fix_species(nullptr), + id_fix_species_old(nullptr), fix_species(nullptr), fix_species_old(nullptr) { if (narg < 7 || narg > 12) error->all(FLERR,"Illegal fix rx command"); nevery = 1; nreactions = maxparam = 0; - params = NULL; - mol2param = NULL; - pairDPDE = NULL; - id_fix_species = NULL; - id_fix_species_old = NULL; + params = nullptr; + mol2param = nullptr; + pairDPDE = nullptr; + id_fix_species = nullptr; + id_fix_species_old = nullptr; const int Verbosity = 1; @@ -166,7 +166,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : diagnosticFrequency = 0; for (int i = 0; i < numDiagnosticCounters; ++i){ diagnosticCounter[i] = 0; - diagnosticCounterPerODE[i] = NULL; + diagnosticCounterPerODE[i] = nullptr; } if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg==8){ @@ -189,8 +189,8 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : minSteps = atoi( arg[iarg++] ); maxIters = atoi( arg[iarg++] ); - relTol = strtod( arg[iarg++], NULL); - absTol = strtod( arg[iarg++], NULL); + relTol = strtod( arg[iarg++], nullptr); + absTol = strtod( arg[iarg++], nullptr); if (iarg < narg) diagnosticFrequency = atoi( arg[iarg++] ); @@ -207,10 +207,10 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : } // Initialize/Create the sparse matrix database. - sparseKinetics_nu = NULL; - sparseKinetics_nuk = NULL; - sparseKinetics_inu = NULL; - sparseKinetics_isIntegralReaction = NULL; + sparseKinetics_nu = nullptr; + sparseKinetics_nuk = nullptr; + sparseKinetics_inu = nullptr; + sparseKinetics_isIntegralReaction = nullptr; sparseKinetics_maxReactants = 0; sparseKinetics_maxProducts = 0; sparseKinetics_maxSpecies = 0; @@ -259,15 +259,15 @@ void FixRX::post_constructor() char **tmpspecies = new char*[maxspecies]; int tmpmaxstrlen = 0; for(int jj=0; jj < maxspecies; jj++) - tmpspecies[jj] = NULL; + tmpspecies[jj] = nullptr; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(kineticsFile,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",kineticsFile); error->one(FLERR,str); @@ -284,7 +284,7 @@ void FixRX::post_constructor() while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -304,8 +304,8 @@ void FixRX::post_constructor() nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ - word = strtok(NULL, " \t\n\r\f"); + while (word != nullptr){ + word = strtok(nullptr, " \t\n\r\f"); match=false; for(int jj=0;jjnspecies_dpd = nUniqueSpecies; @@ -332,8 +332,8 @@ void FixRX::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_species = NULL; - id_fix_species_old = NULL; + id_fix_species = nullptr; + id_fix_species_old = nullptr; n = strlen(id) + strlen("_SPECIES") + 1; id_fix_species = new char[n]; @@ -637,10 +637,10 @@ int FixRX::setmask() void FixRX::init() { pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); bool eos_flag = false; @@ -853,10 +853,10 @@ void FixRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",file); error->one(FLERR,str); @@ -872,7 +872,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -926,7 +926,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -946,9 +946,9 @@ void FixRX::read_file(char *file) nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ + while (word != nullptr){ tmpStoich = atof(word); - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); for (ispecies = 0; ispecies < nspecies; ispecies++){ if (strcmp(word,&atom->dname[ispecies][0]) == 0){ stoich[nreactions][ispecies] += sign*tmpStoich; @@ -965,22 +965,22 @@ void FixRX::read_file(char *file) } error->all(FLERR,"Illegal fix rx command"); } - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); if(strcmp(word,"=") == 0) sign = 1.0; if(strcmp(word,"+") != 0 && strcmp(word,"=") != 0){ - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Arr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); nArr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Ea[nreactions] = atof(word); sign = -1.0; break; } - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); } nreactions++; } @@ -1434,7 +1434,7 @@ void FixRX::odeDiagnostics(void) my_max[i] = 0; my_min[i] = DBL_MAX; - if (diagnosticCounterPerODE[i] != NULL){ + if (diagnosticCounterPerODE[i] != nullptr){ for (int j = 0; j < nlocal; ++j) if (mask[j] & groupbit){ double diff = double(diagnosticCounterPerODE[i][j]) - avg_per_atom[i]; @@ -1637,8 +1637,8 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) ode_counter[1] += nit; ode_counter[2] += nfe; - //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != NULL) - if (diagnosticCounterPerODE[StepSum] != NULL){ + //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != nullptr) + if (diagnosticCounterPerODE[StepSum] != nullptr){ diagnosticCounterPerODE[StepSum][id] = nst; diagnosticCounterPerODE[FuncSum][id] = nfe; } @@ -1708,7 +1708,7 @@ int FixRX::rhs_sparse(double /*t*/, const double *y, double *dydt, void *v_param const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index c4480a0373..6db13d3943 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -84,18 +84,18 @@ static const char cite_fix_shardlow[] = /* ---------------------------------------------------------------------- */ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pairDPD(NULL), pairDPDE(NULL), v_t0(NULL) - ,rand_state(NULL) + Fix(lmp, narg, arg), pairDPD(nullptr), pairDPDE(nullptr), v_t0(nullptr) + ,rand_state(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_shardlow); if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); - pairDPD = NULL; - pairDPDE = NULL; + pairDPD = nullptr; + pairDPDE = nullptr; pairDPD = (PairDPDfdt *) force->pair_match("dpd/fdt",1); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); maxRNG = 0; @@ -107,7 +107,7 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; } - if(pairDPD == NULL && pairDPDE == NULL) + if(pairDPD == nullptr && pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow"); } @@ -533,7 +533,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) const int nlocal = atom->nlocal; const int nghost = atom->nghost; - const bool useDPDE = (pairDPDE != NULL); + const bool useDPDE = (pairDPDE != nullptr); // NOTE: this logic is specific to orthogonal boxes, not triclinic @@ -640,7 +640,7 @@ fprintf(stdout, "\n%6d %6d,%6d %6d: " #endif memory->sfree(v_t0); - v_t0 = NULL; + v_t0 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index 4fb5714d11..e3f6f4e20d 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -37,9 +37,9 @@ NPairHalfBinNewtonSSA::NPairHalfBinNewtonSSA(LAMMPS *lmp) : NPair(lmp) ssa_maxPhaseCt = 0; ssa_maxPhaseLen = 0; ssa_phaseCt = 0; - ssa_phaseLen = NULL; - ssa_itemLoc = NULL; - ssa_itemLen = NULL; + ssa_phaseLen = nullptr; + ssa_itemLoc = nullptr; + ssa_itemLen = nullptr; ssa_gphaseCt = 7; memory->create(ssa_gphaseLen,ssa_gphaseCt,"NPairHalfBinNewtonSSA:ssa_gphaseLen"); memory->create(ssa_gitemLoc,ssa_gphaseCt,1,"NPairHalfBinNewtonSSA:ssa_gitemLoc"); diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 1d3d952e9f..822444f8c5 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; PairDPDfdt::PairDPDfdt(LAMMPS *lmp) : Pair(lmp) { - random = NULL; + random = nullptr; splitFDT_flag = false; a0_is_zero = false; } @@ -375,13 +375,13 @@ void PairDPDfdt::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -410,10 +410,10 @@ void PairDPDfdt::write_restart_settings(FILE *fp) void PairDPDfdt::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index b843e4601a..094e5732c7 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -39,9 +39,9 @@ using namespace LAMMPS_NS; PairDPDfdtEnergy::PairDPDfdtEnergy(LAMMPS *lmp) : Pair(lmp) { - random = NULL; - duCond = NULL; - duMech = NULL; + random = nullptr; + duCond = nullptr; + duMech = nullptr; splitFDT_flag = false; a0_is_zero = false; @@ -476,14 +476,14 @@ void PairDPDfdtEnergy::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -513,9 +513,9 @@ void PairDPDfdtEnergy::write_restart_settings(FILE *fp) void PairDPDfdtEnergy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 666a1b0ea9..9d7fcc1ab2 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -59,10 +59,10 @@ struct PairExp6ParamDataType // Default constructor -- nullify everything. PairExp6ParamDataType(void) - : n(0), epsilon1(NULL), alpha1(NULL), rm1(NULL), mixWtSite1(NULL), - epsilon2(NULL), alpha2(NULL), rm2(NULL), mixWtSite2(NULL), - epsilonOld1(NULL), alphaOld1(NULL), rmOld1(NULL), mixWtSite1old(NULL), - epsilonOld2(NULL), alphaOld2(NULL), rmOld2(NULL), mixWtSite2old(NULL) + : n(0), epsilon1(nullptr), alpha1(nullptr), rm1(nullptr), mixWtSite1(nullptr), + epsilon2(nullptr), alpha2(nullptr), rm2(nullptr), mixWtSite2(nullptr), + epsilonOld1(nullptr), alphaOld1(nullptr), rmOld1(nullptr), mixWtSite1old(nullptr), + epsilonOld2(nullptr), alphaOld2(nullptr), rmOld2(nullptr), mixWtSite2old(nullptr) {} }; @@ -74,8 +74,8 @@ PairExp6rx::PairExp6rx(LAMMPS *lmp) : Pair(lmp) nspecies = 0; nparams = maxparam = 0; - params = NULL; - mol2param = NULL; + params = nullptr; + mol2param = nullptr; fractionalWeighting = true; } @@ -85,7 +85,7 @@ PairExp6rx::~PairExp6rx() { if (copymode) return; - if (params != NULL) { + if (params != nullptr) { for (int i=0; i < nparams; ++i) { delete[] params[i].name; delete[] params[i].potential; @@ -659,7 +659,7 @@ void PairExp6rx::coeff(int narg, char **arg) } delete[] site1; delete[] site2; - site1 = site2 = NULL; + site1 = site2 = nullptr; setup(); @@ -717,16 +717,16 @@ void PairExp6rx::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -743,7 +743,7 @@ void PairExp6rx::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -765,7 +765,7 @@ void PairExp6rx::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -785,7 +785,7 @@ void PairExp6rx::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -839,10 +839,10 @@ void PairExp6rx::read_file2(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open polynomial file %s",file); error->one(FLERR,str); @@ -857,7 +857,7 @@ void PairExp6rx::read_file2(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -879,7 +879,7 @@ void PairExp6rx::read_file2(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -899,7 +899,7 @@ void PairExp6rx::read_file2(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; if (strcmp(words[0],"alpha") == 0){ for (int ii=1; iime; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -1004,10 +1004,10 @@ void PairExp6rx::write_restart_settings(FILE *fp) void PairExp6rx::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index ceb5c78eaf..2e556d82e4 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -57,14 +57,14 @@ static const char cite_pair_multi_lucy[] = /* ---------------------------------------------------------------------- */ PairMultiLucy::PairMultiLucy(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL) + ntables(0), tables(nullptr), tabindex(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -256,7 +256,7 @@ void PairMultiLucy::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -358,7 +358,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -481,26 +481,26 @@ void PairMultiLucy::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -582,15 +582,15 @@ void PairMultiLucy::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucy::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -707,8 +707,8 @@ void PairMultiLucy::write_restart_settings(FILE *fp) void PairMultiLucy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index d769d94783..e56743ea1d 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -68,14 +68,14 @@ static const char cite_pair_multi_lucy_rx[] = /* ---------------------------------------------------------------------- */ PairMultiLucyRX::PairMultiLucyRX(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL), site1(NULL), site2(NULL) + ntables(0), tables(nullptr), tabindex(nullptr), site1(nullptr), site2(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy_rx); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy/rx command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -134,10 +134,10 @@ void PairMultiLucyRX::compute(int eflag, int vflag) int jtable; double *rho = atom->rho; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = nlocal + nghost; @@ -355,7 +355,7 @@ void PairMultiLucyRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -494,7 +494,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -503,7 +503,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -626,26 +626,26 @@ void PairMultiLucyRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -727,15 +727,15 @@ void PairMultiLucyRX::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucyRX::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -852,8 +852,8 @@ void PairMultiLucyRX::write_restart_settings(FILE *fp) void PairMultiLucyRX::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index f791107f1d..05467346c8 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -46,8 +46,8 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTableRX::PairTableRX(LAMMPS *lmp) : PairTable(lmp) { fractionalWeighting = true; - site1 = NULL; - site2 = NULL; + site1 = nullptr; + site2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -93,10 +93,10 @@ void PairTableRX::compute(int eflag, int vflag) double *uCG = atom->uCG; double *uCGnew = atom->uCGnew; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = atom->nlocal + atom->nghost; @@ -290,7 +290,7 @@ void PairTableRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index b806b4434b..1c60805db2 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -43,9 +43,9 @@ ComputeTempDrude::ComputeTempDrude(LAMMPS *lmp, int narg, char **arg) : tempflag = 0; // because does not compute a single temperature (scalar and vector) vector = new double[size_vector]; - fix_drude = NULL; - id_temp = NULL; - temperature = NULL; + fix_drude = nullptr; + id_temp = nullptr; + temperature = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_drude.cpp b/src/USER-DRUDE/fix_drude.cpp index 313ac249d7..ea93731426 100644 --- a/src/USER-DRUDE/fix_drude.cpp +++ b/src/USER-DRUDE/fix_drude.cpp @@ -53,7 +53,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix drude command"); } - drudeid = NULL; + drudeid = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); @@ -147,7 +147,7 @@ void FixDrude::build_drudeid(){ // Loop on procs to fill my atoms' sets of bond partners comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 4, ring_build_partner, NULL, (void *)this, 1); + 4, ring_build_partner, nullptr, (void *)this, 1); // Build the list of my Drudes' tags // The only bond partners of a Drude particle is its core, @@ -163,7 +163,7 @@ void FixDrude::build_drudeid(){ // so that each core finds its Drude. comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 3, ring_search_drudeid, NULL, (void *)this, 1); + 3, ring_search_drudeid, nullptr, (void *)this, 1); delete [] partner_set; } @@ -338,11 +338,11 @@ void FixDrude::rebuild_special(){ // Remove Drude particles from the special lists of each proc comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 9, ring_remove_drude, NULL, (void *)this, 1); + 9, ring_remove_drude, nullptr, (void *)this, 1); // Add back Drude particles in the lists just after their core comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 10, ring_add_drude, NULL, (void *)this, 1); + 10, ring_add_drude, nullptr, (void *)this, 1); // Check size of special list nspecmax_loc = 0; @@ -373,7 +373,7 @@ void FixDrude::rebuild_special(){ // Copy core's list into their drude list comm->ring(core_special_vec.size(), sizeof(tagint), (char *) core_special_vec.data(), - 11, ring_copy_drude, NULL, (void *)this, 1); + 11, ring_copy_drude, nullptr, (void *)this, 1); } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index bdccaaebc8..fc89367323 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -29,11 +29,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ template FixDrudeTransform::FixDrudeTransform(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mcoeff(NULL) + Fix(lmp, narg, arg), mcoeff(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix drude/transform command"); comm_forward = 9; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index da74510821..3fd017444e 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -48,7 +48,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; // core temperature - tstr_core = NULL; + tstr_core = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr_core = new char[n]; @@ -63,7 +63,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : int seed_core = utils::inumeric(FLERR,arg[5],false,lmp); // drude temperature - tstr_drude = NULL; + tstr_drude = nullptr; if (strstr(arg[7],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; tstr_drude = new char[n]; @@ -102,9 +102,9 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : tflag = 0; // no external compute/temp is specified yet (for bias) energy = 0.; - fix_drude = NULL; - temperature = NULL; - id_temp = NULL; + fix_drude = nullptr; + temperature = nullptr; + id_temp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -379,7 +379,7 @@ void *FixLangevinDrude::extract(const char *str, int &dim) } else if (strcmp(str,"t_target_drude") == 0) { return &t_target_drude; } else error->all(FLERR, "Illegal extract string in fix langevin/drude"); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index 461f972885..c6662c423d 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -56,9 +56,9 @@ PairLJCutTholeLong::PairLJCutTholeLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; single_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -371,11 +371,11 @@ void PairLJCutTholeLong::init_style() // set rRESPA cutoffs - cut_respa = NULL; + cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -496,16 +496,16 @@ void PairLJCutTholeLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -541,15 +541,15 @@ void PairLJCutTholeLong::write_restart_settings(FILE *fp) void PairLJCutTholeLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -602,5 +602,5 @@ void *PairLJCutTholeLong::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 281317c076..e9c4f396d0 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairThole::PairThole(LAMMPS *lmp) : Pair(lmp) { - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -312,13 +312,13 @@ void PairThole::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); } MPI_Bcast(&polar[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairThole::write_restart_settings(FILE *fp) void PairThole::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&thole_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -400,5 +400,5 @@ void *PairThole::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-EFF/compute_ke_atom_eff.cpp b/src/USER-EFF/compute_ke_atom_eff.cpp index 001e1d4c43..e25f239adc 100644 --- a/src/USER-EFF/compute_ke_atom_eff.cpp +++ b/src/USER-EFF/compute_ke_atom_eff.cpp @@ -40,7 +40,7 @@ ComputeKEAtomEff::ComputeKEAtomEff(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - ke = NULL; + ke = nullptr; // error check diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 90e25ca3c8..979b47f50c 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -52,7 +52,7 @@ ComputeTempDeformEff::ComputeTempDeformEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index c95cf0de2d..f7c1bd5b68 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -55,7 +55,7 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index 3966bc7b98..a0aabb68a0 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -45,7 +45,7 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevinEff::FixLangevinEff(LAMMPS *lmp, int narg, char **arg) : FixLangevin(lmp, narg, arg) { - erforcelangevin = NULL; + erforcelangevin = nullptr; } /* ---------------------------------------------------------------------- */ @@ -399,7 +399,7 @@ void FixLangevinEff::end_of_step() double FixLangevinEff::compute_scalar() { - if (!tallyflag || flangevin == NULL || erforcelangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr || erforcelangevin == nullptr) return 0.0; // capture the very first energy transfer to thermal reservoir diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index f4e7af6584..817b2eb6eb 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -42,8 +42,8 @@ PairEffCut::PairEffCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_eradius = NULL; - min_erforce = NULL; + min_eradius = nullptr; + min_erforce = nullptr; nextra = 4; pvector = new double[nextra]; } @@ -979,10 +979,10 @@ void PairEffCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -1006,9 +1006,9 @@ void PairEffCut::write_restart_settings(FILE *fp) void PairEffCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index ff1e303a30..6ecf0795d7 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -158,14 +158,14 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : // allocate space for charge, force, energy, virial arrays - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; allocate_storage(); - fixgpu = NULL; + fixgpu = nullptr; } /* ---------------------------------------------------------------------- */ @@ -210,17 +210,17 @@ void ComputeFEP::init() if (!input->variable->equalstyle(pert->ivar)) error->all(FLERR,"Variable for compute fep is of invalid style"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"compute fep pair requires pair interactions"); if (pert->which == PAIR) { pairflag = 1; Pair *pair = force->pair_match(pert->pstyle,1); - if (pair == NULL) error->all(FLERR,"compute fep pair style " + if (pair == nullptr) error->all(FLERR,"compute fep pair style " "does not exist"); void *ptr = pair->extract(pert->pparam,pert->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"compute fep pair style param not supported"); pert->array = (double **) ptr; @@ -497,10 +497,10 @@ void ComputeFEP::deallocate_storage() memory->destroy(keatom_orig); memory->destroy(kvatom_orig); - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; } diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 2f97b5a0e3..ca9088836d 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -172,7 +172,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : if (adapt[m].which == PAIR) memory->create(adapt[m].array_orig,n+1,n+1,"adapt:array_orig"); - id_fix_diam = id_fix_chg = NULL; + id_fix_diam = id_fix_chg = nullptr; } /* ---------------------------------------------------------------------- */ @@ -220,8 +220,8 @@ void FixAdaptFEP::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; char **newarg = new char*[6]; newarg[1] = group->names[igroup]; @@ -307,7 +307,7 @@ void FixAdaptFEP::init() if (ad->which == PAIR) { anypair = 1; - Pair *pair = NULL; + Pair *pair = nullptr; if (lmp->suffix_enable) { char psuffix[128]; @@ -316,11 +316,11 @@ void FixAdaptFEP::init() strcat(psuffix,lmp->suffix); pair = force->pair_match(psuffix,1); } - if (pair == NULL) pair = force->pair_match(ad->pstyle,1); - if (pair == NULL) + if (pair == nullptr) pair = force->pair_match(ad->pstyle,1); + if (pair == nullptr) error->all(FLERR, "Fix adapt/fep pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt/fep pair style param not supported"); ad->pdim = 2; @@ -340,7 +340,7 @@ void FixAdaptFEP::init() } } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt/fep kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index b0a099a56f..a68c136993 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -275,12 +275,12 @@ void PairCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -309,12 +309,12 @@ void PairCoulCutSoft::write_restart_settings(FILE *fp) void PairCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -373,5 +373,5 @@ void *PairCoulCutSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index 80173f3f0f..2749fe8c71 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -236,7 +236,7 @@ void PairCoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -295,11 +295,11 @@ void PairCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); } } @@ -326,12 +326,12 @@ void PairCoulLongSoft::write_restart_settings(FILE *fp) void PairCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -388,5 +388,5 @@ void *PairCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"scale") == 0) return (void *) scale; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index e13b98329f..e6783b0228 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -728,11 +728,11 @@ void PairLJCharmmCoulLongSoft::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -819,15 +819,15 @@ void PairLJCharmmCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -862,15 +862,15 @@ void PairLJCharmmCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCharmmCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -990,5 +990,5 @@ void *PairLJCharmmCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index bfd5a630f6..f8719b8900 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -382,15 +382,15 @@ void PairLJClass2CoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -425,15 +425,15 @@ void PairLJClass2CoulCutSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -515,5 +515,5 @@ void *PairLJClass2CoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index e027a30185..9741dd24ca 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -285,7 +285,7 @@ void PairLJClass2CoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -397,14 +397,14 @@ void PairLJClass2CoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -438,15 +438,15 @@ void PairLJClass2CoulLongSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -537,5 +537,5 @@ void *PairLJClass2CoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index 0cd1fc9e87..81319d715c 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -321,14 +321,14 @@ void PairLJClass2Soft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -360,12 +360,12 @@ void PairLJClass2Soft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -432,5 +432,5 @@ void *PairLJClass2Soft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index a18256f98a..53f39523e1 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -378,15 +378,15 @@ void PairLJCutCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -421,15 +421,15 @@ void PairLJCutCoulCutSoft::write_restart_settings(FILE *fp) void PairLJCutCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -512,5 +512,5 @@ void *PairLJCutCoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index 4b3fae77b3..61db28fe16 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -656,11 +656,11 @@ void PairLJCutCoulLongSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -775,14 +775,14 @@ void PairLJCutCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -816,15 +816,15 @@ void PairLJCutCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCutCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -923,5 +923,5 @@ void *PairLJCutCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 786715d6c9..589e036420 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -532,7 +532,7 @@ void PairLJCutSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -636,14 +636,14 @@ void PairLJCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -676,13 +676,13 @@ void PairLJCutSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -748,5 +748,5 @@ void *PairLJCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 18f8db5021..748c616d64 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -53,8 +53,8 @@ PairLJCutTIP4PLongSoft::PairLJCutTIP4PLongSoft(LAMMPS *lmp) : respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -450,9 +450,9 @@ void PairLJCutTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/soft requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLongSoft::init_style(); @@ -517,17 +517,17 @@ void PairLJCutTIP4PLongSoft::read_restart_settings(FILE *fp) PairLJCutCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -579,7 +579,7 @@ void *PairLJCutTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index 85a30a5414..5154907ec3 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -313,15 +313,15 @@ void PairMorseSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -353,10 +353,10 @@ void PairMorseSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&shift_range,1,MPI_DOUBLE,0,world); @@ -450,5 +450,5 @@ void *PairMorseSoft::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index 9578befd37..18e2667150 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -52,8 +52,8 @@ PairTIP4PLongSoft::PairTIP4PLongSoft(LAMMPS *lmp) : PairCoulLongSoft(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -407,9 +407,9 @@ void PairTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLongSoft::init_style(); @@ -454,11 +454,11 @@ void PairTIP4PLongSoft::read_restart_settings(FILE *fp) PairCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); MPI_Bcast(&typeH,1,MPI_INT,0,world); @@ -501,7 +501,7 @@ void *PairTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-H5MD/dump_h5md.cpp b/src/USER-H5MD/dump_h5md.cpp index e9daf71867..11a4906263 100644 --- a/src/USER-H5MD/dump_h5md.cpp +++ b/src/USER-H5MD/dump_h5md.cpp @@ -68,11 +68,11 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) size_one = 6; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; datafile_from_dump = -1; - author_name=NULL; + author_name=nullptr; every_dump = utils::inumeric(FLERR,arg[3],false,lmp); every_position = every_image = -1; @@ -175,7 +175,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) if (iarg+1>=narg) { error->all(FLERR, "Invalid number of arguments in dump h5md"); } - if (author_name==NULL) { + if (author_name==nullptr) { author_name = new char[strlen(arg[iarg])+1]; strcpy(author_name, arg[iarg+1]); } else { @@ -271,10 +271,10 @@ void DumpH5MD::openfile() if (me == 0) { if (datafile_from_dump<0) { - if (author_name==NULL) { - datafile = h5md_create_file(filename, "N/A", NULL, "lammps", LAMMPS_VERSION); + if (author_name==nullptr) { + datafile = h5md_create_file(filename, "N/A", nullptr, "lammps", LAMMPS_VERSION); } else { - datafile = h5md_create_file(filename, author_name, NULL, "lammps", LAMMPS_VERSION); + datafile = h5md_create_file(filename, author_name, nullptr, "lammps", LAMMPS_VERSION); } group_name_length = strlen(group->names[igroup])+1; group_name = new char[group_name_length]; @@ -288,19 +288,19 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } else { @@ -318,26 +318,26 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } } - if (author_name!=NULL) delete [] author_name; + if (author_name!=nullptr) delete [] author_name; for (int i=0; i<3; i++) { delete [] boundary[i]; } @@ -536,7 +536,7 @@ void DumpH5MD::write_fixed_frame() edges[2] = boxzhi - boxzlo; if (every_position==0) { particles_data.position = h5md_create_fixed_data_simple(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, dump_position); - h5md_create_box(&particles_data, dims[1], boundary, false, edges, NULL); + h5md_create_box(&particles_data, dims[1], boundary, false, edges, nullptr); if (every_image==0) particles_data.image = h5md_create_fixed_data_simple(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, dump_image); } diff --git a/src/USER-INTEL/angle_charmm_intel.h b/src/USER-INTEL/angle_charmm_intel.h index 155ecfaff9..798e3d1523 100644 --- a/src/USER-INTEL/angle_charmm_intel.h +++ b/src/USER-INTEL/angle_charmm_intel.h @@ -61,7 +61,7 @@ class AngleCharmmIntel : public AngleCharmm { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/angle_harmonic_intel.h b/src/USER-INTEL/angle_harmonic_intel.h index c00292f7ce..7df4a98877 100644 --- a/src/USER-INTEL/angle_harmonic_intel.h +++ b/src/USER-INTEL/angle_harmonic_intel.h @@ -61,7 +61,7 @@ class AngleHarmonicIntel : public AngleHarmonic { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/bond_fene_intel.h b/src/USER-INTEL/bond_fene_intel.h index 58fcdb8669..92ec4097c0 100644 --- a/src/USER-INTEL/bond_fene_intel.h +++ b/src/USER-INTEL/bond_fene_intel.h @@ -61,7 +61,7 @@ class BondFENEIntel : public BondFENE { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/bond_harmonic_intel.h b/src/USER-INTEL/bond_harmonic_intel.h index 3c1d050a3b..449df3b7a8 100644 --- a/src/USER-INTEL/bond_harmonic_intel.h +++ b/src/USER-INTEL/bond_harmonic_intel.h @@ -61,7 +61,7 @@ class BondHarmonicIntel : public BondHarmonic { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_charmm_intel.h b/src/USER-INTEL/dihedral_charmm_intel.h index d80b32c8ac..bb830b7292 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.h +++ b/src/USER-INTEL/dihedral_charmm_intel.h @@ -66,7 +66,7 @@ class DihedralCharmmIntel : public DihedralCharmm { flt_t *weight; ForceConst() : _npairtypes(0), _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, 0, NULL); } + ~ForceConst() { set_ntypes(0, 0, nullptr); } void set_ntypes(const int npairtypes, const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_fourier_intel.h b/src/USER-INTEL/dihedral_fourier_intel.h index 26007f4118..f91d89f6bc 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.h +++ b/src/USER-INTEL/dihedral_fourier_intel.h @@ -63,7 +63,7 @@ class DihedralFourierIntel : public DihedralFourier { fc_packed1 **bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, NULL, NULL); } + ~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); } void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory); diff --git a/src/USER-INTEL/dihedral_harmonic_intel.h b/src/USER-INTEL/dihedral_harmonic_intel.h index 0a9cfaa042..cdbae365fd 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.h +++ b/src/USER-INTEL/dihedral_harmonic_intel.h @@ -63,7 +63,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_opls_intel.h b/src/USER-INTEL/dihedral_opls_intel.h index 1080bfa6c3..77fd8c4b95 100644 --- a/src/USER-INTEL/dihedral_opls_intel.h +++ b/src/USER-INTEL/dihedral_opls_intel.h @@ -62,7 +62,7 @@ class DihedralOPLSIntel : public DihedralOPLS { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index eacbc7ddcc..21cc106e31 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -303,7 +303,7 @@ void FixIntel::init() #endif const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != NULL) { + if (force->pair_match("^hybrid", 0) != nullptr) { _pair_hybrid_flag = 1; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR, @@ -513,9 +513,9 @@ void FixIntel::bond_init_check() "USER-INTEL package requires same setting for newton bond and non-bond."); int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -530,9 +530,9 @@ void FixIntel::bond_init_check() void FixIntel::kspace_init_check() { int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -855,7 +855,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, } } - if (ev_global != NULL) { + if (ev_global != nullptr) { force->pair->eng_vdwl += ev_global[0]; force->pair->eng_coul += ev_global[1]; force->pair->virial[0] += ev_global[2]; @@ -1168,7 +1168,7 @@ int FixIntel::set_host_affinity(const int nomp) sprintf(cmd, "lscpu -p | grep -v '#' |" "sort -t, -k 3,3n -k 2,2n | awk -F, '{print $1}'"); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; ncores = 0; while(fgets(readbuf, 512, p)) { proc_list[ncores] = atoi(readbuf); @@ -1190,7 +1190,7 @@ int FixIntel::set_host_affinity(const int nomp) int nthreads = nomp; if (nthreads == 0) { estring = getenv("OMP_NUM_THREADS"); - if (estring != NULL) { + if (estring != nullptr) { nthreads = atoi(estring); if (nthreads < 2) nthreads = 1; } else @@ -1222,7 +1222,7 @@ int FixIntel::set_host_affinity(const int nomp) if (coi_cores) { sprintf(cmd, "ps -Lp %d -o lwp | awk ' (NR > 2) {print}'", pid); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); @@ -1258,7 +1258,7 @@ int FixIntel::set_host_affinity(const int nomp) free(buf1); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); diff --git a/src/USER-INTEL/fix_intel.h b/src/USER-INTEL/fix_intel.h index 4c50164d31..df3aecbc81 100644 --- a/src/USER-INTEL/fix_intel.h +++ b/src/USER-INTEL/fix_intel.h @@ -167,8 +167,8 @@ class FixIntel : public Fix { inline void zero_timers() {} inline void start_watch(const int /*which*/) {} inline double stop_watch(const int /*which*/) { return 0.0; } - double * off_watch_pair() { return NULL; } - double * off_watch_neighbor() { return NULL; } + double * off_watch_pair() { return nullptr; } + double * off_watch_neighbor() { return nullptr; } inline void balance_stamp() {} inline void acc_timers() {} inline int separate_buffers() { return 0; } diff --git a/src/USER-INTEL/improper_cvff_intel.h b/src/USER-INTEL/improper_cvff_intel.h index 812b49d50c..94aa29c55f 100644 --- a/src/USER-INTEL/improper_cvff_intel.h +++ b/src/USER-INTEL/improper_cvff_intel.h @@ -62,7 +62,7 @@ class ImproperCvffIntel : public ImproperCvff { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/improper_harmonic_intel.h b/src/USER-INTEL/improper_harmonic_intel.h index 6d7c829961..ce1da11a33 100644 --- a/src/USER-INTEL/improper_harmonic_intel.h +++ b/src/USER-INTEL/improper_harmonic_intel.h @@ -62,7 +62,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index dc5b0fad5a..168074eb3e 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -123,9 +123,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, _buf_local_size = static_cast(nlocal) * 1.1 + 1; const int f_stride = get_stride(_buf_local_size); lmp->memory->create(_x, _buf_size,"intel_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_q, _buf_size, "intel_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_quat, _buf_size, "intel_quat"); #ifdef _LMP_INTEL_OFFLOAD if (lmp->force->newton_pair) @@ -139,9 +139,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) { lmp->memory->create(_host_x, _buf_size,"intel_host_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_host_q, _buf_size, "intel_host_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_host_quat, _buf_size, "intel_host_quat"); } @@ -154,24 +154,24 @@ void IntelBuffers::_grow(const int nall, const int nlocal, const flt_t * const q = get_q(); const vec3_acc_t * f_start = get_off_f(); acc_t * ev_global = get_ev_global(); - if (lmp->atom->q != NULL) { - if (x != NULL && q != NULL && f_start != NULL && ev_global != NULL) { + if (lmp->atom->q != nullptr) { + if (x != nullptr && q != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x,q:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } else { - if (x != NULL && f_start != NULL && ev_global != NULL) { + if (x != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } - if (lmp->atom->ellipsoid != NULL) { + if (lmp->atom->ellipsoid != nullptr) { const quat_t * const quat = get_quat(); - if (quat != NULL) { + if (quat != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(quat:length(_buf_size) alloc_if(1) free_if(0)) } @@ -252,7 +252,7 @@ void IntelBuffers::free_list_local() int * cnumneigh = _neigh_list_ptrs[0].cnumneigh; _neigh_list_ptrs[0].cnumneigh = 0; #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cnumneigh:alloc_if(0) free_if(1)) } @@ -261,11 +261,11 @@ void IntelBuffers::free_list_local() } #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { const int * ilist = _off_map_ilist; const int * numneigh = _off_map_numneigh; const int ** firstneigh = (const int **)_off_map_firstneigh; - _off_map_ilist = NULL; + _off_map_ilist = nullptr; #pragma offload_transfer target(mic:_cop) \ nocopy(ilist,firstneigh,numneigh:alloc_if(0) free_if(1)) } @@ -402,7 +402,7 @@ void IntelBuffers::_grow_nbor_list(NeighList * /*list*/, if (offload_end > 0) { int * list_alloc =_list_alloc; - if (list_alloc != NULL) { + if (list_alloc != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(list_alloc:length(list_alloc_size) alloc_if(1) free_if(0)) _off_list_alloc = true; @@ -497,8 +497,8 @@ void IntelBuffers::grow_ccache(const int off_flag, int *ccachei = _ccachei; int *ccachej = _ccachej; - if (ccachex != NULL && ccachey !=NULL && ccachez != NULL && - ccachew != NULL && ccachei != NULL && ccachej !=NULL) { + if (ccachex != nullptr && ccachey !=nullptr && ccachez != nullptr && + ccachew != nullptr && ccachei != nullptr && ccachej !=nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachex,ccachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ccachez,ccachew:length(vsize) alloc_if(1) free_if(0)) \ @@ -506,7 +506,7 @@ void IntelBuffers::grow_ccache(const int off_flag, in(ccachej:length(vsize) alloc_if(1) free_if(0)) } #ifdef LMP_USE_AVXCD - if (ccachef != NULL) { + if (ccachef != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachef:length(_ccache_stride3 * nt) alloc_if(1) free_if(0)) } @@ -595,8 +595,8 @@ void IntelBuffers::grow_ncache(const int off_flag, int *ncachej = _ncachej; int *ncachejtype = _ncachejtype; - if (ncachex != NULL && ncachey !=NULL && ncachez != NULL && - ncachej != NULL && ncachejtype != NULL) { + if (ncachex != nullptr && ncachey !=nullptr && ncachez != nullptr && + ncachej != nullptr && ncachejtype != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ncachex,ncachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ncachez,ncachej:length(vsize) alloc_if(1) free_if(0)) \ @@ -674,13 +674,13 @@ void IntelBuffers::set_ntypes(const int ntypes, #ifdef _LMP_INTEL_OFFLOAD flt_t * cutneighsqo = _cutneighsq[0]; const int ntypes2 = ntypes * ntypes; - if (_off_threads > 0 && cutneighsqo != NULL) { + if (_off_threads > 0 && cutneighsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighsqo:length(ntypes2) alloc_if(1) free_if(0)) } if (use_ghost_cut) { flt_t * cutneighghostsqo = _cutneighghostsq[0]; - if (_off_threads > 0 && cutneighghostsqo != NULL) { + if (_off_threads > 0 && cutneighghostsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighghostsqo:length(ntypes2) alloc_if(1) free_if(0)) } diff --git a/src/USER-INTEL/intel_buffers.h b/src/USER-INTEL/intel_buffers.h index f3c07da7c2..86fc921c9e 100644 --- a/src/USER-INTEL/intel_buffers.h +++ b/src/USER-INTEL/intel_buffers.h @@ -211,7 +211,7 @@ class IntelBuffers { _x[i].z = lmp->atom->x[i][2]; _x[i].w = lmp->atom->type[i]; } - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) #if defined(LMP_SIMD_COMPILER) #pragma vector aligned #pragma ivdep @@ -296,7 +296,7 @@ class IntelBuffers { _host_x[nall].y = INTEL_BIGP; _host_x[nall].z = INTEL_BIGP; _host_x[nall].w = 1; - if (lmp->atom->q != NULL) { + if (lmp->atom->q != nullptr) { memcpy(_host_q + host_min_local, _q + host_min_local, used_local * sizeof(flt_t)); memcpy(_host_q + host_min_local + used_local, _q + host_min_ghost, diff --git a/src/USER-INTEL/intel_preprocess.h b/src/USER-INTEL/intel_preprocess.h index 2515e47c52..3e547b58a0 100644 --- a/src/USER-INTEL/intel_preprocess.h +++ b/src/USER-INTEL/intel_preprocess.h @@ -528,7 +528,7 @@ inline double MIC_Wtime() { double time; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); time = 1.0 * tv.tv_sec + 1.0e-6 * tv.tv_usec; return time; } diff --git a/src/USER-INTEL/nbin_intel.cpp b/src/USER-INTEL/nbin_intel.cpp index 4a046bc845..9dfc3b8995 100644 --- a/src/USER-INTEL/nbin_intel.cpp +++ b/src/USER-INTEL/nbin_intel.cpp @@ -35,8 +35,8 @@ NBinIntel::NBinIntel(LAMMPS *lmp) : NBinStandard(lmp) { "The 'package intel' command is required for /intel styles"); _fix = static_cast(modify->fix[ifix]); _precision_mode = _fix->precision(); - _atombin = NULL; - _binpacked = NULL; + _atombin = nullptr; + _binpacked = nullptr; #ifdef _LMP_INTEL_OFFLOAD _cop = _fix->coprocessor_number(); _offload_alloc = 0; diff --git a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp index bd4a95f774..737c2d1333 100644 --- a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp @@ -119,8 +119,8 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular) { diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index 9aae0d27b7..392e7bd8c4 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -125,8 +125,8 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular) { diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index 6b576220fe..d5192f2008 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -159,10 +159,10 @@ void aut_frebo(KernelArgsAIREBOT * ka, int torsion_flag); PairAIREBOIntel::PairAIREBOIntel(LAMMPS *lmp) : PairAIREBO(lmp) { suffix_flag |= Suffix::INTEL; - REBO_cnumneigh = NULL; - REBO_num_skin = NULL; - REBO_list_data = NULL; - fix = NULL; + REBO_cnumneigh = nullptr; + REBO_num_skin = nullptr; + REBO_list_data = nullptr; + fix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -697,7 +697,7 @@ inline flt_t gSpline(KernelArgsAIREBOT * ka, int itype, flt_t cos, flt_t NCmin = ka->params.NCmin; flt_t NCmax = ka->params.NCmax; int index = 0; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; int offs = 0; if (itype == 0) { @@ -921,7 +921,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, if (pass == 0) { sum_pij += wik * g * ex_lam; sum_dpij_dN += wik * dgdN * ex_lam; - flt_t cutN = Sp(Nki, Nmin, Nmax, NULL); + flt_t cutN = Sp(Nki, Nmin, Nmax, nullptr); *sum_N += (1 - ktype) * wik * cutN; } else { flt_t tmp = -0.5 * pij * pij * pij; @@ -1583,9 +1583,9 @@ void ref_rebo_neigh(KernelArgsAIREBOT * ka) { flt_t rcmin = ka->params.rcmin[itype][jtype]; flt_t rcmax = ka->params.rcmax[itype][jtype]; if (jtype == CARBON) - ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); else - ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); } } ka->neigh_rebo.num[i] = n; @@ -2408,7 +2408,7 @@ static fvec aut_mask_gSpline_pd_2(KernelArgsAIREBOT * ka, bvec /*active_mask*/, int itype, fvec cosjik, fvec Nij, fvec *dgdc, fvec *dgdN) { int i; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; ivec offs = ivec::setzero(); fvec NCmin = fvec::set1(ka->params.NCmin); diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index a67db0ad32..41af529cab 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -502,8 +502,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -531,8 +531,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.h b/src/USER-INTEL/pair_buck_coul_cut_intel.h index 7204323903..4bc19ac157 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.h +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.h @@ -72,7 +72,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { c_cut_t **c_cut; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index d0cb1837c9..11ee79e5f2 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -617,10 +617,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -662,10 +662,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.h b/src/USER-INTEL/pair_buck_coul_long_intel.h index ec37c699c8..95492cd4e6 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.h +++ b/src/USER-INTEL/pair_buck_coul_long_intel.h @@ -73,7 +73,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index bb5b44d260..b4f57d2fae 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -449,8 +449,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: alloc_if(0) free_if(1)) \ @@ -473,8 +473,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_intel.h b/src/USER-INTEL/pair_buck_intel.h index ab5e135262..0e473c7c3f 100644 --- a/src/USER-INTEL/pair_buck_intel.h +++ b/src/USER-INTEL/pair_buck_intel.h @@ -69,7 +69,7 @@ private: c_energy_t **c_energy; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_dpd_intel.cpp b/src/USER-INTEL/pair_dpd_intel.cpp index 690496d546..40b6c891d0 100644 --- a/src/USER-INTEL/pair_dpd_intel.cpp +++ b/src/USER-INTEL/pair_dpd_intel.cpp @@ -37,7 +37,7 @@ PairDPDIntel::PairDPDIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - random_thread = NULL; + random_thread = nullptr; _nrandom_thread = 0; } diff --git a/src/USER-INTEL/pair_dpd_intel.h b/src/USER-INTEL/pair_dpd_intel.h index bce90a36b6..409e123f29 100644 --- a/src/USER-INTEL/pair_dpd_intel.h +++ b/src/USER-INTEL/pair_dpd_intel.h @@ -83,7 +83,7 @@ class PairDPDIntel : public PairDPD { int *rngi; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index 084714daf4..b93c9bc8c0 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 8786c0d782..2165f10aff 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -69,7 +69,7 @@ void PairEAMFSIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_intel.h b/src/USER-INTEL/pair_eam_intel.h index a9590f6b3d..b9ad11597a 100644 --- a/src/USER-INTEL/pair_eam_intel.h +++ b/src/USER-INTEL/pair_eam_intel.h @@ -76,7 +76,7 @@ class PairEAMIntel : public PairEAM { fc_packed2 *z2r_spline_t; ForceConst() : _ntypes(0), _nr(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index 30e61f67b9..423631ae87 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -958,7 +958,7 @@ void PairGayBerneIntel::pack_force_const(ForceConst &fc, FC_PACKED2_T *olj34 = fc.lj34[0]; FC_PACKED3_T *oic = fc.ic; int tp1sq = tp1 * tp1; - if (oijc != NULL && oic != NULL) { + if (oijc != nullptr && oic != nullptr) { #pragma offload_transfer target(mic:_cop) \ in(special_lj: length(4) alloc_if(0) free_if(0)) \ in(oijc,olj34: length(tp1sq) alloc_if(0) free_if(0)) \ @@ -990,9 +990,9 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int * ojtype_form = jtype_form[0]; int * ojlist_form = jlist_form[0]; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - orsq_form != NULL && odelx_form != NULL && odely_form != NULL && - odelz_form != NULL && ojtype_form != NULL && ojlist_form != NULL && + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + orsq_form != nullptr && odelx_form != nullptr && odely_form != nullptr && + odelz_form != nullptr && ojtype_form != nullptr && ojlist_form != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(ospecial_lj, oijc, olj34, oic: alloc_if(0) free_if(1)) \ @@ -1048,10 +1048,10 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int off_onel = one_length * nthreads; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - oic != NULL && orsq_form != NULL && odelx_form != NULL && - odely_form != NULL && odelz_form != NULL && ojtype_form !=NULL && - ojlist_form !=NULL && cop >= 0) { + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + oic != nullptr && orsq_form != nullptr && odelx_form != nullptr && + odely_form != nullptr && odelz_form != nullptr && ojtype_form !=nullptr && + ojlist_form !=nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(oijc,olj34: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_gayberne_intel.h b/src/USER-INTEL/pair_gayberne_intel.h index 07dfba14d1..ecdd93d353 100644 --- a/src/USER-INTEL/pair_gayberne_intel.h +++ b/src/USER-INTEL/pair_gayberne_intel.h @@ -74,7 +74,7 @@ class PairGayBerneIntel : public PairGayBerne { int **jtype_form, **jlist_form; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index c8e4a3d0ef..71f2e24557 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -555,8 +555,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ospecial_coul = special_coul; flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(ocutsq, olj: alloc_if(0) free_if(1)) @@ -577,8 +577,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h index a48a84b5ce..006dbaade2 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -69,7 +69,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { typename IntelBuffers::vec4_t **lj; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index 5a4069e199..8f106d8607 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -38,7 +38,7 @@ PairLJCharmmCoulLongIntel::PairLJCharmmCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -652,9 +652,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable != NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable != nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -693,9 +693,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable !=NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable !=nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h index 31b2182cb5..f5b46eaf76 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h @@ -72,7 +72,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { typename IntelBuffers::vec2_t **lj; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 34ab97fd35..ead3d5b5b4 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongIntel::PairLJCutCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -611,10 +611,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -652,10 +652,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h index 288a6a7bc4..6172313639 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h @@ -73,7 +73,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index b484cb68d9..281eef52db 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -36,7 +36,7 @@ PairLJCutIntel::PairLJCutIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-INTEL/pair_lj_cut_intel.h b/src/USER-INTEL/pair_lj_cut_intel.h index b577a04658..b88d213211 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.h +++ b/src/USER-INTEL/pair_lj_cut_intel.h @@ -67,7 +67,7 @@ class PairLJCutIntel : public PairLJCut { fc_packed2 **lj34; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp index 533252d018..ccde2d3a57 100644 --- a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp @@ -36,7 +36,7 @@ PairLJLongCoulLongIntel::PairLJLongCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 4ec2af40b0..d2a481a76e 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1277,8 +1277,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; #ifdef _LMP_INTEL_OFFLOAD - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && _cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(op2, op2f, op2f2, op2e, op3: alloc_if(0) free_if(1)) } @@ -1306,8 +1306,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; int tp1sq = ntypes * ntypes; int tp1cu = tp1sq * ntypes; - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(op2,op2f,op2f2,op2e: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(op3: length(tp1cu) alloc_if(1) free_if(0)) diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 5f7a511c9f..f345b3d4ff 100644 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -88,7 +88,7 @@ class PairSWIntel : public PairSW { fc_packed3 ***p3; ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 75f5f85f2d..db24692b6d 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -576,8 +576,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, c_cutoff_t * oc_cutoff_outer = c_cutoff_outer[0]; c_inner_t * oc_inner = c_inner[0][0]; c_outer_t * oc_outer = c_outer[0]; - if (c_first_loop != NULL && c_second_loop != NULL && - c_inner_loop != NULL && _cop >= 0) { + if (c_first_loop != nullptr && c_second_loop != nullptr && + c_inner_loop != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop, oc_second_loop, oc_inner_loop: alloc_if(0) free_if(1)) \ @@ -615,8 +615,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, int tp1sq = ntypes * ntypes; int tp1cb = ntypes * ntypes * ntypes; int tp1cb_pad = ntypes * ntypes * ntypes_pad; - if (oc_first_loop != NULL && oc_second_loop != NULL && - oc_inner_loop != NULL && cop >= 0) { + if (oc_first_loop != nullptr && oc_second_loop != nullptr && + oc_inner_loop != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(oc_second_loop: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_tersoff_intel.h b/src/USER-INTEL/pair_tersoff_intel.h index 6da478c10f..195efa74de 100644 --- a/src/USER-INTEL/pair_tersoff_intel.h +++ b/src/USER-INTEL/pair_tersoff_intel.h @@ -65,7 +65,7 @@ class PairTersoffIntel : public PairTersoff { c_outer_t * * c_outer; c_inner_t * * * c_inner; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 1149c9b2c3..8e958bf23b 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -68,18 +68,18 @@ PPPMDispIntel::PPPMDispIntel(LAMMPS *lmp) : PPPMDisp(lmp) order = 7; order_6 = 7; //sets default stencil sizes to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; - particle_ekx0 = particle_eky0 = particle_ekz0 = NULL; - particle_ekx1 = particle_eky1 = particle_ekz1 = NULL; - particle_ekx2 = particle_eky2 = particle_ekz2 = NULL; - particle_ekx3 = particle_eky3 = particle_ekz3 = NULL; - particle_ekx4 = particle_eky4 = particle_ekz4 = NULL; - particle_ekx5 = particle_eky5 = particle_ekz5 = NULL; - particle_ekx6 = particle_eky6 = particle_ekz6 = NULL; - - rho_lookup = drho_lookup = NULL; - rho6_lookup = drho6_lookup = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; + particle_ekx0 = particle_eky0 = particle_ekz0 = nullptr; + particle_ekx1 = particle_eky1 = particle_ekz1 = nullptr; + particle_ekx2 = particle_eky2 = particle_ekz2 = nullptr; + particle_ekx3 = particle_eky3 = particle_ekz3 = nullptr; + particle_ekx4 = particle_eky4 = particle_ekz4 = nullptr; + particle_ekx5 = particle_eky5 = particle_ekz5 = nullptr; + particle_ekx6 = particle_eky6 = particle_ekz6 = nullptr; + + rho_lookup = drho_lookup = nullptr; + rho6_lookup = drho6_lookup = nullptr; rho_points = 0; _use_table = _use_packing = _use_lrt = 0; diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index d596df4490..1a09522a2a 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -65,10 +65,10 @@ PPPMIntel::PPPMIntel(LAMMPS *lmp) : PPPM(lmp) order = 7; //sets default stencil size to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; - rho_lookup = drho_lookup = NULL; + rho_lookup = drho_lookup = nullptr; rho_points = 0; _use_table = _use_lrt = 0; diff --git a/src/USER-INTEL/verlet_lrt_intel.cpp b/src/USER-INTEL/verlet_lrt_intel.cpp index 4efed0d337..869330eadb 100644 --- a/src/USER-INTEL/verlet_lrt_intel.cpp +++ b/src/USER-INTEL/verlet_lrt_intel.cpp @@ -45,7 +45,7 @@ using namespace LAMMPS_NS; VerletLRTIntel::VerletLRTIntel(LAMMPS *lmp, int narg, char **arg) : Verlet(lmp, narg, arg) { #if defined(_LMP_INTEL_LRT_PTHREAD) - pthread_mutex_init(&_kmutex,NULL); + pthread_mutex_init(&_kmutex,nullptr); #endif } @@ -119,7 +119,7 @@ void VerletLRTIntel::setup(int flag) _kspace_ready = 0; _kspace_done = 0; - pthread_cond_init(&_kcond, NULL); + pthread_cond_init(&_kcond, nullptr); pthread_attr_init(&_kspace_attr); pthread_attr_setdetachstate(&_kspace_attr, PTHREAD_CREATE_JOINABLE); #endif @@ -377,7 +377,7 @@ void VerletLRTIntel::run(int n) _kspace_done = 0; pthread_cond_signal(&_kcond); pthread_mutex_unlock(&_kmutex); - pthread_join(_kspace_thread, NULL); + pthread_join(_kspace_thread, nullptr); pthread_attr_destroy(&_kspace_attr); } #endif @@ -428,8 +428,8 @@ void * VerletLRTIntel::k_launch_loop(void *context) pthread_mutex_unlock(&(c->_kmutex)); } - pthread_exit(NULL); - return NULL; + pthread_exit(nullptr); + return nullptr; } #endif diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index 204a9c073b..652b142b99 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -116,8 +116,8 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setArea = 0; numvel = 15; - Gamma = NULL; - NodeArea = NULL; + Gamma = nullptr; + NodeArea = nullptr; int iarg = 7; while (iarg < narg){ @@ -129,7 +129,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : double areafactor = atof(arg[iarg+2]); if(itype <= 0 || itype > atom->ntypes || areafactor < 0.0) error->all(FLERR,"Illegal fix lb/fluid command: setArea"); - if(NodeArea == NULL){ + if(NodeArea == nullptr){ NodeArea = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; } @@ -142,7 +142,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setGamma = 1; double Gammaone; Gammaone = atof(arg[iarg+1]); - if(Gamma == NULL) + if(Gamma == nullptr) Gamma = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) Gamma[i] = Gammaone; iarg += 2; @@ -240,7 +240,7 @@ a z wall velocity without implementing fixed BCs in z"); // perform initial allocation of atom-based array register // with Atom class //-------------------------------------------------------------------------- - hydroF = NULL; + hydroF = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -248,24 +248,24 @@ a z wall velocity without implementing fixed BCs in z"); for(int j=0; j<3; j++) hydroF[i][j] = 0.0; - Ng_lb = NULL; - w_lb = NULL; - mg_lb = NULL; - e = NULL; - feq = NULL; - feqold = NULL; - feqn = NULL; - feqoldn = NULL; - f_lb = NULL; - fnew = NULL; - density_lb = NULL; - u_lb = NULL; - altogether = NULL; - buf = NULL; - Ff = NULL; - Fftempx = NULL; - Fftempy = NULL; - Fftempz = NULL; + Ng_lb = nullptr; + w_lb = nullptr; + mg_lb = nullptr; + e = nullptr; + feq = nullptr; + feqold = nullptr; + feqn = nullptr; + feqoldn = nullptr; + f_lb = nullptr; + fnew = nullptr; + density_lb = nullptr; + u_lb = nullptr; + altogether = nullptr; + buf = nullptr; + Ff = nullptr; + Fftempx = nullptr; + Fftempy = nullptr; + Fftempz = nullptr; //-------------------------------------------------------------------------- // Set the lattice Boltzmann dt. diff --git a/src/USER-LB/fix_lb_pc.cpp b/src/USER-LB/fix_lb_pc.cpp index 2c7e8dbf47..3c31dc93f4 100644 --- a/src/USER-LB/fix_lb_pc.cpp +++ b/src/USER-LB/fix_lb_pc.cpp @@ -45,9 +45,9 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - force_old = NULL; - up = NULL; - up_old = NULL; + force_old = nullptr; + up = nullptr; + up_old = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index f714e31719..741a23c293 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -54,8 +54,8 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - body = NULL; - up = NULL; + body = nullptr; + up = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index 59fddebd67..602ec29f00 100644 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -88,7 +88,7 @@ void FixLbViscous::init() void FixLbViscous::setup(int vflag) { - if (strstr(update->integrate_style,"verlet") != NULL) + if (strstr(update->integrate_style,"verlet") != nullptr) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 732ba0909e..3193b23d6e 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -76,7 +76,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : } ptr_m->params = new double[nvars]; - if (ptr_m->params == NULL) { + if (ptr_m->params == nullptr) { error->all(FLERR,"Parameter pointer was NULL!"); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index b3122a68d4..abe903125b 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -129,7 +129,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, is_var[i] = 0; } tstrs[i] = new char[len]; - if (tstrs[i] == NULL ) error->all(FLERR,"Error allocating space for args."); + if (tstrs[i] == nullptr ) error->all(FLERR,"Error allocating space for args."); strcpy( tstrs[i], arg[i+6] + offset ); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h index 42da240abc..7ed1f75fa8 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h @@ -125,7 +125,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -136,7 +136,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h index f42902f721..69e4eb13e1 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h @@ -112,7 +112,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -123,7 +123,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/manifold.h b/src/USER-MANIFOLD/manifold.h index b0727c346d..9adf7055c7 100644 --- a/src/USER-MANIFOLD/manifold.h +++ b/src/USER-MANIFOLD/manifold.h @@ -46,7 +46,7 @@ namespace user_manifold { // Abstract base class. class manifold : protected Pointers { public: - manifold(class LAMMPS* lmp) : Pointers(lmp), params(NULL){ } + manifold(class LAMMPS* lmp) : Pointers(lmp), params(nullptr){ } virtual ~manifold(){ delete[] params; } virtual double g( const double * ) = 0; virtual void n( const double *, double * ) = 0; diff --git a/src/USER-MANIFOLD/manifold_factory.cpp b/src/USER-MANIFOLD/manifold_factory.cpp index 7df3e52ed7..fe9b7615b3 100644 --- a/src/USER-MANIFOLD/manifold_factory.cpp +++ b/src/USER-MANIFOLD/manifold_factory.cpp @@ -54,7 +54,7 @@ manifold* LAMMPS_NS::user_manifold::create_manifold(const char *mname, LAMMPS *lmp, int narg, char **arg ) { - manifold *man = NULL; + manifold *man = nullptr; make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); diff --git a/src/USER-MANIFOLD/manifold_factory.h b/src/USER-MANIFOLD/manifold_factory.h index 85ee4011be..1eac8bf644 100644 --- a/src/USER-MANIFOLD/manifold_factory.h +++ b/src/USER-MANIFOLD/manifold_factory.h @@ -94,7 +94,7 @@ class manifold; LAMMPS *lmp, int narg, char **arg ) { if( strcmp( m_type::type(), name ) == 0 ){ - if( *man_ptr == NULL ){ + if( *man_ptr == nullptr ){ *man_ptr = new m_type(lmp, narg, arg); } } diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index ef26999295..7b0d7d4d3a 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -136,7 +136,7 @@ public: // Manifold itself: manifold_gaussian_bump::manifold_gaussian_bump(class LAMMPS* lmp, int /*narg*/, char **/*arg*/) - : manifold(lmp), lut_z(NULL), lut_zp(NULL) {} + : manifold(lmp), lut_z(nullptr), lut_zp(nullptr) {} manifold_gaussian_bump::~manifold_gaussian_bump() diff --git a/src/USER-MANIFOLD/manifold_thylakoid.cpp b/src/USER-MANIFOLD/manifold_thylakoid.cpp index ee86a50bf2..a1d2c7a62f 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid.cpp @@ -123,14 +123,14 @@ thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_fla for( std::size_t i = 0; i < parts.size(); ++i ){ thyla_part *p = parts[i]; if (is_in_domain(p,x)) { - if (idx != NULL) *idx = i; + if (idx != nullptr) *idx = i; return p; } } char msg[2048]; sprintf(msg,"Could not find thyla_part for x = (%f,%f,%f)", x[0],x[1],x[2]); error->one(FLERR,msg); - return NULL; + return nullptr; } diff --git a/src/USER-MANIFOLD/manifold_thylakoid.h b/src/USER-MANIFOLD/manifold_thylakoid.h index 35ad4dfd9c..d3ffa67765 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.h +++ b/src/USER-MANIFOLD/manifold_thylakoid.h @@ -29,7 +29,7 @@ namespace user_manifold { private: void init_domains(); - thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = NULL ); + thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = nullptr ); int is_in_domain( thyla_part *p, const double *x ); void check_overlap(); std::vector parts; diff --git a/src/USER-MEAMC/meam_impl.cpp b/src/USER-MEAMC/meam_impl.cpp index a546aa0c7f..147be92463 100644 --- a/src/USER-MEAMC/meam_impl.cpp +++ b/src/USER-MEAMC/meam_impl.cpp @@ -28,15 +28,15 @@ using namespace LAMMPS_NS; MEAM::MEAM(Memory* mem) : memory(mem) { - phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = NULL; + phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = nullptr; nmax = 0; - rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL; - gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL; - arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = NULL; + rho = rho0 = rho1 = rho2 = rho3 = frhop = nullptr; + gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = nullptr; + arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = nullptr; maxneigh = 0; - scrfcn = dscrfcn = fcpair = NULL; + scrfcn = dscrfcn = fcpair = nullptr; neltypes = 0; for (int i = 0; i < maxelt; i++) { diff --git a/src/USER-MEAMC/meam_setup_done.cpp b/src/USER-MEAMC/meam_setup_done.cpp index ddbb40310c..f8703f10e5 100644 --- a/src/USER-MEAMC/meam_setup_done.cpp +++ b/src/USER-MEAMC/meam_setup_done.cpp @@ -186,21 +186,21 @@ MEAM::compute_pair_meam(void) double C, s111, s112, s221, S11, S22; // check for previously allocated arrays and free them - if (this->phir != NULL) + if (this->phir != nullptr) memory->destroy(this->phir); - if (this->phirar != NULL) + if (this->phirar != nullptr) memory->destroy(this->phirar); - if (this->phirar1 != NULL) + if (this->phirar1 != nullptr) memory->destroy(this->phirar1); - if (this->phirar2 != NULL) + if (this->phirar2 != nullptr) memory->destroy(this->phirar2); - if (this->phirar3 != NULL) + if (this->phirar3 != nullptr) memory->destroy(this->phirar3); - if (this->phirar4 != NULL) + if (this->phirar4 != nullptr) memory->destroy(this->phirar4); - if (this->phirar5 != NULL) + if (this->phirar5 != nullptr) memory->destroy(this->phirar5); - if (this->phirar6 != NULL) + if (this->phirar6 != nullptr) memory->destroy(this->phirar6); // allocate memory for array that defines the potential diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 6f674c9f45..133bb611ca 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -56,10 +56,10 @@ PairMEAMC::PairMEAMC(LAMMPS *lmp) : Pair(lmp) allocated = 0; nelements = 0; - elements = NULL; - mass = NULL; + elements = nullptr; + mass = nullptr; meam_inst = new MEAM(memory); - scale = NULL; + scale = nullptr; // set comm size needed by this Pair @@ -161,7 +161,7 @@ void PairMEAMC::compute(int eflag, int vflag) double **vptr; if (vflag_atom) vptr = vatom; - else vptr = NULL; + else vptr = nullptr; for (ii = 0; ii < inum_half; ii++) { i = ilist_half[ii]; @@ -365,7 +365,7 @@ void PairMEAMC::read_files(const std::string &globalfile, FILE *fp; if (comm->me == 0) { fp = utils::open_potential(globalfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", globalfile)); } @@ -408,7 +408,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (1) { char *ptr; ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -424,7 +424,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (nwords < params_per_line) { int n = strlen(line); ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -440,7 +440,7 @@ void PairMEAMC::read_files(const std::string &globalfile, nwords = 0; words[nwords++] = strtok(line,"' \t\n\r\f"); - while ((words[nwords++] = strtok(NULL,"' \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr,"' \t\n\r\f"))) continue; // skip if element name isn't in element list @@ -556,7 +556,7 @@ void PairMEAMC::read_files(const std::string &globalfile, delete [] rozero; delete [] found; - // done if user param file is NULL + // done if user param file is nullptr if (userfile == "NULL") return; @@ -564,7 +564,7 @@ void PairMEAMC::read_files(const std::string &globalfile, if (comm->me == 0) { fp = utils::open_potential(userfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", userfile)); } @@ -584,7 +584,7 @@ void PairMEAMC::read_files(const std::string &globalfile, char *ptr; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); nline = -1; } else nline = strlen(line) + 1; @@ -603,7 +603,7 @@ void PairMEAMC::read_files(const std::string &globalfile, int nparams = 0; params[nparams++] = strtok(line,"=(), '\t\n\r\f"); while (nparams < maxparams && - (params[nparams++] = strtok(NULL,"=(), '\t\n\r\f"))) + (params[nparams++] = strtok(nullptr,"=(), '\t\n\r\f"))) continue; nparams--; @@ -837,5 +837,5 @@ void *PairMEAMC::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MESODPD/compute_edpd_temp_atom.cpp b/src/USER-MESODPD/compute_edpd_temp_atom.cpp index 9eb6e9752b..02aa3e7311 100644 --- a/src/USER-MESODPD/compute_edpd_temp_atom.cpp +++ b/src/USER-MESODPD/compute_edpd_temp_atom.cpp @@ -34,7 +34,7 @@ ComputeEDPDTempAtom::ComputeEDPDTempAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - temp_vector = NULL; + temp_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp index 7e9d5eb29e..d87d645b6e 100644 --- a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp +++ b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp @@ -38,7 +38,7 @@ ComputeTDPDCCAtom::ComputeTDPDCCAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - cc_vector = NULL; + cc_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index 9c2e74b882..36ad434f42 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -65,8 +65,8 @@ PairEDPD::PairEDPD(LAMMPS *lmp) : Pair(lmp) { if (lmp->citeme) lmp->citeme->add(cite_pair_edpd); writedata = 1; - random = NULL; - randomT = NULL; + random = nullptr; + randomT = nullptr; } /* ---------------------------------------------------------------------- */ @@ -453,24 +453,24 @@ void PairEDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,nullptr,error); if(power_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,nullptr,error); if(kappa_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -508,9 +508,9 @@ void PairEDPD::write_restart_settings(FILE *fp) void PairEDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 88b6724a03..62a2ca8d1c 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -54,7 +54,7 @@ PairMDPD::PairMDPD(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_pair_mdpd); writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -348,15 +348,15 @@ void PairMDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&A_att[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&B_rep[i][j],1,MPI_DOUBLE,0,world); @@ -386,10 +386,10 @@ void PairMDPD::write_restart_settings(FILE *fp) void PairMDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index 65a518c07e..b1ffb5ce8d 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -57,7 +57,7 @@ PairTDPD::PairTDPD(LAMMPS *lmp) : Pair(lmp) cc_species = atom->cc_species; writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -395,19 +395,19 @@ void PairTDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,nullptr,error); for(int k=0; kme == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESONT/compute_mesont.cpp b/src/USER-MESONT/compute_mesont.cpp index 96792c8988..0321be7c56 100644 --- a/src/USER-MESONT/compute_mesont.cpp +++ b/src/USER-MESONT/compute_mesont.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeMesoNT::ComputeMesoNT(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), energy(NULL) { + Compute(lmp, narg, arg), energy(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute mesont command"); std::string ctype = arg[3]; if (ctype == "estretch") compute_type = ES; @@ -62,7 +62,7 @@ double ComputeMesoNT::compute_scalar() { error->all(FLERR,"Energy was not tallied on needed timestep"); int i; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es_tot",i)); else if (compute_type == EB) @@ -104,7 +104,7 @@ void ComputeMesoNT::compute_peratom() { int i; // clear local energy array for (int i = 0; i < ntotal; i++) energy[i] = 0.0; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es",i)); else if (compute_type == EB) diff --git a/src/USER-MESONT/pair_mesocnt.cpp b/src/USER-MESONT/pair_mesocnt.cpp index 96d53bd41a..a7b4bf0575 100644 --- a/src/USER-MESONT/pair_mesocnt.cpp +++ b/src/USER-MESONT/pair_mesocnt.cpp @@ -244,7 +244,7 @@ void PairMesoCNT::compute(int eflag, int vflag) // infinite CNT case if (endflag == 0) { - geometry(r1,r2,p1,p2,NULL,p,m,param,basis); + geometry(r1,r2,p1,p2,nullptr,p,m,param,basis); if (param[0] > cutoff) continue; finf(param,evdwl,flocal); @@ -760,7 +760,7 @@ void PairMesoCNT::read_file() // open file fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open mesocnt file: {}",file)); utils::sfgets(FLERR,line,MAXLINE,fp,file,error); @@ -846,7 +846,7 @@ void PairMesoCNT::read_data(FILE *fp, double *data, double x,xtemp,dxtemp; for (int i = 0; i < ninput; i++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (i > 0) xtemp = x; @@ -899,7 +899,7 @@ void PairMesoCNT::read_data(FILE *fp, double **data, for (int i = 0; i < ninput; i++) { if (i > 0) xtemp = x; for (int j = 0; j < ninput; j++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (j > 0) ytemp = y; diff --git a/src/USER-MESONT/pair_mesont_tpm.cpp b/src/USER-MESONT/pair_mesont_tpm.cpp index 6d8c8126ae..4e5f31c661 100644 --- a/src/USER-MESONT/pair_mesont_tpm.cpp +++ b/src/USER-MESONT/pair_mesont_tpm.cpp @@ -166,7 +166,7 @@ void vector_union(std::vector& v1, std::vector& v2, } MESONTList::MESONTList(const Atom* atom, const NeighList* nblist, double /* rc2 */){ - if (atom == NULL || nblist == NULL) return; + if (atom == nullptr || nblist == nullptr) return; //number of local atoms at the node int nlocal = atom->nlocal; //total number of atoms in the node and ghost shell @@ -305,12 +305,12 @@ PairMESONTTPM::PairMESONTTPM(LAMMPS *lmp) : Pair(lmp) { writedata=1; BendingMode = 0; // Harmonic bending model TPMType = 0; // Inter-tube segment-segment interaction - tab_path = NULL; + tab_path = nullptr; tab_path_length = 0; - eatom_s = NULL; - eatom_b = NULL; - eatom_t = NULL; + eatom_s = nullptr; + eatom_b = nullptr; + eatom_t = nullptr; instance_count++; if(instance_count > 1) error->all(FLERR, "only a single instance of mesont/tpm pair style can be created"); @@ -330,7 +330,7 @@ PairMESONTTPM::~PairMESONTTPM() memory->destroy(eatom_t); } instance_count--; - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); } /* ---------------------------------------------------------------------- */ @@ -597,7 +597,7 @@ void PairMESONTTPM::settings(int narg, char **arg){ } std::string TPMAFile = (narg > 1) ? arg[1] : "MESONT-TABTP.xrs"; tab_path_length = TPMAFile.length(); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); //c_str returns '\0' terminated string memory->create(tab_path,tab_path_length+1,"pair:path"); std::memcpy(tab_path, TPMAFile.c_str(), tab_path_length+1); @@ -738,7 +738,7 @@ void PairMESONTTPM::read_restart_settings(FILE *fp){ MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&tab_path_length,1,MPI_INT,0,world); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); memory->create(tab_path,tab_path_length+1,"pair:path"); if (me == 0) fread(tab_path,tab_path_length+1,1,fp); MPI_Bcast(tab_path,tab_path_length+1,MPI_CHAR,0,world); @@ -793,5 +793,5 @@ void* PairMESONTTPM::extract(const char *str, int &){ else if (strcmp(str,"mesonttpm_Es") == 0) return eatom_s; else if (strcmp(str,"mesonttpm_Eb") == 0) return eatom_b; else if (strcmp(str,"mesonttpm_Et") == 0) return eatom_t; - else return NULL; + else return nullptr; }; diff --git a/src/USER-MGPT/mgpt_readpot.cpp b/src/USER-MGPT/mgpt_readpot.cpp index 144c661b05..c5f7c75d73 100644 --- a/src/USER-MGPT/mgpt_readpot.cpp +++ b/src/USER-MGPT/mgpt_readpot.cpp @@ -66,7 +66,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub FILE *in = fopen(potin_file,"r"); char line[1024]; - if(in == NULL) { + if(in == nullptr) { fprintf(stderr,"@%s:%d: Error reading potin file. Can not open file \'%s\'.\n", __FILE__,__LINE__,potin_file); exit(1); @@ -75,7 +75,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub vsize = 10; volarr = (double *) malloc(sizeof(double) * vsize); n = 0; - while(fgets(line,sizeof(line),in) != NULL) { + while(fgets(line,sizeof(line),in) != nullptr) { double zval,ivol,rws,mass; double r0x,r1x,drx; int nrx,i; @@ -408,7 +408,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; if(0) if(fabs(vol-ivol) < 0.01) { - static FILE *xfile = NULL; + static FILE *xfile = nullptr; if(j == 0) { xfile = fopen("mgpt5-pot.dat","w"); fprintf(xfile,"%%%% vol = %15.5e ivol = %15.5e i = %d ii = %d\n", diff --git a/src/USER-MGPT/mgpt_readpot.h b/src/USER-MGPT/mgpt_readpot.h index 8f46592e8a..c2a6feabe0 100644 --- a/src/USER-MGPT/mgpt_readpot.h +++ b/src/USER-MGPT/mgpt_readpot.h @@ -172,7 +172,7 @@ struct potdata2 { strcpy(s,nametemplate); p = strchr(s,'{'); - if(p != NULL) { + if(p != nullptr) { if(sscanf(p+1,"%d:%d:%d",i0,stride,i1) != 3) { fprintf(stderr,"Error in template (\'%s\'), can not parse range.\n",nametemplate); exit(1); @@ -217,12 +217,12 @@ struct potdata2 { const char *parmin_suffix = strchr(parmin_template,'}')+1; const char * potin_suffix = strchr( potin_template,'}')+1; - if(parmin_suffix-1 == NULL) { + if(parmin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. parmin_template=\'%s\'\n", parmin_template); exit(1); } - if(potin_suffix-1 == NULL) { + if(potin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. potin_template=\'%s\'\n", potin_template); exit(1); diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 070e3cb61e..dd48295357 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -54,7 +54,7 @@ static double gettime(int x = 0) { if(1) { /* struct timeval tv; - gettimeofday(&tv,NULL); + gettimeofday(&tv,nullptr); return tv.tv_sec + 1e-6 * tv.tv_usec; */ /* @@ -1859,7 +1859,7 @@ void PairMGPT::coeff(int narg, char **arg) if(strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { nbody_flag = 0; for(int i = 0; i<4; i++) - if(strchr(arg[iarg+1],'1'+i) != NULL) { + if(strchr(arg[iarg+1],'1'+i) != nullptr) { nbody_flag = nbody_flag + (1<me == 0) printf("Explicitly adding %d-tuple forces.\n",i+1); } @@ -1906,7 +1906,7 @@ void PairMGPT::coeff(int narg, char **arg) if(comm->me == 0) { FILE *parmin_fp = utils::open_potential(arg[2],lmp,nullptr); FILE *potin_fp = utils::open_potential(arg[3],lmp,nullptr); - if (parmin_fp == NULL || potin_fp == NULL) { + if (parmin_fp == nullptr || potin_fp == nullptr) { char str[128]; sprintf(str,"Cannot open MGPT potential files %s %s",arg[2],arg[3]); error->one(FLERR,str); diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index a986cb8322..f6427171a7 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -37,7 +37,7 @@ using namespace MathConst; AngleCosineShift::AngleCosineShift(LAMMPS *lmp) : Angle(lmp) { - kcost = NULL; + kcost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -225,10 +225,10 @@ void AngleCosineShift::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&kcost[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index 52bfe751f1..9e98c319f4 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -37,13 +37,13 @@ using namespace MathConst; AngleCosineShiftExp::AngleCosineShiftExp(LAMMPS *lmp) : Angle(lmp) { - doExpansion = NULL; - umin = NULL; - a = NULL; - opt1 = NULL; - theta0 = NULL; - sint = NULL; - cost = NULL; + doExpansion = nullptr; + umin = nullptr; + a = nullptr; + opt1 = nullptr; + theta0 = nullptr; + sint = nullptr; + cost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -257,11 +257,11 @@ void AngleCosineShiftExp::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index 336638f25d..6715bd1186 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -35,8 +35,8 @@ using namespace MathConst; AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - gamma0 = NULL; + k = nullptr; + gamma0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -206,8 +206,8 @@ void AngleDipole::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&gamma0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index 907ee973bd..fc14736a07 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -38,10 +38,10 @@ using namespace MathConst; AngleFourier::AngleFourier(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C0 = NULL; - C1 = NULL; - C2 = NULL; + k = nullptr; + C0 = nullptr; + C1 = nullptr; + C2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -232,10 +232,10 @@ void AngleFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index 8894f7b4c9..abd02535cf 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -38,9 +38,9 @@ using namespace MathConst; AngleFourierSimple::AngleFourierSimple(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C = NULL; - N = NULL; + k = nullptr; + C = nullptr; + N = nullptr; } /* ---------------------------------------------------------------------- */ @@ -238,9 +238,9 @@ void AngleFourierSimple::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 93f45f9562..50a73af7b5 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -233,10 +233,10 @@ void AngleQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&k3[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index 5889400b97..28badce911 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -177,9 +177,9 @@ void BondHarmonicShift::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index 86e6263f93..b875fb71b2 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -179,9 +179,9 @@ void BondHarmonicShiftCut::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_special.cpp b/src/USER-MISC/bond_special.cpp index 87671655b1..4f79fea519 100644 --- a/src/USER-MISC/bond_special.cpp +++ b/src/USER-MISC/bond_special.cpp @@ -44,7 +44,7 @@ BondSpecial::~BondSpecial() void BondSpecial::init_style() { - if (force->pair == NULL) error->all(FLERR,"No pair style defined"); + if (force->pair == nullptr) error->all(FLERR,"No pair style defined"); else if ((force->pair->single_enable == 0) || force->pair->manybody_flag) error->all(FLERR,"Pair style does not support bond style special"); @@ -59,7 +59,7 @@ void BondSpecial::init_style() force->special_coul[3] != 1.0)) error->all(FLERR,"Invalid 1-4 setting for bond style special."); - if (force->kspace != NULL) + if (force->kspace != nullptr) error->all(FLERR,"Bond style special is not compatible with long range " "Coulombic interactions"); } diff --git a/src/USER-MISC/compute_ackland_atom.cpp b/src/USER-MISC/compute_ackland_atom.cpp index bcf41591eb..df0636d7b9 100644 --- a/src/USER-MISC/compute_ackland_atom.cpp +++ b/src/USER-MISC/compute_ackland_atom.cpp @@ -48,13 +48,13 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - structure = NULL; + structure = nullptr; maxneigh = 0; legacy = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; int iarg = 3; while (narg > iarg) { diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index 3b9b38343d..fa59a02575 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -44,12 +44,12 @@ ComputeBasalAtom::ComputeBasalAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 3; nmax = 0; - BPV = NULL; + BPV = nullptr; maxneigh = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/compute_cnp_atom.cpp b/src/USER-MISC/compute_cnp_atom.cpp index 52656ec9d6..5efab292b5 100644 --- a/src/USER-MISC/compute_cnp_atom.cpp +++ b/src/USER-MISC/compute_cnp_atom.cpp @@ -49,7 +49,7 @@ enum{NCOMMON}; ComputeCNPAtom::ComputeCNPAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), cnpv(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), cnpv(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cnp/atom command"); @@ -92,7 +92,7 @@ ComputeCNPAtom::~ComputeCNPAtom() void ComputeCNPAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cnp/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index d539d51e99..2a308c427f 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -40,7 +40,7 @@ using namespace MathConst; ComputeEntropyAtom:: ComputeEntropyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pair_entropy(NULL), pair_entropy_avg(NULL) + pair_entropy(nullptr), pair_entropy_avg(nullptr) { if (narg < 5 || narg > 10) error->all(FLERR,"Illegal compute entropy/atom command; wrong number" @@ -118,7 +118,7 @@ ComputeEntropyAtom::~ComputeEntropyAtom() void ComputeEntropyAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute entropy/atom requires a pair style be" " defined"); diff --git a/src/USER-MISC/compute_gyration_shape.cpp b/src/USER-MISC/compute_gyration_shape.cpp index aef5ef91a3..6aef8c80ec 100644 --- a/src/USER-MISC/compute_gyration_shape.cpp +++ b/src/USER-MISC/compute_gyration_shape.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShape::ComputeGyrationShape(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration(NULL) + Compute(lmp, narg, arg), id_gyration(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape command"); diff --git a/src/USER-MISC/compute_gyration_shape_chunk.cpp b/src/USER-MISC/compute_gyration_shape_chunk.cpp index 116d851024..2c9bf9d3ed 100644 --- a/src/USER-MISC/compute_gyration_shape_chunk.cpp +++ b/src/USER-MISC/compute_gyration_shape_chunk.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShapeChunk::ComputeGyrationShapeChunk(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration_chunk(NULL), shape_parameters(NULL) + Compute(lmp, narg, arg), id_gyration_chunk(nullptr), shape_parameters(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command"); diff --git a/src/USER-MISC/compute_hma.cpp b/src/USER-MISC/compute_hma.cpp index f2ccf2694d..f7a9f9fcfa 100644 --- a/src/USER-MISC/compute_hma.cpp +++ b/src/USER-MISC/compute_hma.cpp @@ -73,7 +73,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_temp(NULL), deltaR(NULL) + Compute(lmp, narg, arg), id_temp(nullptr), deltaR(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute hma command"); if (igroup) error->all(FLERR,"Compute hma must use group all"); @@ -199,7 +199,7 @@ ComputeHMA::~ComputeHMA() void ComputeHMA::init() { if (computeCv>-1) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute hma cv"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute hma cv"); @@ -222,7 +222,7 @@ void ComputeHMA::setup() int ifix = modify->find_fix(id_temp); if (ifix < 0) error->all(FLERR,"Could not find compute hma temperature ID"); double * temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); - if (temperat==NULL) error->all(FLERR,"Could not find compute hma temperature ID"); + if (temperat==nullptr) error->all(FLERR,"Could not find compute hma temperature ID"); finaltemp = * temperat; // set fix which stores original atom coords diff --git a/src/USER-MISC/compute_pressure_cylinder.cpp b/src/USER-MISC/compute_pressure_cylinder.cpp index 6cf375dd19..e050275f76 100644 --- a/src/USER-MISC/compute_pressure_cylinder.cpp +++ b/src/USER-MISC/compute_pressure_cylinder.cpp @@ -48,10 +48,10 @@ static const char cite_compute_pressure_cylinder[] = ComputePressureCyl::ComputePressureCyl(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - Pr_temp(NULL), Pr_all(NULL), Pz_temp(NULL), Pz_all(NULL), Pphi_temp(NULL), - Pphi_all(NULL), R(NULL), Rinv(NULL), R2(NULL), PrAinv(NULL), PzAinv(NULL), - R2kin(NULL), density_temp(NULL), invVbin(NULL), density_all(NULL), - tangent(NULL), ephi_x(NULL), ephi_y(NULL), binz(NULL) + Pr_temp(nullptr), Pr_all(nullptr), Pz_temp(nullptr), Pz_all(nullptr), Pphi_temp(nullptr), + Pphi_all(nullptr), R(nullptr), Rinv(nullptr), R2(nullptr), PrAinv(nullptr), PzAinv(nullptr), + R2kin(nullptr), density_temp(nullptr), invVbin(nullptr), density_all(nullptr), + tangent(nullptr), ephi_x(nullptr), ephi_y(nullptr), binz(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_pressure_cylinder); if (narg != 7) error->all(FLERR,"Illegal compute pressure/cylinder command"); @@ -143,7 +143,7 @@ ComputePressureCyl::~ComputePressureCyl() void ComputePressureCyl::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pressure/cylinder"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pressure/cylinder"); diff --git a/src/USER-MISC/compute_pressure_grem.cpp b/src/USER-MISC/compute_pressure_grem.cpp index ba949727b0..6a5c36a06f 100644 --- a/src/USER-MISC/compute_pressure_grem.cpp +++ b/src/USER-MISC/compute_pressure_grem.cpp @@ -55,7 +55,7 @@ void ComputePressureGrem::init() int dim; scale_grem = (double *)modify->fix[ifix]->extract("scale_grem",dim); - if (scale_grem == NULL || dim != 0) + if (scale_grem == nullptr || dim != 0) error->all(FLERR,"Cannot extract gREM scale factor from fix grem"); } diff --git a/src/USER-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index c733c929ba..2abe812f19 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -117,7 +117,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // Initialize some variables - values_local = values_global = vector = NULL; + values_local = values_global = vector = nullptr; // this fix produces a global vector @@ -173,7 +173,7 @@ void ComputeStressMop::init() // This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); @@ -185,15 +185,15 @@ void ComputeStressMop::init() //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 323aee851e..6beb3ffd83 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -112,8 +112,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // initialize some variables nbins = 0; - coord = coordp = NULL; - values_local = values_global = array = NULL; + coord = coordp = nullptr; + values_local = values_global = array = nullptr; // bin setup @@ -173,7 +173,7 @@ void ComputeStressMopProfile::init() //This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); @@ -185,15 +185,15 @@ void ComputeStressMopProfile::init() //Compute stress/mop/profile only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index c333357a93..5aafe19033 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -42,7 +42,7 @@ ComputeTempRotate::ComputeTempRotate(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-MISC/compute_viscosity_cos.cpp b/src/USER-MISC/compute_viscosity_cos.cpp index dae93a8d81..4a798eb158 100644 --- a/src/USER-MISC/compute_viscosity_cos.cpp +++ b/src/USER-MISC/compute_viscosity_cos.cpp @@ -45,7 +45,7 @@ ComputeViscosityCos::ComputeViscosityCos(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[7]; } diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 7c131682fa..d5cd27189d 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -322,11 +322,11 @@ void DihedralCosineShiftExp::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 066447f92d..cb620ae7d4 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -365,7 +365,7 @@ void DihedralFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -380,9 +380,9 @@ void DihedralFourier::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,NULL,error); - utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index bde8d84070..bf1b2fa75d 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -320,7 +320,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -330,7 +330,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) if (comm->me == 0) { for(int i = 1; i <= atom->ndihedraltypes; i++) - utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,nullptr,error); } for (int i = 1; i <= atom->ndihedraltypes; i++ ) diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index deafc8391f..68be198332 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -326,8 +326,8 @@ void DihedralQuadratic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&phi0[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 15bb458c48..d200482999 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -654,16 +654,16 @@ void DihedralSpherical::allocate() theta2_shift = new double * [n+1]; theta2_offset = new double * [n+1]; for (int i = 1; i <= n; i++) { - Ccoeff[i] = NULL; - phi_mult[i] = NULL; - phi_shift[i] = NULL; - phi_offset[i] = NULL; - theta1_mult[i] = NULL; - theta1_shift[i] = NULL; - theta1_offset[i] = NULL; - theta2_mult[i] = NULL; - theta2_shift[i] = NULL; - theta2_offset[i] = NULL; + Ccoeff[i] = nullptr; + phi_mult[i] = nullptr; + phi_shift[i] = nullptr; + phi_offset[i] = nullptr; + theta1_mult[i] = nullptr; + theta1_shift[i] = nullptr; + theta1_offset[i] = nullptr; + theta2_mult[i] = nullptr; + theta2_shift[i] = nullptr; + theta2_offset[i] = nullptr; } memory->create(setflag,n+1,"dihedral:setflag"); @@ -755,7 +755,7 @@ void DihedralSpherical::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -775,16 +775,16 @@ void DihedralSpherical::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 91a8642b10..d09684df98 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -788,7 +788,7 @@ void DihedralTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } @@ -1014,8 +1014,8 @@ void DihedralTable::write_restart_settings(FILE *fp) void DihedralTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1027,10 +1027,10 @@ void DihedralTable::read_restart_settings(FILE *fp) void DihedralTable::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index f8a2f02596..3933e39342 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -412,8 +412,8 @@ DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : Dihedral(lmp) { if (lmp->citeme) lmp->citeme->add(cite_dihedral_tablecut); ntables = 0; - tables = NULL; - checkU_fname = checkF_fname = NULL; + tables = nullptr; + checkU_fname = checkF_fname = nullptr; } /* ---------------------------------------------------------------------- */ @@ -779,7 +779,7 @@ void DihedralTableCut::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ void DihedralTableCut::write_restart_settings(FILE *fp) void DihedralTableCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1041,10 +1041,10 @@ void DihedralTableCut::read_restart_settings(FILE *fp) void DihedralTableCut::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1079,7 +1079,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { string err_msg = string("Cannot open file ") + string(file); error->one(FLERR,err_msg); } @@ -1087,7 +1087,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) { + if (fgets(line,MAXLINE,fp) == nullptr) { string err_msg=string("Did not find keyword \"") +string(keyword)+string("\" in dihedral table file."); error->one(FLERR, err_msg); @@ -1121,7 +1121,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // Skip blank lines and delete text following a '#' character char *pe = strchr(line, '#'); - if (pe != NULL) *pe = '\0'; //terminate string at '#' character + if (pe != nullptr) *pe = '\0'; //terminate string at '#' character char *pc = line; while ((*pc != '\0') && isspace(*pc)) pc++; @@ -1344,7 +1344,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"NOF") == 0) { @@ -1357,20 +1357,20 @@ void DihedralTableCut::param_extract(Table *tb, char *line) tb->use_degrees = false; } else if (strcmp(word,"CHECKU") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkU_fname); memory->create(checkU_fname,strlen(word)+1,"dihedral_table:checkU"); strcpy(checkU_fname, word); } else if (strcmp(word,"CHECKF") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkF_fname); memory->create(checkF_fname,strlen(word)+1,"dihedral_table:checkF"); strcpy(checkF_fname, word); } // COMMENTING OUT: equilibrium angles are not supported //else if (strcmp(word,"EQ") == 0) { - // word = strtok(NULL," \t\n\r\f"); + // word = strtok(nullptr," \t\n\r\f"); // tb->theta0 = atof(word); //} else { @@ -1378,7 +1378,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) err_msg += string(" (") + string(word) + string(")"); error->one(FLERR, err_msg); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index ed796280e7..f1b64817b1 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -51,7 +51,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index d92789f03f..57eb9705b7 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -118,13 +118,13 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): type = AUTO; startstep = 0; - fp = NULL; + fp = nullptr; overwrite = 0; numcorrelators=20; p = 16; m = 2; - char *title1 = NULL; - char *title2 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"type") == 0) { @@ -163,7 +163,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Illegal fix ave/correlate/long command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ave/correlate/long file %s",arg[iarg+1]); error->one(FLERR,str); diff --git a/src/USER-MISC/fix_electron_stopping.cpp b/src/USER-MISC/fix_electron_stopping.cpp index 952ffe7584..52ab44b0c8 100644 --- a/src/USER-MISC/fix_electron_stopping.cpp +++ b/src/USER-MISC/fix_electron_stopping.cpp @@ -242,7 +242,7 @@ void FixElectronStopping::read_table(const char *file) char line[MAXLINE]; FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str, 128, "Cannot open stopping range table %s", file); error->one(FLERR, str); @@ -252,21 +252,21 @@ void FixElectronStopping::read_table(const char *file) int l = 0; while (true) { - if (fgets(line, MAXLINE, fp) == NULL) break; // end of file + if (fgets(line, MAXLINE, fp) == nullptr) break; // end of file if (line[0] == '#') continue; // comment char *pch = strtok(line, " \t\n\r"); - if (pch == NULL) continue; // blank line + if (pch == nullptr) continue; // blank line if (l >= maxlines) grow_table(); int i = 0; - for ( ; i < ncol && pch != NULL; i++) { + for ( ; i < ncol && pch != nullptr; i++) { elstop_ranges[i][l] = utils::numeric(FLERR, pch,false,lmp); - pch = strtok(NULL, " \t\n\r"); + pch = strtok(nullptr, " \t\n\r"); } - if (i != ncol || pch != NULL) // too short or too long + if (i != ncol || pch != nullptr) // too short or too long error->one(FLERR, "fix electron/stopping: Invalid table line"); if (l >= 1 && elstop_ranges[0][l] <= elstop_ranges[0][l-1]) diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index fb111c1f27..c0f79869b4 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -106,11 +106,11 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"ffl:sqrt_m"); // allocates space for temporaries - ffl_tmp1=ffl_tmp2=NULL; + ffl_tmp1=ffl_tmp2=nullptr; grow_arrays(atom->nmax); @@ -426,7 +426,7 @@ void *FixFFL::extract(const char *str, int &dim) { if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 86650cd50d..6ed2632b43 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -149,22 +149,22 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : angle_distance = new double[atom->nangletypes+1]; //grow_arrays - array_atom = NULL; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + array_atom = nullptr; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); //calls grow_arrays - x_store = NULL; + x_store = nullptr; //STUFF - g = NULL; - help2 = NULL; + g = nullptr; + help2 = nullptr; - dn1dx = dn2dx = dn3dx = NULL; - n1 = n2 = n3 = del1 = del2 = del3 = NULL; + dn1dx = dn2dx = dn3dx = nullptr; + n1 = n2 = n3 = del1 = del2 = del3 = nullptr; memory->grow(help2,15,15,"FilterCorotate:help2"); memory->grow(n1,3,"FilterCorotate:n1"); @@ -188,11 +188,11 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : // initialize list of clusters to constrain maxlist = 0; - list = NULL; - clist_derv = NULL; - clist_q0 = NULL; //list for derivative and ref. config - clist_nselect1 = clist_nselect2 = NULL; - clist_select1 = clist_select2 = NULL; + list = nullptr; + clist_derv = nullptr; + clist_q0 = nullptr; //list for derivative and ref. config + clist_nselect1 = clist_nselect2 = nullptr; + clist_select1 = clist_select2 = nullptr; } @@ -284,7 +284,7 @@ void FixFilterCorotate::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for fix filter/corotate"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -1225,7 +1225,7 @@ void FixFilterCorotate::find_clusters() // cycle buffer around ring of procs back to self - comm->ring(size,sizeof(tagint),buf,3,ring_shake,NULL,(void *)this); + comm->ring(size,sizeof(tagint),buf,3,ring_shake,nullptr,(void *)this); memory->destroy(buf); diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index f4776c3d6c..04be665213 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -218,11 +218,11 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : int seed = utils::inumeric(FLERR,arg[6],false,lmp); // LOADING A matrix - FILE *fgle = NULL; + FILE *fgle = nullptr; char *fname = arg[7]; if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open A-matrix file %s",fname); error->one(FLERR,str); @@ -238,7 +238,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -258,9 +258,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { A[ndone] = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } fnoneq=0; gle_every=1; gle_step=0; @@ -292,7 +292,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : } else { if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open C-matrix file %s",fname); error->one(FLERR,str); @@ -310,7 +310,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -330,9 +330,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { C[ndone] = cfac*atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } } @@ -349,13 +349,13 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"gle:sqrt_m"); // allocates space for additional degrees of freedom - gle_s=NULL; + gle_s=nullptr; // allocates space for temporaries - gle_tmp1=gle_tmp2=NULL; + gle_tmp1=gle_tmp2=nullptr; grow_arrays(atom->nmax); init_gles(); @@ -720,7 +720,7 @@ void *FixGLE::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index b17c601f05..0a283522ea 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -132,7 +132,7 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) : pressflag = 0; int *p_flag = (int *)nh->extract("p_flag",ifix); - if ((p_flag == NULL) || (ifix != 1) || (p_flag[0] == 0) + if ((p_flag == nullptr) || (ifix != 1) || (p_flag[0] == 0) || (p_flag[1] == 0) || (p_flag[2] == 0)) { pressflag = 0; } else if ((p_flag[0] == 1) && (p_flag[1] == 1) @@ -203,7 +203,7 @@ void FixGrem::init() double *t_start = (double *)nh->extract("t_start",ifix); double *t_stop = (double *)nh->extract("t_stop",ifix); - if ((t_start != NULL) && (t_stop != NULL) && (ifix == 0)) { + if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) { tbath = *t_start; if (*t_start != *t_stop) error->all(FLERR,"Thermostat temperature ramp not allowed"); @@ -215,7 +215,7 @@ void FixGrem::init() int *p_flag = (int *)nh->extract("p_flag",ifix); double *p_start = (double *) nh->extract("p_start",ifix); double *p_stop = (double *) nh->extract("p_stop",ifix); - if ((p_flag != NULL) && (p_start != NULL) && (p_stop != NULL) + if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr) && (ifix == 1)) { ifix = 0; pressref = p_start[0]; @@ -291,5 +291,5 @@ void *FixGrem::extract(const char *str, int &dim) if (strcmp(str,"scale_grem") == 0) { return &scale_grem; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 7c3fac9c33..d772998b16 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -207,7 +207,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -229,7 +229,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -280,7 +280,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -288,7 +288,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -492,25 +492,25 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); /* initialize various imd state variables. */ - clientsock = NULL; - localsock = NULL; + clientsock = nullptr; + localsock = nullptr; nlevels_respa = 0; imd_inactive = 0; imd_terminate = 0; imd_forces = 0; - force_buf = NULL; + force_buf = nullptr; maxbuf = 0; - msgdata = NULL; + msgdata = nullptr; msglen = 0; - comm_buf = NULL; - idmap = NULL; - rev_idmap = NULL; + comm_buf = nullptr; + idmap = nullptr; + rev_idmap = nullptr; if (me == 0) { /* set up incoming socket on MPI rank 0. */ imdsock_init(); localsock = imdsock_create(); - clientsock = NULL; + clientsock = nullptr; if (imdsock_bind(localsock,imd_port)) { perror("bind to socket failed"); imdsock_destroy(localsock); @@ -536,9 +536,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : /* set up mutex and condition variable for i/o thread */ /* hold mutex before creating i/o thread to keep it waiting. */ - pthread_mutex_init(&read_mutex, NULL); - pthread_mutex_init(&write_mutex, NULL); - pthread_cond_init(&write_cond, NULL); + pthread_mutex_init(&read_mutex, nullptr); + pthread_mutex_init(&write_mutex, nullptr); + pthread_cond_init(&write_cond, nullptr); pthread_mutex_lock(&write_mutex); buf_has_data=0; @@ -564,7 +564,7 @@ FixIMD::~FixIMD() buf_has_data=-1; pthread_cond_signal(&write_cond); pthread_mutex_unlock(&write_mutex); - pthread_join(iothread, NULL); + pthread_join(iothread, nullptr); /* cleanup */ pthread_attr_destroy(&iot_attr); @@ -584,8 +584,8 @@ FixIMD::~FixIMD() imdsock_destroy(clientsock); imdsock_shutdown(localsock); imdsock_destroy(localsock); - clientsock=NULL; - localsock=NULL; + clientsock=nullptr; + localsock=nullptr; return; } @@ -627,7 +627,7 @@ int FixIMD::reconnect() } } connect_msg = 0; - clientsock = NULL; + clientsock = nullptr; if (nowait_flag) { int retval = imdsock_selread(localsock,0); if (retval > 0) { @@ -774,7 +774,7 @@ void *fix_imd_ioworker(void *t) { FixIMD *imd=(FixIMD *)t; imd->ioworker(); - return NULL; + return nullptr; } /* the real i/o worker thread */ @@ -787,7 +787,7 @@ void FixIMD::ioworker() fprintf(screen,"Asynchronous I/O thread is exiting.\n"); buf_has_data=0; pthread_mutex_unlock(&write_mutex); - pthread_exit(NULL); + pthread_exit(nullptr); } else if (buf_has_data > 0) { /* send coordinate data, if client is able to accept */ if (clientsock && imdsock_selwrite(clientsock,0)) { @@ -855,9 +855,9 @@ void FixIMD::post_force(int /*vflag*/) imd_paused = 0; imd_forces = 0; memory->destroy(force_buf); - force_buf = NULL; + force_buf = nullptr; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; if (screen) fprintf(screen, "IMD client detached. LAMMPS run continues.\n"); @@ -875,7 +875,7 @@ void FixIMD::post_force(int /*vflag*/) imd_terminate = 1; imd_paused = 0; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; break; case IMD_PAUSE: @@ -958,7 +958,7 @@ void FixIMD::post_force(int /*vflag*/) /* check if we need to readjust the forces comm buffer on the receiving nodes. */ if (me != 0) { if (old_imd_forces < imd_forces) { /* grow holding space for forces, if needed. */ - if (force_buf != NULL) + if (force_buf != nullptr) memory->sfree(force_buf); force_buf = memory->smalloc(imd_forces*size_one, "imd:force_buf"); } @@ -1200,14 +1200,14 @@ void * imdsock_create(void) { imdsocket * s; s = (imdsocket *) malloc(sizeof(imdsocket)); - if (s != NULL) + if (s != nullptr) memset(s, 0, sizeof(imdsocket)); - else return NULL; + else return nullptr; if ((s->sd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { printf("Failed to open socket."); free(s); - return NULL; + return nullptr; } return (void *) s; @@ -1229,7 +1229,7 @@ int imdsock_listen(void * v) { void *imdsock_accept(void * v) { int rc; - imdsocket *new_s = NULL, *s = (imdsocket *) v; + imdsocket *new_s = nullptr, *s = (imdsocket *) v; #if defined(ARCH_AIX5) || defined(ARCH_AIX5_64) || defined(ARCH_AIX6_64) unsigned int len; #define _SOCKLEN_TYPE unsigned int @@ -1248,7 +1248,7 @@ void *imdsock_accept(void * v) { rc = accept(s->sd, (struct sockaddr *) &s->addr, ( _SOCKLEN_TYPE * ) &len); if (rc >= 0) { new_s = (imdsocket *) malloc(sizeof(imdsocket)); - if (new_s != NULL) { + if (new_s != nullptr) { *new_s = *s; new_s->sd = rc; } @@ -1277,7 +1277,7 @@ int imdsock_read(void * v, void *buf, int len) { void imdsock_shutdown(void *v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1289,7 +1289,7 @@ void imdsock_shutdown(void *v) { void imdsock_destroy(void * v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1306,14 +1306,14 @@ int imdsock_selread(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&rfd); FD_SET(s->sd, &rfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd+1, &rfd, NULL, NULL, &tv); + rc = select(s->sd+1, &rfd, nullptr, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; @@ -1325,14 +1325,14 @@ int imdsock_selwrite(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&wfd); FD_SET(s->sd, &wfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd + 1, NULL, &wfd, NULL, &tv); + rc = select(s->sd + 1, nullptr, &wfd, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; } diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index b8045a9ff1..2ddc965bb5 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -167,7 +167,7 @@ static void readbuffer(int sockfd, char *data, int len, Error* error) /* ---------------------------------------------------------------------- */ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), irregular(NULL) + Fix(lmp, narg, arg), irregular(nullptr) { /* format for fix: * fix num group_id ipi host port [unix] diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 9361d9ebd6..a613ceb9be 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -53,10 +53,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL), id_store(NULL),init_store(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr), id_store(nullptr),init_store(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix npt/cauchy command"); @@ -583,10 +583,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -794,7 +794,7 @@ void FixNPTCauchy::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -821,7 +821,7 @@ void FixNPTCauchy::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1812,7 +1812,7 @@ void *FixNPTCauchy::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index 5f1582d580..2d8d16e405 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -61,7 +61,7 @@ struct FixOrientECO::Nbr { FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - dir_filename(NULL), order(NULL), nbr(NULL), list(NULL) + dir_filename(nullptr), order(nullptr), nbr(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_eco); @@ -96,7 +96,7 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : int count; FILE *infile = utils::open_potential(dir_filename,lmp,nullptr); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open fix orient/eco file {}: {}", dir_filename, utils::getsyserror())); for (int i = 0; i < 6; ++i) { diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index 1ac0ffb188..4b107c6486 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -58,8 +58,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixPAFI::FixPAFI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), computename(NULL), random(NULL), - h(NULL), step_respa(NULL) + Fix(lmp, narg, arg), computename(nullptr), random(nullptr), + h(nullptr), step_respa(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_pafi_package); diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index 5be9bf162b..998dcdadf6 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -87,27 +87,27 @@ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) /* Initiation */ max_nsend = 0; - tag_send = NULL; - buf_send = NULL; + tag_send = nullptr; + buf_send = nullptr; max_nlocal = 0; - buf_recv = NULL; - buf_beads = NULL; + buf_recv = nullptr; + buf_beads = nullptr; size_plan = 0; - plan_send = plan_recv = NULL; + plan_send = plan_recv = nullptr; - M_x2xp = M_xp2x = M_f2fp = M_fp2f = NULL; - lam = NULL; - mode_index = NULL; + M_x2xp = M_xp2x = M_f2fp = M_fp2f = nullptr; + lam = nullptr; + mode_index = nullptr; - mass = NULL; + mass = nullptr; - array_atom = NULL; - nhc_eta = NULL; - nhc_eta_dot = NULL; - nhc_eta_dotdot = NULL; - nhc_eta_mass = NULL; + array_atom = nullptr; + nhc_eta = nullptr; + nhc_eta_dot = nullptr; + nhc_eta_dotdot = nullptr; + nhc_eta_mass = nullptr; size_peratom_cols = 12 * nhc_nchain + 3; @@ -601,7 +601,7 @@ void FixPIMD::comm_init() } buf_beads = new double* [np]; - for(int i=0; iall(FLERR, "Illegal fix propel/self command"); diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index 97bf1fb07b..ad96ec712c 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -55,7 +55,7 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // initial allocation of atom-based array // register with Atom class - array = NULL; + array = nullptr; grow_arrays(atom->nmax); // extends pack_exchange() @@ -100,7 +100,7 @@ int FixSRP::setmask() void FixSRP::init() { - if (force->pair_match("hybrid",1) == NULL && force->pair_match("hybrid/overlay",1) == NULL) + if (force->pair_match("hybrid",1) == nullptr && force->pair_match("hybrid/overlay",1) == nullptr) error->all(FLERR,"Cannot use pair srp without pair_style hybrid"); int has_rigid = 0; diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index bc10b5284c..f2638f8a91 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -74,7 +74,7 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : // Perform initial allocation of atom-based array // Register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index c12019528c..728a509990 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -67,11 +67,11 @@ static const char cite_fix_ttm_mod[] = FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); @@ -103,7 +103,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); if (comm->me == 0) { fp = fopen(arg[10],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ttm/mod file %s",arg[10]); error->one(FLERR,str); @@ -151,7 +151,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : "ttm/mod:net_energy_transfer"); memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "ttm/mod:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -560,7 +560,7 @@ void FixTTMMod::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/USER-MISC/fix_wall_reflect_stochastic.cpp b/src/USER-MISC/fix_wall_reflect_stochastic.cpp index 9a8454b017..6c3a58bc38 100644 --- a/src/USER-MISC/fix_wall_reflect_stochastic.cpp +++ b/src/USER-MISC/fix_wall_reflect_stochastic.cpp @@ -38,7 +38,7 @@ enum{NONE,DIFFUSIVE,MAXWELL,CCL}; FixWallReflectStochastic:: FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : - FixWallReflect(lmp, narg, arg), random(NULL) + FixWallReflect(lmp, narg, arg), random(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/reflect/stochastic command"); diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index 5714931215..9f6e7f114b 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -302,8 +302,8 @@ void ImproperCossq::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 476cf8ab43..cbdb5130e9 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -248,8 +248,8 @@ void ImproperDistance::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index 85f7809a02..8f54c8b7aa 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -326,11 +326,11 @@ void ImproperFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index c85e4850c8..b2a71b10a2 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -326,8 +326,8 @@ void ImproperRing::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 41f9bc9531..afd600594b 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -85,11 +85,11 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nelements = 0; - elements = NULL; - elem2param = NULL; + elements = nullptr; + elem2param = nullptr; nparams = 0; - params = NULL; - map = NULL; + params = nullptr; + map = nullptr; cutmax = 0.0; } @@ -114,7 +114,7 @@ PairAGNI::~PairAGNI() delete [] params[i].yU; } memory->destroy(params); - params = NULL; + params = nullptr; } if (allocated) { @@ -266,7 +266,7 @@ void PairAGNI::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -275,7 +275,7 @@ void PairAGNI::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -348,7 +348,7 @@ double PairAGNI::init_one(int i, int j) void PairAGNI::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = 0; // open file on proc 0 only @@ -357,7 +357,7 @@ void PairAGNI::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open AGNI potential file %s",file); error->one(FLERR,str); @@ -373,7 +373,7 @@ void PairAGNI::read_file(char *file) n = 0; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -396,7 +396,7 @@ void PairAGNI::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; --nwords; if ((nwords == 2) && (strcmp(words[0],"generation") == 0)) { diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 9ef96f1188..8c1114c4dd 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -304,15 +304,15 @@ void PairBuckMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -343,11 +343,11 @@ void PairBuckMDF::write_restart_settings(FILE *fp) void PairBuckMDF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); @@ -396,5 +396,5 @@ void *PairBuckMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_cosine_squared.cpp b/src/USER-MISC/pair_cosine_squared.cpp index 1203cea5f2..84383c102f 100644 --- a/src/USER-MISC/pair_cosine_squared.cpp +++ b/src/USER-MISC/pair_cosine_squared.cpp @@ -271,14 +271,14 @@ void PairCosineSquared::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { if (me == 0) - utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,nullptr,error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,nullptr,error); } MPI_Bcast(&epsilon[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&sigma[i][j], 1, MPI_DOUBLE, 0, world); @@ -306,7 +306,7 @@ void PairCosineSquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,NULL,error); + utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,nullptr,error); } MPI_Bcast(&cut_global, 1, MPI_DOUBLE, 0, world); } diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index 5a3e12f1a5..35995717bd 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -281,13 +281,13 @@ void PairCoulDiel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&rme[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairCoulDiel::write_restart_settings(FILE *fp) void PairCoulDiel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 44ab555b02..54e3dbddb8 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -297,12 +297,12 @@ void PairCoulShield::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -328,9 +328,9 @@ void PairCoulShield::write_restart_settings(FILE *fp) void PairCoulShield::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_slater_long.cpp b/src/USER-MISC/pair_coul_slater_long.cpp index 0c94254f48..0f5ee9bd11 100644 --- a/src/USER-MISC/pair_coul_slater_long.cpp +++ b/src/USER-MISC/pair_coul_slater_long.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; PairCoulSlaterLong::PairCoulSlaterLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - //ftable = NULL; + //ftable = nullptr; qdist = 0.0; } @@ -250,13 +250,13 @@ void PairCoulSlaterLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - // if (ncoultablebits) init_tables(cut_coul,NULL); + // if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -415,5 +415,5 @@ void *PairCoulSlaterLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 7b56caa205..449cf86699 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -49,11 +49,11 @@ PairDRIP::PairDRIP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; manybody_flag = 1; - params = NULL; - nearest3neigh = NULL; - elements = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + nearest3neigh = nullptr; + elements = nullptr; + elem2param = nullptr; + map = nullptr; nelements = 0; cutmax = 0.0; } @@ -68,10 +68,10 @@ PairDRIP::~PairDRIP() delete [] map; } - if (elements != NULL) { + if (elements != nullptr) { for (int i = 0; i < nelements; i++) delete [] elements[i]; delete [] elements; - elements = NULL; + elements = nullptr; } memory->destroy(params); memory->destroy(elem2param); @@ -139,7 +139,7 @@ void PairDRIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -148,7 +148,7 @@ void PairDRIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -224,7 +224,7 @@ void PairDRIP::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open DRIP potential file %s",filename); error->one(FLERR,str); @@ -241,7 +241,7 @@ void PairDRIP::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -263,7 +263,7 @@ void PairDRIP::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -283,7 +283,7 @@ void PairDRIP::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index a7ed0fcaad..96aeea66f6 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -50,12 +50,12 @@ PairE3B::PairE3B(LAMMPS *lmp) : Pair(lmp),pairPerAtom(10) pvector = new double[nextra]; allocatedE3B = false; - pairO = NULL; - pairH = NULL; - exps = NULL; - del3 = NULL; - fpair3 = NULL; - sumExp = NULL; + pairO = nullptr; + pairH = nullptr; + exps = nullptr; + del3 = nullptr; + fpair3 = nullptr; + sumExp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 6ccaded35d..31dda8bb03 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -52,12 +52,12 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairEDIP::PairEDIP(LAMMPS *lmp) : - Pair(lmp), preInvR_ij(NULL), preExp3B_ij(NULL), preExp3BDerived_ij(NULL), - preExp2B_ij(NULL), preExp2BDerived_ij(NULL), prePow2B_ij(NULL), - preForceCoord(NULL), cutoffFunction(NULL), cutoffFunctionDerived(NULL), - pow2B(NULL), exp2B(NULL), exp3B(NULL), qFunctionGrid(NULL), - expMinusBetaZeta_iZeta_iGrid(NULL), tauFunctionGrid(NULL), - tauFunctionDerivedGrid(NULL) + Pair(lmp), preInvR_ij(nullptr), preExp3B_ij(nullptr), preExp3BDerived_ij(nullptr), + preExp2B_ij(nullptr), preExp2BDerived_ij(nullptr), prePow2B_ij(nullptr), + preForceCoord(nullptr), cutoffFunction(nullptr), cutoffFunctionDerived(nullptr), + pow2B(nullptr), exp2B(nullptr), exp3B(nullptr), qFunctionGrid(nullptr), + expMinusBetaZeta_iZeta_iGrid(nullptr), tauFunctionGrid(nullptr), + tauFunctionDerivedGrid(nullptr) { single_enable = 0; restartinfo = 0; @@ -65,10 +65,10 @@ PairEDIP::PairEDIP(LAMMPS *lmp) : manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -779,7 +779,7 @@ void PairEDIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -788,7 +788,7 @@ void PairEDIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -876,7 +876,7 @@ void PairEDIP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -884,7 +884,7 @@ void PairEDIP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -902,7 +902,7 @@ void PairEDIP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -924,7 +924,7 @@ void PairEDIP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -944,7 +944,7 @@ void PairEDIP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 4a81a41a26..1a5d4925d9 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -70,10 +70,10 @@ PairEDIPMulti::PairEDIPMulti(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -539,7 +539,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -548,7 +548,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -633,7 +633,7 @@ void PairEDIPMulti::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -641,7 +641,7 @@ void PairEDIPMulti::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -659,7 +659,7 @@ void PairEDIPMulti::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -681,7 +681,7 @@ void PairEDIPMulti::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -701,7 +701,7 @@ void PairEDIPMulti::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 0db7f8739a..6d9f74de8e 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -52,20 +52,20 @@ PairExTeP::PairExTeP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - map = NULL; + map = nullptr; - Nt = NULL; - Nd = NULL; + Nt = nullptr; + Nd = nullptr; } /* ---------------------------------------------------------------------- @@ -467,7 +467,7 @@ void PairExTeP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -476,7 +476,7 @@ void PairExTeP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -544,7 +544,7 @@ void PairExTeP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -582,7 +582,7 @@ void PairExTeP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -590,7 +590,7 @@ void PairExTeP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ExTeP potential file %s",file); error->one(FLERR,str); @@ -607,7 +607,7 @@ void PairExTeP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -629,7 +629,7 @@ void PairExTeP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -649,7 +649,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line @@ -737,7 +737,7 @@ void PairExTeP::read_file(char *file) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); //fputs(line,stdout); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -758,7 +758,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); while ((nwords < params_per_line) - && (words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + && (words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // skip line if it is a leftover from the previous section, // which can be identified by having 3 elements (instead of 2) diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index c9601c416e..d7d7f68645 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -301,14 +301,14 @@ void PairGaussCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&hgauss[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rmh[i][j],1,MPI_DOUBLE,0,world); @@ -337,9 +337,9 @@ void PairGaussCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 671dcb309d..f0c197ca3d 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -54,23 +54,23 @@ PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutILPsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutILPsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - ILP_numneigh = NULL; - ILP_firstneigh = NULL; - ipage = NULL; + ILP_numneigh = nullptr; + ILP_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -167,7 +167,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -176,7 +176,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -249,7 +249,7 @@ void PairILPGrapheneHBN::read_file(char *filename) int params_per_line = 13; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -257,7 +257,7 @@ void PairILPGrapheneHBN::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ILP potential file %s",filename); error->one(FLERR,str); @@ -274,7 +274,7 @@ void PairILPGrapheneHBN::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -296,7 +296,7 @@ void PairILPGrapheneHBN::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -316,7 +316,7 @@ void PairILPGrapheneHBN::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -414,7 +414,7 @@ void PairILPGrapheneHBN::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index 9f986fa101..c308990839 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -54,23 +54,23 @@ PairKolmogorovCrespiFull::PairKolmogorovCrespiFull(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutKCsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutKCsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - KC_numneigh = NULL; - KC_firstneigh = NULL; - ipage = NULL; + KC_numneigh = nullptr; + KC_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -168,7 +168,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -177,7 +177,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -250,7 +250,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -258,7 +258,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -275,7 +275,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -297,7 +297,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -317,7 +317,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -415,7 +415,7 @@ void PairKolmogorovCrespiFull::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 7ce6f8652a..80f57fb5dc 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -48,11 +48,11 @@ PairKolmogorovCrespiZ::PairKolmogorovCrespiZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -232,7 +232,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -241,7 +241,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -308,7 +308,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) int params_per_line = 11; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -316,7 +316,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -333,7 +333,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -355,7 +355,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -375,7 +375,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index b8f9e5c38f..cb65dc85f6 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -49,11 +49,11 @@ PairLebedevaZ::PairLebedevaZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -228,7 +228,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -237,7 +237,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -304,7 +304,7 @@ void PairLebedevaZ::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -312,7 +312,7 @@ void PairLebedevaZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; sprintf(str,"Cannot open Lebedeva potential file %s",filename); error->one(FLERR,str); @@ -329,7 +329,7 @@ void PairLebedevaZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -351,7 +351,7 @@ void PairLebedevaZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -371,7 +371,7 @@ void PairLebedevaZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 31d32db505..23c12ea9dd 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -304,14 +304,14 @@ void PairLennardMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&aparm[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&bparm[i][j],1,MPI_DOUBLE,0,world); @@ -340,9 +340,9 @@ void PairLennardMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -413,5 +413,5 @@ void *PairLennardMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) aparm; if (strcmp(str,"b") == 0) return (void *) bparm; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index a93e0a81af..f46c061e40 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; static const char * const stylename[] = { - "none", "harmonic", "morse", "lj126", NULL + "none", "harmonic", "morse", "lj126", nullptr }; // fast power function for integer exponent > 0 @@ -54,8 +54,8 @@ PairList::PairList(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; respa_enable = 0; cut_global = 0.0; - style = NULL; - params = NULL; + style = nullptr; + params = nullptr; check_flag = 1; } @@ -211,7 +211,7 @@ void PairList::settings(int narg, char **arg) FILE *fp = utils::open_potential(arg[0],lmp,nullptr); char line[1024]; - if (fp == NULL) + if (fp == nullptr) error->all(FLERR,"Cannot open pair list file"); // count lines in file for upper limit of storage needed @@ -238,13 +238,13 @@ void PairList::settings(int narg, char **arg) // get atom ids of pair id1 = ATOTAGINT(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); id2 = ATOTAGINT(ptr); // get potential type - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); @@ -257,13 +257,13 @@ void PairList::settings(int narg, char **arg) if (strcmp(ptr,stylename[HARM]) == 0) { style[npairs] = HARM; - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.k = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -273,17 +273,17 @@ void PairList::settings(int narg, char **arg) } else if (strcmp(ptr,stylename[MORSE]) == 0) { style[npairs] = MORSE; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.d0 = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.alpha = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -294,12 +294,12 @@ void PairList::settings(int narg, char **arg) // 12-6 lj potential style[npairs] = LJ126; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.epsilon = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.sigma = utils::numeric(FLERR,ptr,false,lmp); @@ -311,8 +311,8 @@ void PairList::settings(int narg, char **arg) } // optional cutoff parameter. if not specified use global value - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr != NULL) && (*ptr != '#')) { + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr != nullptr) && (*ptr != '#')) { double cut = utils::numeric(FLERR,ptr,false,lmp); par.cutsq = cut*cut; } else { diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 92e869e58c..8951af77cd 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -51,9 +51,9 @@ PairLJExpandCoulLong::PairLJExpandCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -710,11 +710,11 @@ void PairLJExpandCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -838,14 +838,14 @@ void PairLJExpandCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -877,13 +877,13 @@ void PairLJExpandCoulLong::write_restart_settings(FILE *fp) void PairLJExpandCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -997,5 +997,5 @@ void *PairLJExpandCoulLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index baa0e233f2..07f58aced1 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -311,14 +311,14 @@ void PairLJMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -345,7 +345,7 @@ void PairLJMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } @@ -414,5 +414,5 @@ void *PairLJMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index ab845e69d5..42a2d4bb7c 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -487,15 +487,15 @@ void PairLJSFDipoleSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,9 +524,9 @@ void PairLJSFDipoleSF::write_restart_settings(FILE *fp) void PairLJSFDipoleSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -638,5 +638,5 @@ void *PairLJSFDipoleSF::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index 404f6e2db1..61346a7fdc 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -62,28 +62,28 @@ PairLocalDensity::PairLocalDensity(LAMMPS *lmp) : Pair(lmp) // stuff read from tabulated file nLD = 0; nrho = 0; - rho_min = NULL; - rho_max = NULL; - a = NULL; - b = NULL; - c0 = NULL; - c2 = NULL; - c4 = NULL; - c6 = NULL; - uppercut = NULL; - lowercut = NULL; - uppercutsq = NULL; - lowercutsq = NULL; - frho = NULL; - rho = NULL; + rho_min = nullptr; + rho_max = nullptr; + a = nullptr; + b = nullptr; + c0 = nullptr; + c2 = nullptr; + c4 = nullptr; + c6 = nullptr; + uppercut = nullptr; + lowercut = nullptr; + uppercutsq = nullptr; + lowercutsq = nullptr; + frho = nullptr; + rho = nullptr; // splined arrays - frho_spline = NULL; + frho_spline = nullptr; // per-atom arrays nmax = 0; - fp = NULL; - localrho = NULL; + fp = nullptr; + localrho = nullptr; // set comm size needed by this pair comm_forward = 1; @@ -667,7 +667,7 @@ void PairLocalDensity::parse_file(char *filename) { if (me == 0) { fptr = fopen(filename, "r"); - if (fptr == NULL) { + if (fptr == nullptr) { char str[128]; sprintf(str,"Cannot open Local Density potential file %s",filename); error->one(FLERR,str); @@ -724,23 +724,23 @@ void PairLocalDensity::parse_file(char *filename) { for (k = 0; k < nLD; k++) { // parse upper and lower cut values - if (fgets(line,MAXLINE,fptr)==NULL) break; + if (fgets(line,MAXLINE,fptr)==nullptr) break; sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]); // parse and broadcast central atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); char *tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { a[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse neighbor atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { b[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse min, max and delta rho values diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 4d9b3866b7..455a21ada3 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -56,24 +56,24 @@ PairMEAMSpline::PairMEAMSpline(LAMMPS *lmp) : Pair(lmp) one_coeff = 1; nelements = 0; - elements = NULL; - map = NULL; + elements = nullptr; + map = nullptr; - Uprime_values = NULL; + Uprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; - phis = NULL; - Us = NULL; - rhos = NULL; - fs = NULL; - gs = NULL; + phis = nullptr; + Us = nullptr; + rhos = nullptr; + fs = nullptr; + gs = nullptr; - zero_atom_energies = NULL; + zero_atom_energies = nullptr; } /* ---------------------------------------------------------------------- */ @@ -398,7 +398,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -459,7 +459,7 @@ void PairMEAMSpline::read_file(const char* filename) if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,128,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -480,8 +480,8 @@ void PairMEAMSpline::read_file(const char* filename) if (strcmp(ptr, "meam/spline") == 0) { isNewFormat = true; // parse the rest of the line! - ptr = strtok(NULL," \t\n\r\f"); - if (ptr == NULL) + ptr = strtok(nullptr," \t\n\r\f"); + if (ptr == nullptr) error->one(FLERR,"Need to include number of atomic species on" " meam/spline line in multi-element potential file"); nelements = atoi(ptr); @@ -493,8 +493,8 @@ void PairMEAMSpline::read_file(const char* filename) delete [] elements; elements = new char*[nelements]; for (int i=0; ione(FLERR, "Not enough atomic species in meam/spline" " line of multi-element potential file"); elements[i] = new char[strlen(ptr)+1]; @@ -674,27 +674,27 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, // If new format, read the spline format. Should always be "spline3eq" for now. if (isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line in old format if (!isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index 2e6e7e00f3..31be826d0d 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -74,7 +74,7 @@ protected: class SplineFunction { public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -205,7 +205,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 0a8aae233a..0013fa5577 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -49,13 +49,13 @@ PairMEAMSWSpline::PairMEAMSWSpline(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; - Uprime_values = NULL; - //ESWprime_values = NULL; + Uprime_values = nullptr; + //ESWprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; @@ -393,7 +393,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -402,7 +402,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -461,7 +461,7 @@ void PairMEAMSWSpline::read_file(const char* filename) { if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,1024,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -601,23 +601,23 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error) char line[MAXLINE]; // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index b4480050db..1fd59b34a5 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -62,7 +62,7 @@ protected: public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -188,7 +188,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index d534284b57..997e334537 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -308,16 +308,16 @@ void PairMomb::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -349,11 +349,11 @@ void PairMomb::write_restart_settings(FILE *fp) void PairMomb::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&sscale,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index 9f895800df..73e0bb3c69 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -269,14 +269,14 @@ void PairMorseSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -303,8 +303,8 @@ void PairMorseSmoothLinear::write_restart_settings(FILE *fp) void PairMorseSmoothLinear::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairMorseSmoothLinear::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index 150895108e..d26a0b28df 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -76,7 +76,7 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_srp); nextra = 1; - segment = NULL; + segment = nullptr; // generate unique fix-id for this pair style instance @@ -704,12 +704,12 @@ void PairSRP::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -737,12 +737,12 @@ void PairSRP::write_restart_settings(FILE *fp) void PairSRP::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bptype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&btype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&min,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&exclude,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bptype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&btype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&min,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&exclude,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 1f5cfddff1..6e0cacaff7 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -755,7 +755,7 @@ void PairTersoffTable::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -764,7 +764,7 @@ void PairTersoffTable::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 8d7a4ee2c9..c3c6d89fb6 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -167,7 +167,7 @@ void TemperGrem::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 69f4559cac..288be333f7 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -148,7 +148,7 @@ void TemperNPT::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index 7ef134405d..4909746571 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -386,21 +386,21 @@ void AngleClass2P6::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index 1bede58751..7d08467be4 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -281,7 +281,7 @@ void AngleCosineBuck6d::init_style() { // set local ptrs to buck6d 13 arrays setup by Pair int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle cosine/buck6d is incompatible with Pair style"); cut_ljsq = (double **) force->pair->extract("cut_ljsq",itmp); buck6d1 = (double **) force->pair->extract("buck6d1",itmp); @@ -332,9 +332,9 @@ void AngleCosineBuck6d::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index bbe6e48a35..96faebc85c 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -313,8 +313,8 @@ void ImproperInversionHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 0de5423d30..1e6a0417e9 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -415,16 +415,16 @@ void PairBuck6dCoulGaussDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -457,12 +457,12 @@ void PairBuck6dCoulGaussDSF::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -584,5 +584,5 @@ void *PairBuck6dCoulGaussDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index c6ba832fff..3286abe773 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -331,7 +331,7 @@ void PairBuck6dCoulGaussLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -447,16 +447,16 @@ void PairBuck6dCoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -490,13 +490,13 @@ void PairBuck6dCoulGaussLong::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&coul_smooth,1,MPI_DOUBLE,0,world); @@ -639,5 +639,5 @@ void *PairBuck6dCoulGaussLong::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOLFILE/dump_molfile.cpp b/src/USER-MOLFILE/dump_molfile.cpp index e0e92f9339..a06d83a78d 100644 --- a/src/USER-MOLFILE/dump_molfile.cpp +++ b/src/USER-MOLFILE/dump_molfile.cpp @@ -72,10 +72,10 @@ DumpMolfile::DumpMolfile(LAMMPS *lmp, int narg, char **arg) ntotal = 0; me = comm->me; - coords = vels = masses = charges = radiuses = NULL; - types = molids = NULL; + coords = vels = masses = charges = radiuses = nullptr; + types = molids = nullptr; ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; // allocate global array for atom coords @@ -132,7 +132,7 @@ DumpMolfile::~DumpMolfile() delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -146,7 +146,7 @@ void DumpMolfile::init_style() if (me == 0) { /* initialize typenames array to numeric types by default */ - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { /* a 32-bit int can be maximally 10 digits plus sign */ @@ -408,7 +408,7 @@ void DumpMolfile::write_data(int n, double *mybuf) need_structure = 0; } double simtime = update->ntimestep * update->dt; - mf->timestep(coords,NULL,cell,&simtime); + mf->timestep(coords,nullptr,cell,&simtime); } } } @@ -433,7 +433,7 @@ int DumpMolfile::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 90a5781fff..485be5172d 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -175,7 +175,7 @@ extern "C" { int i, ind; char atom[3]; - if (label != NULL) { + if (label != nullptr) { /* zap string */ atom[0] = atom[1] = atom[2] = '\0'; @@ -217,8 +217,8 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) - return NULL; + if (dirname == nullptr) + return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -237,7 +237,7 @@ extern "C" { delete[] d->searchname; delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -248,13 +248,13 @@ extern "C" { if (FindNextFile(d->h, &(d->fd))) { return d->fd.cFileName; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->h != NULL) { + if (d->h != nullptr) { FindClose(d->h); } delete[] d->searchname; @@ -293,7 +293,7 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) return NULL; + if (dirname == nullptr) return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -303,10 +303,10 @@ extern "C" { d->dlen = len; d->d = opendir(d->name); - if (d->d == NULL) { + if (d->d == nullptr) { delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -316,17 +316,17 @@ extern "C" { { struct dirent *p; - if ((p = readdir(d->d)) != NULL) { + if ((p = readdir(d->d)) != nullptr) { return p->d_name; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->d != NULL) { + if (d->d != nullptr) { closedir(d->d); } delete[] d->name; @@ -374,7 +374,7 @@ MolfileInterface::~MolfileInterface() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } delete[] _name; delete[] _type; @@ -392,7 +392,7 @@ int MolfileInterface::find_plugin(const char *pluginpath) #else #define MY_PATHSEP ':' #endif - if (pluginpath == NULL) return E_DIR; + if (pluginpath == nullptr) return E_DIR; plugindir = path = strdup(pluginpath); while (plugindir) { @@ -413,11 +413,11 @@ int MolfileInterface::find_plugin(const char *pluginpath) int len; filename = my_readdir(dir); - if (filename == NULL) break; + if (filename == nullptr) break; // only look at .so files ext = strrchr(filename, '.'); - if (ext == NULL) continue; + if (ext == nullptr) continue; if (strcasecmp(ext,".so") != 0) continue; // construct full pathname of potential DSO @@ -450,14 +450,14 @@ int MolfileInterface::load_plugin(const char *filename) // access shared object dso = my_dlopen(filename); - if (dso == NULL) + if (dso == nullptr) return E_FILE; // check for required plugin symbols void *ifunc = my_dlsym(dso,"vmdplugin_init"); void *rfunc = my_dlsym(dso,"vmdplugin_register"); void *ffunc = my_dlsym(dso,"vmdplugin_fini"); - if (ifunc == NULL || rfunc == NULL || ffunc == NULL) { + if (ifunc == nullptr || rfunc == nullptr || ffunc == nullptr) { my_dlclose(dso); return E_SYMBOL; } @@ -472,7 +472,7 @@ int MolfileInterface::load_plugin(const char *filename) // the callback will be called for each plugin in the DSO and // check the file type. plugin->name will change if successful. plugin_reginfo_t reginfo; - reginfo.p = NULL; + reginfo.p = nullptr; reginfo.name=_type; ((regfunc)rfunc)(®info, plugin_register_cb); @@ -481,7 +481,7 @@ int MolfileInterface::load_plugin(const char *filename) // if the callback found a matching plugin and copied the struct, // its name element will point to a different location now. - if (plugin == NULL) { + if (plugin == nullptr) { retval = E_TYPE; // check if the ABI matches the one used to compile this code @@ -490,16 +490,16 @@ int MolfileInterface::load_plugin(const char *filename) // check if (basic) reading is supported } else if ((_mode & M_READ) && - ( (plugin->open_file_read == NULL) || - (plugin->read_next_timestep == NULL) || - (plugin->close_file_read == NULL) )) { + ( (plugin->open_file_read == nullptr) || + (plugin->read_next_timestep == nullptr) || + (plugin->close_file_read == nullptr) )) { retval = E_MODE; // check if (basic) writing is supported } else if ( (_mode & M_WRITE) && - ( (plugin->open_file_write == NULL) || - (plugin->write_timestep == NULL) || - (plugin->close_file_write == NULL) )) { + ( (plugin->open_file_write == nullptr) || + (plugin->write_timestep == nullptr) || + (plugin->close_file_write == nullptr) )) { retval = E_MODE; // make some additional check, if we @@ -579,7 +579,7 @@ void MolfileInterface::forget_plugin() close(); if (_plugin) - _plugin = NULL; + _plugin = nullptr; if (_dso) { void *ffunc = my_dlsym(_dso,"vmdplugin_fini"); @@ -587,7 +587,7 @@ void MolfileInterface::forget_plugin() ((finifunc)ffunc)(); my_dlclose(_dso); } - _dso = NULL; + _dso = nullptr; delete[] _name; _name = new char[5]; @@ -608,7 +608,7 @@ int MolfileInterface::open(const char *name, int *natoms) else if (_mode & M_READ) _ptr = p->open_file_read(name,_type,natoms); - if (_ptr == NULL) + if (_ptr == nullptr) return E_FILE; _natoms = *natoms; @@ -681,9 +681,9 @@ int MolfileInterface::close() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } - _ptr = NULL; + _ptr = nullptr; _natoms = 0; return E_NONE; @@ -704,7 +704,7 @@ int MolfileInterface::timestep(float *coords, float *vels, if (_mode & M_WRITE) { t->coords = coords; t->velocities = vels; - if (cell != NULL) { + if (cell != nullptr) { t->A = cell[0]; t->B = cell[1]; t->C = cell[2]; @@ -729,8 +729,8 @@ int MolfileInterface::timestep(float *coords, float *vels, } else { // no coordinate storage => skip step - if (coords == NULL) { - rv = p->read_next_timestep(_ptr, _natoms, NULL); + if (coords == nullptr) { + rv = p->read_next_timestep(_ptr, _natoms, nullptr); } else { t->coords = coords; t->velocities = vels; @@ -742,7 +742,7 @@ int MolfileInterface::timestep(float *coords, float *vels, t->gamma = 90.0f; t->physical_time = 0.0; rv = p->read_next_timestep(_ptr, _natoms, t); - if (cell != NULL) { + if (cell != nullptr) { cell[0] = t->A; cell[1] = t->B; cell[2] = t->C; @@ -823,7 +823,7 @@ static int read_int_property(molfile_atom_t &a, const int propid) static const char *read_string_property(molfile_atom_t &a, const int propid) { - const char *prop = NULL; + const char *prop = nullptr; int iprop = 0; PROPUPDATE(MolfileInterface::P_NAME,name,prop); PROPUPDATE(MolfileInterface::P_TYPE,type,prop); @@ -910,7 +910,7 @@ static int write_atom_property(molfile_atom_t &a, // set/get atom floating point property int MolfileInterface::property(int propid, int idx, float *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -927,7 +927,7 @@ int MolfileInterface::property(int propid, int idx, float *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, float *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -947,7 +947,7 @@ int MolfileInterface::property(int propid, int *types, float *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, float *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -968,7 +968,7 @@ int MolfileInterface::property(int propid, float *prop) // set/get atom floating point property int MolfileInterface::property(int propid, int idx, double *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -985,7 +985,7 @@ int MolfileInterface::property(int propid, int idx, double *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, double *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1005,7 +1005,7 @@ int MolfileInterface::property(int propid, int *types, double *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, double *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1040,7 +1040,7 @@ int MolfileInterface::property(int propid, double *prop) // set/get atom integer property int MolfileInterface::property(int propid, int idx, int *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1065,7 +1065,7 @@ int MolfileInterface::property(int propid, int idx, int *prop) // set/get per type integer property int MolfileInterface::property(int propid, int *types, int *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1094,7 +1094,7 @@ int MolfileInterface::property(int propid, int *types, int *prop) // set/get per atom integer property int MolfileInterface::property(int propid, int *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1125,7 +1125,7 @@ int MolfileInterface::property(int propid, int *prop) // set/get atom string property int MolfileInterface::property(int propid, int idx, char *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1143,7 +1143,7 @@ int MolfileInterface::property(int propid, int idx, char *prop) // set/get per type string property int MolfileInterface::property(int propid, int *types, char **prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1164,7 +1164,7 @@ int MolfileInterface::property(int propid, int *types, char **prop) // set/get per atom string property int MolfileInterface::property(int propid, char **prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index d26a4d4ba0..c991318118 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -42,11 +42,11 @@ static bool is_smalldiff(const float &val1, const float &val2) ReaderMolfile::ReaderMolfile(LAMMPS *lmp) : Reader(lmp) { - mf = NULL; - coords = NULL; - vels = NULL; - types = NULL; - fieldindex = NULL; + mf = nullptr; + coords = nullptr; + vels = nullptr; + types = nullptr; + fieldindex = nullptr; nstep = 0; needvels = 0; me = comm->me; @@ -156,7 +156,7 @@ int ReaderMolfile::read_time(bigint &ntimestep) int rv; // try to read in the time step (coordinates, velocities and cell only) - rv = mf->timestep(coords, vels, cell, NULL); + rv = mf->timestep(coords, vels, cell, nullptr); if (rv != 0) return 1; // we fake time step numbers. @@ -187,7 +187,7 @@ void ReaderMolfile::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index f936de6d02..c48688df4d 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -193,13 +193,13 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp index 19b0632922..4288bf6bab 100644 --- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp +++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -190,13 +190,13 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } @@ -767,7 +767,7 @@ void DumpNetCDFMPIIO::write() // pack my data into buf - pack(NULL); + pack(nullptr); // each process writes its data diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 9c52bdb281..866538dacb 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -56,7 +56,7 @@ void BondClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index 38df4f50da..b881ae3b10 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -57,7 +57,7 @@ void BondFENEExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index 5dde355a76..54a6cd5b3c 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -57,7 +57,7 @@ void BondFENEOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_gromos_omp.cpp b/src/USER-OMP/bond_gromos_omp.cpp index 012737f77d..2469329a52 100644 --- a/src/USER-OMP/bond_gromos_omp.cpp +++ b/src/USER-OMP/bond_gromos_omp.cpp @@ -53,7 +53,7 @@ void BondGromosOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index e8f17d5eae..e9b2d5b103 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 61a60fa995..3d81098d4b 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 50b4ed98a7..ff85a9f009 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 51586370f5..352a7e1e41 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -55,7 +55,7 @@ void BondMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 720d660eae..f7330d1f3e 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -55,7 +55,7 @@ void BondNonlinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_quartic_omp.cpp b/src/USER-OMP/bond_quartic_omp.cpp index bc1ae96ac9..c48c8ae65f 100644 --- a/src/USER-OMP/bond_quartic_omp.cpp +++ b/src/USER-OMP/bond_quartic_omp.cpp @@ -61,7 +61,7 @@ void BondQuarticOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index 3ccc65441a..34f678a224 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -55,7 +55,7 @@ void BondTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index d5480d2a9f..5f27c04e63 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -120,7 +120,7 @@ void EwaldOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, nlocal, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, 0, NULL, NULL, NULL, thr); + ev_setup_thr(eflag, vflag, 0, nullptr, nullptr, nullptr, thr); for (i = ifrom; i < ito; i++) { ek[i][0] = 0.0; diff --git a/src/USER-OMP/fix_neigh_history_omp.cpp b/src/USER-OMP/fix_neigh_history_omp.cpp index 7acded0ab2..02da93ab7d 100644 --- a/src/USER-OMP/fix_neigh_history_omp.cpp +++ b/src/USER-OMP/fix_neigh_history_omp.cpp @@ -138,7 +138,7 @@ void FixNeighHistoryOMP::pre_exchange_onesided() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -276,7 +276,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -289,7 +289,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -444,7 +444,7 @@ void FixNeighHistoryOMP::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index f3c86a7746..7c3591322a 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -61,7 +61,7 @@ static int get_tid() FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), + thr(nullptr), last_omp_style(nullptr), last_pair_hybrid(nullptr), _nthr(-1), _neighbor(true), _mixed(false), _reduced(true), _pair_compute_flag(false), _kspace_compute_flag(false) { @@ -203,8 +203,8 @@ void FixOMP::init() thr[i]->_timer_active=-1; } - if ((strstr(update->integrate_style,"respa") != NULL) - && (strstr(update->integrate_style,"respa/omp") == NULL)) + if ((strstr(update->integrate_style,"respa") != nullptr) + && (strstr(update->integrate_style,"respa/omp") == nullptr)) error->all(FLERR,"Need to use respa/omp for r-RESPA with /omp styles"); if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; @@ -213,18 +213,18 @@ void FixOMP::init() else _kspace_compute_flag = false; int check_hybrid, kspace_split; - last_pair_hybrid = NULL; - last_omp_style = NULL; - const char *last_omp_name = NULL; - const char *last_hybrid_name = NULL; - const char *last_force_name = NULL; + last_pair_hybrid = nullptr; + last_omp_style = nullptr; + const char *last_omp_name = nullptr; + const char *last_hybrid_name = nullptr; + const char *last_force_name = nullptr; // support for verlet/split operation. // kspace_split == 0 : regular processing // kspace_split < 0 : master partition, does not do kspace // kspace_split > 0 : slave partition, only does kspace - if (strstr(update->integrate_style,"verlet/split") != NULL) { + if (strstr(update->integrate_style,"verlet/split") != nullptr) { if (universe->iworld == 0) kspace_split = -1; else kspace_split = 1; } else { diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 5b2ee88420..f88dada706 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -48,13 +48,13 @@ void FixQEQCombOMP::init() if (!atom->q_flag) error->all(FLERR,"Fix qeq/comb/omp requires atom attribute q"); - if (NULL != force->pair_match("comb3",0)) + if (nullptr != force->pair_match("comb3",0)) error->all(FLERR,"No support for comb3 currently available in USER-OMP"); comb = (PairComb *) force->pair_match("comb/omp",1); - if (comb == NULL) + if (comb == nullptr) comb = (PairComb *) force->pair_match("comb",1); - if (comb == NULL) + if (comb == nullptr) error->all(FLERR,"Must use pair_style comb or " "comb/omp with fix qeq/comb/omp"); diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index ef0f918cbf..5d6f244e77 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -65,7 +65,7 @@ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : { if (narg<8 || narg>9) error->all(FLERR,"Illegal fix qeq/reax/omp command"); - b_temp = NULL; + b_temp = nullptr; // ASPC: Kolafa, J. Comp. Chem., 25(3), 335 (2003) do_aspc = 0; @@ -73,7 +73,7 @@ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : // Must be consistent with nprev to store history: nprev = aspc_order + 2 aspc_order_max = nprev - 2; aspc_omega = 0.0; - aspc_b = NULL; + aspc_b = nullptr; } FixQEqReaxOMP::~FixQEqReaxOMP() diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index c42aa8e0c1..81aa380cef 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -46,7 +46,7 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ MSMCGOMP::MSMCGOMP(LAMMPS *lmp) : MSMOMP(lmp), - is_charged(NULL) + is_charged(nullptr) { triclinic_support = 0; diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 97d94e5513..1197e9ebbe 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -71,7 +71,7 @@ void PairADPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_adp(nall, rho, mu, lambda); diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index de6903aab9..401f4a668b 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -56,7 +56,7 @@ void PairAGNIOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) eval<1>(ifrom, ito, thr); else eval<0>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index 837734d6e4..d2c3ef6a09 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -67,7 +67,7 @@ void PairAIREBOOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); FREBO_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv0,thr); if (ljflag) FLJ_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv1,thr); diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 01e33dc5c5..617c237dd9 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -54,7 +54,7 @@ void PairBeckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index b410c998e1..be88df3e7a 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBornCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index 4adba396e8..b161250df8 100644 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBornCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 9bc6507c6a..a426bc93d1 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairBornCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index e74f0139c1..237685b9d2 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -52,7 +52,7 @@ void PairBornOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index b7b82c3dac..afd41668ad 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -48,7 +48,7 @@ PairBrownianOMP::PairBrownianOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianOMP::~PairBrownianOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -127,7 +127,7 @@ void PairBrownianOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial Brownian style // we use is random number generator instance for thread 0 @@ -143,11 +143,11 @@ void PairBrownianOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 4d8b457281..6abd276bff 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -48,7 +48,7 @@ PairBrownianPolyOMP::PairBrownianPolyOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianPolyOMP::~PairBrownianPolyOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -128,7 +128,7 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial BrownianPoly style // we use is random number generator instance for thread 0 @@ -144,11 +144,11 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 1c433f8083..20a4953ef8 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairBuckCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 264073a07e..f0e7edf710 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBuckCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index 631a1ee61d..dd112ba99c 100644 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBuckCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index 00ab1c248c..2b55700972 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -41,7 +41,7 @@ PairBuckLongCoulLongOMP::PairBuckLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -66,7 +66,7 @@ void PairBuckLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -330,7 +330,7 @@ void PairBuckLongCoulLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -355,7 +355,7 @@ void PairBuckLongCoulLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -385,7 +385,7 @@ void PairBuckLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index bddacaf5b5..ab037a204f 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -52,7 +52,7 @@ void PairBuckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index 94325232fc..4509579549 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -56,7 +56,7 @@ void PairColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 9a0155d6d3..c07a6948ae 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -63,7 +63,7 @@ void PairCombOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 57b821cb8b..5f4a792c9d 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -52,7 +52,7 @@ void PairCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index f8b3a36e39..36453b1b32 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 1bb8676998..8a3549b730 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -52,7 +52,7 @@ void PairCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index 62f2580426..f6bdcf8cf8 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -53,7 +53,7 @@ void PairCoulDielOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index 3a8db45634..f7bb7adace 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -61,7 +61,7 @@ void PairCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 92cb51f7a4..12b8fdb2f6 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairCoulLongOMP::PairCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index 28ba13d5cf..0d4dd729db 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -61,7 +61,7 @@ void PairCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index e907d63eb1..4c77b85ae4 100644 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairCoulMSMOMP::PairCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index 71e8148a50..20d45102bd 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 6e3da77cbe..615908f06c 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -35,7 +35,7 @@ PairDPDOMP::PairDPDOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -48,7 +48,7 @@ PairDPDOMP::~PairDPDOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -73,7 +73,7 @@ void PairDPDOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 823367109b..844c79771f 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -36,7 +36,7 @@ PairDPDTstatOMP::PairDPDTstatOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -49,7 +49,7 @@ PairDPDTstatOMP::~PairDPDTstatOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -74,7 +74,7 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index c7559420bc..9a797dafa2 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index 66a7581c21..d474e039bf 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -69,7 +69,7 @@ void PairEAMFSOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index e6ba299a4d..cbdf03a411 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -67,7 +67,7 @@ void PairEAMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eam(nall, rho); diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 864ff68f7a..d0e84be4cf 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -58,7 +58,7 @@ void PairEDIPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 74b460a788..7e25a14a02 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -65,7 +65,7 @@ void PairEIMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eim(nall, rho, fp); diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index a453915738..d2a197291a 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -53,7 +53,7 @@ void PairGaussCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 3e5777e4ec..919ffbe796 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -55,7 +55,7 @@ void PairGaussOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 991c72a9be..d4ee5b2684 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -53,7 +53,7 @@ void PairGayBerneOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 9ad84afb92..2506c4e5b3 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -78,7 +78,7 @@ void PairGranHertzHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 3e519fc0d0..ec87108716 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -79,7 +79,7 @@ void PairGranHookeHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index 8de959a91d..1965c1676b 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -74,7 +74,7 @@ void PairGranHookeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (force->newton_pair) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 338eb52453..8b8dea2a13 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingLJOMP::PairHbondDreidingLJOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingLJOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 5094d5c193..9731972a4b 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingMorseOMP::PairHbondDreidingMorseOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 5aeec25d13..ddbb7ae8e9 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -32,7 +32,7 @@ PairLJ96CutOMP::PairLJ96CutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJ96CutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 3ff02b6109..a7cd7aa76f 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -51,7 +51,7 @@ void PairLJCharmmCoulCharmmImplicitOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 77caf63f18..03d33a6a8a 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -53,7 +53,7 @@ void PairLJCharmmCoulCharmmOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index 56cf0a68dd..ed199dbfd7 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index e19632dc7e..932460a6b9 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongSoftOMP::PairLJCharmmCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index a39ef0aa81..1d9391206c 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCharmmCoulMSMOMP::PairLJCharmmCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCharmmCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 63fb4fe529..50baa7eb86 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2CoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index f618f7f423..85712f22cb 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJClass2CoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 39cc320e44..ae2243daa1 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 27f6132491..1ccade4e62 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -54,7 +54,7 @@ void PairLJCubicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index 2f46e0bfe7..2ab0a4e8c0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index 03f0852b06..d8080656b0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 82031f91ab..d154563344 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index 7ab6f31b3f..fe47e947e5 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -63,7 +63,7 @@ void PairLJCutCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index c7b6de8022..1edeb94b17 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongOMP::PairLJCutCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index 6e804bd8ae..a024db5fc0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongSoftOMP::PairLJCutCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 0e6d11327a..04afd428a0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSMOMP::PairLJCutCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCutCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp index 0e9a333121..9f0577daca 100644 --- a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -55,7 +55,7 @@ void PairLJCutCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index 2cc915a435..b486ba33dd 100644 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutDipoleCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 2aa71026e3..4f8c95a972 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -30,7 +30,7 @@ PairLJCutOMP::PairLJCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 406c5f41d9..dc2441fed2 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -30,7 +30,7 @@ PairLJCutSoftOMP::PairLJCutSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index b921c8f1c1..d79980493a 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -53,7 +53,7 @@ PairLJCutTholeLongOMP::PairLJCutTholeLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -75,7 +75,7 @@ void PairLJCutTholeLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp index 2d1b828822..d11a018a82 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PCutOMP::PairLJCutTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index a60f9d6a57..b712ef8435 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongOMP::PairLJCutTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp index f4a75b9af8..d498da3e86 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongSoftOMP::PairLJCutTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 89077ba6af..ba624ae7d0 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -53,7 +53,7 @@ void PairLJExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 26a6e979b4..7e8a38935d 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsCoulGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index 3082091539..d179831e30 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index cdd62ff96e..76768276c6 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -42,7 +42,7 @@ PairLJLongCoulLongOMP::PairLJLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ void PairLJLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -329,7 +329,7 @@ void PairLJLongCoulLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -354,7 +354,7 @@ void PairLJLongCoulLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -384,7 +384,7 @@ void PairLJLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index af24e93a41..4ba412c66e 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -44,9 +44,9 @@ PairLJLongTIP4PLongOMP::PairLJLongTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; - newsite_thr = NULL; - hneigh_thr = NULL; + cut_respa = nullptr; + newsite_thr = nullptr; + hneigh_thr = nullptr; tip4pflag = dispersionflag = 1; no_virial_fdotr_compute = 1; single_enable = 0; @@ -106,7 +106,7 @@ void PairLJLongTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -389,7 +389,7 @@ void PairLJLongTIP4PLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -414,7 +414,7 @@ void PairLJLongTIP4PLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -468,7 +468,7 @@ void PairLJLongTIP4PLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index 4a53f2c083..f3af43cd50 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -54,7 +54,7 @@ void PairLJSDKCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 4b89375b5b..f05f5e1200 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -60,7 +60,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index d5146c6798..a88a1ded03 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -56,7 +56,7 @@ void PairLJSDKOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 8828b40b98..130ac6e5e7 100644 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -53,7 +53,7 @@ void PairLJSFDipoleSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 2c0c028189..d69cfea0a0 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index 0b4ea4e5f8..1adccbf3cb 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index caf5a11124..17496830f1 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -116,7 +116,7 @@ void PairLubricateOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (evflag) { diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index feb110194f..227c943007 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -113,7 +113,7 @@ void PairLubricatePolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (shearing) { diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index 782371e843..e093e925f1 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -65,7 +65,7 @@ void PairMEAMSplineOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); thr->init_eam(nall,Uprime_values); diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index 48687781ef..aa79a0f05a 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -53,7 +53,7 @@ void PairMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp index 220fb9481d..1896fdcbad 100644 --- a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp @@ -55,7 +55,7 @@ void PairMorseSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index 1cfe576a32..ecdba46e05 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index d9e1231827..09ec46d1c4 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairNMCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index a232da1a90..faa3acefb7 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index 9bf707ad91..b2be373918 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -71,7 +71,7 @@ void PairPeriLPSOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 28df45b67f..b58cadc20c 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -67,7 +67,7 @@ void PairPeriPMBOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index dfc1f428eb..54417f9536 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -92,7 +92,7 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) system->pair_ptr = this; system->omp_active = 1; - num_nbrs_offset = NULL; + num_nbrs_offset = nullptr; #ifdef OMP_TIMING for (int i=0;iget_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index f733b5106f..382a995e2a 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -57,7 +57,7 @@ void PairSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index c2eb4cb156..dac2527053 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -51,7 +51,7 @@ void PairSWOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index f5fbabccab..79128bea8f 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -51,7 +51,7 @@ void PairTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index 83baa56e44..6d2cbf71ac 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -50,7 +50,7 @@ void PairTersoffMODCOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index ab2f07322d..45669dc601 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -52,7 +52,7 @@ void PairTersoffMODOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index a367749978..efafa7949b 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -53,7 +53,7 @@ void PairTersoffOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 8321ad9d9f..277b79b9e7 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -43,8 +43,8 @@ PairTersoffTableOMP::PairTersoffTableOMP(LAMMPS *lmp) : suffix_flag |= Suffix::OMP; respa_enable = 0; - thrGtetaFunction = thrGtetaFunctionDerived = NULL; - thrCutoffFunction = thrCutoffFunctionDerived = NULL; + thrGtetaFunction = thrGtetaFunctionDerived = nullptr; + thrCutoffFunction = thrCutoffFunctionDerived = nullptr; } /* ---------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ void PairTersoffTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (vflag_atom) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 5b983d3db5..a7e087e208 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PCutOMP::PairTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -101,7 +101,7 @@ void PairTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tip4p_long_omp.cpp b/src/USER-OMP/pair_tip4p_long_omp.cpp index 86bebdbeff..75f6850ac3 100644 --- a/src/USER-OMP/pair_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongOMP::PairTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (!ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp index 26e0420955..e408cb7ccb 100644 --- a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongSoftOMP::PairTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_ufm_omp.cpp b/src/USER-OMP/pair_ufm_omp.cpp index e1c2ff457e..202cce567d 100644 --- a/src/USER-OMP/pair_ufm_omp.cpp +++ b/src/USER-OMP/pair_ufm_omp.cpp @@ -55,7 +55,7 @@ void PairUFMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 0637fe3dfc..c1dd45d8b6 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -53,7 +53,7 @@ void PairVashishtaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index 9650a57e72..caf4bb4930 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -51,7 +51,7 @@ void PairVashishtaTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index 227ec0744f..4b595365fd 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 347575e283..78f2a12131 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 9679a00b24..2faf6d1bb0 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -54,7 +54,7 @@ void PairZBLOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp index 80e9b90ecc..bcef3a3c87 100644 --- a/src/USER-OMP/reaxc_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_bonds_omp.cpp @@ -88,7 +88,7 @@ void BondsOMP( reax_system *system, control_params * /* control */, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, system->pair_ptr->vflag_either, system->N, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index ad6ea35eb8..ad474a1cc8 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -165,7 +165,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/thr_data.cpp b/src/USER-OMP/thr_data.cpp index 612c36053c..0ce2c3718a 100644 --- a/src/USER-OMP/thr_data.cpp +++ b/src/USER-OMP/thr_data.cpp @@ -82,33 +82,33 @@ void ThrData::init_force(int nall, double **f, double **torque, memset(virial_imprp,0,6*sizeof(double)); memset(virial_kspce,0,6*sizeof(double)); - eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=NULL; - vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=NULL; + eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=nullptr; + vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=nullptr; if (nall >= 0 && f) { _f = f + _tid*nall; memset(&(_f[0][0]),0,nall*3*sizeof(double)); - } else _f = NULL; + } else _f = nullptr; if (nall >= 0 && torque) { _torque = torque + _tid*nall; memset(&(_torque[0][0]),0,nall*3*sizeof(double)); - } else _torque = NULL; + } else _torque = nullptr; if (nall >= 0 && erforce) { _erforce = erforce + _tid*nall; memset(&(_erforce[0]),0,nall*sizeof(double)); - } else _erforce = NULL; + } else _erforce = nullptr; if (nall >= 0 && de) { _de = de + _tid*nall; memset(&(_de[0]),0,nall*sizeof(double)); - } else _de = NULL; + } else _de = nullptr; if (nall >= 0 && drho) { _drho = drho + _tid*nall; memset(&(_drho[0]),0,nall*sizeof(double)); - } else _drho = NULL; + } else _drho = nullptr; } /* ---------------------------------------------------------------------- @@ -191,8 +191,8 @@ void ThrData::init_pppm(int order, Memory *memory) drho1d = static_cast(_drho1d); if (rho1d) memory->destroy2d_offset(rho1d,-order/2); if (drho1d) memory->destroy2d_offset(drho1d,-order/2); - _rho1d = NULL; - _drho1d = NULL; + _rho1d = nullptr; + _drho1d = nullptr; } } diff --git a/src/USER-OMP/thr_data.h b/src/USER-OMP/thr_data.h index 4b87357101..c942083ef5 100644 --- a/src/USER-OMP/thr_data.h +++ b/src/USER-OMP/thr_data.h @@ -31,7 +31,7 @@ class ThrData { public: ThrData(int tid, class Timer *t); - ~ThrData() { delete _timer; _timer = NULL; }; + ~ThrData() { delete _timer; _timer = nullptr; }; void check_tid(int); // thread id consistency check int get_tid() const { return _tid; }; // our thread id. @@ -140,7 +140,7 @@ class ThrData { // disabled default methods private: - ThrData() : _tid(-1), _timer(NULL) {}; + ThrData() : _tid(-1), _timer(nullptr) {}; }; //////////////////////////////////////////////////////////////////////// diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index 6e096defa8..01e54d3bda 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ThrOMP::ThrOMP(LAMMPS *ptr, int style) - : lmp(ptr), fix(NULL), thr_style(style), thr_error(0) + : lmp(ptr), fix(nullptr), thr_style(style), thr_error(0) { // register fix omp with this class int ifix = lmp->modify->find_fix("package_omp"); @@ -88,7 +88,7 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom, if (nall > 0) memset(&(thr->cvatom_pair[0][0]),0,nall*9*sizeof(double)); } else { - thr->cvatom_pair = NULL; + thr->cvatom_pair = nullptr; } } @@ -199,7 +199,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, if (lmp->force->pair->vflag_fdotr) { // this is a non-hybrid pair style. compute per thread fdotr - if (fix->last_pair_hybrid == NULL) { + if (fix->last_pair_hybrid == nullptr) { if (lmp->neighbor->includegroup == 0) thr->virial_fdotr_compute(x, nlocal, nghost, -1); else diff --git a/src/USER-PHONON/dynamical_matrix.cpp b/src/USER-PHONON/dynamical_matrix.cpp index 238aa7c96e..5451ffba5e 100644 --- a/src/USER-PHONON/dynamical_matrix.cpp +++ b/src/USER-PHONON/dynamical_matrix.cpp @@ -32,7 +32,7 @@ enum{REGULAR,ESKM}; /* ---------------------------------------------------------------------- */ -DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -43,7 +43,7 @@ DynamicalMatrix::~DynamicalMatrix() { if (fp && me == 0) fclose(fp); memory->destroy(groupmap); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ void DynamicalMatrix::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index 382eabe82d..c80073f3c7 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -162,7 +162,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fft = new FFT3d(lmp,world,nz,ny,nx,0,nz-1,0,ny-1,nxlo,nxhi,0,nz-1,0,ny-1,nxlo,nxhi,0,0,&mysize,0); memory->create(fft_data, MAX(1,mynq)*2, "fix_phonon:fft_data"); - // allocate variables; MAX(1,... is used because NULL buffer will result in error for MPI + // allocate variables; MAX(1,... is used because nullptr buffer will result in error for MPI memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); @@ -184,7 +184,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // output some information on the system to log file if (me == 0){ flog = fopen(logfile, "w"); - if (flog == NULL) { + if (flog == nullptr) { char str[MAXLINE]; sprintf(str,"Can not open output file %s",logfile); error->one(FLERR,str); @@ -563,34 +563,34 @@ void FixPhonon::readmap() // read from map file for others char line[MAXLINE]; FILE *fp = fopen(mapfile, "r"); - if (fp == NULL){ + if (fp == nullptr){ sprintf(line,"Cannot open input map file %s", mapfile); error->all(FLERR,line); } - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading header of mapping file!"); nx = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - ny = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nucell = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + ny = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nucell = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); ntotal = nx*ny*nz; if (ntotal*nucell != ngroup) error->all(FLERR,"FFT mesh and number of atoms in group mismatch!"); // second line of mapfile is comment - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading comment of mapping file!"); int ix, iy, iz, iu; // the remaining lines carry the mapping info for (int i = 0; i < ngroup; ++i){ - if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} + if (fgets(line,MAXLINE,fp) == nullptr) {info = 1; break;} ix = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - iy = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iu = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - itag = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + iy = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iu = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + itag = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); // check if index is in correct range if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || diff --git a/src/USER-PHONON/third_order.cpp b/src/USER-PHONON/third_order.cpp index e7997d6397..e72ac0fdf4 100644 --- a/src/USER-PHONON/third_order.cpp +++ b/src/USER-PHONON/third_order.cpp @@ -32,7 +32,7 @@ enum{REGULAR,BALLISTICO}; /* ---------------------------------------------------------------------- */ -ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -42,7 +42,7 @@ ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) ThirdOrder::~ThirdOrder() { if (fp && me == 0) fclose(fp); - fp = NULL; + fp = nullptr; memory->destroy(groupmap); } @@ -220,7 +220,7 @@ void ThirdOrder::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index b7a29c7bc9..3d2acacc1e 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -53,8 +53,8 @@ using namespace FixConst; FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - p(NULL), nlocal(0), gatindex(NULL), masses(NULL), charges(NULL), - id_pe(NULL), id_press(NULL) + p(nullptr), nlocal(0), gatindex(nullptr), masses(nullptr), charges(nullptr), + id_pe(nullptr), id_press(nullptr) { if (!atom->tag_enable) @@ -68,7 +68,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : "Group will be ignored."); #if defined(__PLUMED_DEFAULT_KERNEL) - if (getenv("PLUMED_KERNEL") == NULL) + if (getenv("PLUMED_KERNEL") == nullptr) putenv(plumed_default_kernel); #endif @@ -101,7 +101,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // it is defined inside plumed. p->cmd("GREX setMPIIntercomm",&inter_comm); } - p->cmd("GREX init",NULL); + p->cmd("GREX init",nullptr); } // The general communicator is independent of the existence of partitions, diff --git a/src/USER-PTM/compute_ptm_atom.cpp b/src/USER-PTM/compute_ptm_atom.cpp index 309dd75c19..508c3d0ffd 100644 --- a/src/USER-PTM/compute_ptm_atom.cpp +++ b/src/USER-PTM/compute_ptm_atom.cpp @@ -61,7 +61,7 @@ static const char cite_user_ptm_package[] = /* ---------------------------------------------------------------------- */ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) - : Compute(lmp, narg, arg), list(NULL), output(NULL) { + : Compute(lmp, narg, arg), list(nullptr), output(nullptr) { if (narg < 5 || narg > 6) error->all(FLERR, "Illegal compute ptm/atom command"); @@ -144,7 +144,7 @@ ComputePTMAtom::~ComputePTMAtom() { memory->destroy(output); } /* ---------------------------------------------------------------------- */ void ComputePTMAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR, "Compute ptm/atom requires a pair style be defined"); int count = 0; @@ -201,7 +201,7 @@ static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, double **x = data->x; double *pos = x[atom_index]; - int *jlist = NULL; + int *jlist = nullptr; int jnum = 0; if (atom_index < data->nlocal) { jlist = data->firstneigh[atom_index]; @@ -307,7 +307,7 @@ void ComputePTMAtom::compute_peratom() { ptm_index(local_handle, i, get_neighbours, (void*)&nbrlist, input_flags, standard_orientations, &type, &alloy_type, &scale, &rmsd, q, - NULL, NULL, NULL, NULL, &interatomic_distance, NULL, NULL); + nullptr, nullptr, nullptr, nullptr, &interatomic_distance, nullptr, nullptr); if (rmsd > rmsd_threshold) { type = PTM_MATCH_NONE; diff --git a/src/USER-PTM/ptm_index.cpp b/src/USER-PTM/ptm_index.cpp index cedd35126d..7c912ed5b9 100644 --- a/src/USER-PTM/ptm_index.cpp +++ b/src/USER-PTM/ptm_index.cpp @@ -95,11 +95,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], double *P, double *p_interatomic_distance, double *p_lattice_constant, size_t *output_indices) { const ptm::refdata_t *ref = res->ref_struct; - if (ref == NULL) + if (ref == nullptr) return; *p_type = ref->type; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = ptm::find_alloy_type(ref, res->mapping, numbers); int8_t temp[PTM_MAX_POINTS]; @@ -123,7 +123,7 @@ static void output_data(ptm::result_t *res, double (*points)[3], memcpy(res->mapping, temp, (ref->num_nbrs + 1) * sizeof(int8_t)); - if (F != NULL && F_res != NULL) { + if (F != nullptr && F_res != nullptr) { double scaled_points[PTM_MAX_INPUT_POINTS][3]; ptm::subtract_barycentre(ref->num_nbrs + 1, points, scaled_points); @@ -160,11 +160,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], if (ref->type == PTM_MATCH_GRAPHENE) // hack for pseudo-2d structures F[8] = 1; - if (P != NULL && U != NULL) + if (P != nullptr && U != nullptr) ptm::polar_decomposition_3x3(F, false, U, P); } - if (output_indices != NULL) + if (output_indices != nullptr) for (int i = 0; i < ref->num_nbrs + 1; i++) output_indices[i] = ordering[res->mapping[i]]; @@ -173,10 +173,10 @@ static void output_data(ptm::result_t *res, double (*points)[3], double lattice_constant = calculate_lattice_constant(ref->type, interatomic_distance); - if (p_interatomic_distance != NULL) + if (p_interatomic_distance != nullptr) *p_interatomic_distance = interatomic_distance; - if (p_lattice_constant != NULL) + if (p_lattice_constant != nullptr) *p_lattice_constant = lattice_constant; *p_rmsd = res->rmsd; @@ -200,7 +200,7 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, int ret = 0; ptm::result_t res; - res.ref_struct = NULL; + res.ref_struct = nullptr; res.rmsd = INFINITY; size_t ordering[PTM_MAX_INPUT_POINTS]; @@ -269,13 +269,13 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, } *p_type = PTM_MATCH_NONE; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = PTM_ALLOY_NONE; - if (output_indices != NULL) + if (output_indices != nullptr) memset(output_indices, -1, PTM_MAX_INPUT_POINTS * sizeof(size_t)); - if (res.ref_struct == NULL) + if (res.ref_struct == nullptr) return PTM_NO_ERROR; if (res.ref_struct->type == PTM_MATCH_DCUB || diff --git a/src/USER-PTM/ptm_initialize_data.h b/src/USER-PTM/ptm_initialize_data.h index 87111b1282..dd1cddd9f2 100644 --- a/src/USER-PTM/ptm_initialize_data.h +++ b/src/USER-PTM/ptm_initialize_data.h @@ -50,17 +50,17 @@ const refdata_t structure_sc = { PTM_MATCH_SC, //. NUM_SC_GRAPHS, //.num_graphs graphs_sc, //.graphs ptm_template_sc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_sc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_sc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_fcc = { PTM_MATCH_FCC, //.type @@ -70,17 +70,17 @@ const refdata_t structure_fcc = { PTM_MATCH_FCC, / NUM_FCC_GRAPHS, //.num_graphs graphs_fcc, //.graphs ptm_template_fcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_fcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_fcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_hcp = { PTM_MATCH_HCP, //.type @@ -91,12 +91,12 @@ const refdata_t structure_hcp = { PTM_MATCH_HCP, / graphs_hcp, //.graphs ptm_template_hcp, //.points ptm_template_hcp_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_hcp, //.penrose penrose_hcp_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_HEX_MAPPINGS, //.num_mappings mapping_hcp, //.mapping mapping_hcp_conventional, //.mapping_conventional @@ -110,17 +110,17 @@ const refdata_t structure_ico = { PTM_MATCH_ICO, / NUM_ICO_GRAPHS, //.num_graphs graphs_ico, //.graphs ptm_template_ico, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_ico, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_ICO_MAPPINGS, //.num_mappings mapping_ico, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_bcc = { PTM_MATCH_BCC, //.type @@ -130,17 +130,17 @@ const refdata_t structure_bcc = { PTM_MATCH_BCC, / NUM_BCC_GRAPHS, //.num_graphs graphs_bcc, //.graphs ptm_template_bcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_bcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_bcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_dcub = { PTM_MATCH_DCUB, //.type @@ -151,12 +151,12 @@ const refdata_t structure_dcub = { PTM_MATCH_DCUB, graphs_dcub, //.graphs ptm_template_dcub, //.points ptm_template_dcub_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_dcub, //.penrose penrose_dcub_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_DCUB_MAPPINGS, //.num_mappings mapping_dcub, //.mapping mapping_dcub_conventional, //.mapping_conventional @@ -188,15 +188,15 @@ const refdata_t structure_graphene = { PTM_MATCH_GRAPHENE, -1, //.num_facets -1, //.max_degree -1, //.num_graphs - NULL, //.graphs + nullptr, //.graphs ptm_template_graphene, //.points ptm_template_graphene_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_graphene, //.penrose penrose_graphene_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 -1, //.num_mappings mapping_graphene, //.mapping mapping_graphene_conventional, //.mapping_conventional diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 9f07030004..f6d0f9300a 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -169,7 +169,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -191,7 +191,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -242,7 +242,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -250,7 +250,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -353,11 +353,11 @@ FixQMMM::FixQMMM(LAMMPS *lmp, int narg, char **arg) : mm_comm = MPI_Comm_f2c(qmmmcfg.mm_comm); /* initialize storage */ - qm_idmap = mm_idmap = NULL; - qm_remap = mm_remap = NULL; - qm_coord = mm_coord = qm_force = mm_force = NULL; - qm_charge =NULL; - mm_type = NULL; + qm_idmap = mm_idmap = nullptr; + qm_remap = mm_remap = nullptr; + qm_coord = mm_coord = qm_force = mm_force = nullptr; + qm_charge =nullptr; + mm_type = nullptr; do_init = 1; diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 034738023c..2b05ce5436 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -246,19 +246,19 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : peflag = 1; // allocate qbmsst - temperature = NULL; - pressure = NULL; - pe = NULL; - old_velocity = NULL; - rfix = NULL; - gfactor = NULL; - random = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; + old_velocity = nullptr; + rfix = nullptr; + gfactor = nullptr; + random = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; // initialize Marsagxlia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -331,7 +331,7 @@ void FixQBMSST::init() boltz = force->boltz; nktv2p = force->nktv2p; mvv2e = force->mvv2e; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix qbmsst without per-type mass defined"); // set compute ptrs diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index 3f29229beb..ff36326edb 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -94,16 +94,16 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : maxexchange = 6*N_f+3; // allocate qtb - gfactor1 = NULL; - gfactor3 = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; - id_temp = NULL; - temperature = NULL; + gfactor1 = nullptr; + gfactor3 = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; + id_temp = nullptr; + temperature = nullptr; // initialize Marsaglia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -158,7 +158,7 @@ void FixQTB::init() { // copy parameters from other classes double dtv = update->dt; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); //initiate the counter \mu diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 5511efe681..d2093941a0 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -45,10 +45,10 @@ PairQUIP::PairQUIP(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; manybody_flag = 1; - map = NULL; - quip_potential = NULL; - quip_file = NULL; - quip_string = NULL; + map = nullptr; + quip_potential = nullptr; + quip_file = nullptr; + quip_string = nullptr; } PairQUIP::~PairQUIP() diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 5d57b74056..41a2244d44 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -92,10 +92,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_react); - fix1 = NULL; - fix2 = NULL; - fix3 = NULL; - reset_mol_ids = NULL; + fix1 = nullptr; + fix2 = nullptr; + fix3 = nullptr; + reset_mol_ids = nullptr; if (narg < 8) error->all(FLERR,"Illegal fix bond/react command: " "too few arguments"); @@ -116,12 +116,12 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : narrhenius = 0; status = PROCEED; - nxspecial = NULL; - onemol_nxspecial = NULL; - twomol_nxspecial = NULL; - xspecial = NULL; - onemol_xspecial = NULL; - twomol_xspecial = NULL; + nxspecial = nullptr; + onemol_nxspecial = nullptr; + twomol_nxspecial = nullptr; + xspecial = nullptr; + onemol_xspecial = nullptr; + twomol_xspecial = nullptr; // these group names are reserved for use exclusively by bond/react master_group = (char *) "bond_react_MASTER_group"; @@ -472,16 +472,16 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; - probability = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; + probability = nullptr; maxcreate = 0; - created = NULL; - ncreate = NULL; + created = nullptr; + ncreate = nullptr; allncreate = 0; local_num_mega = 0; ghostly_num_mega = 0; - restore = NULL; + restore = nullptr; // zero out stats global_megasize = 0; @@ -489,17 +489,17 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : glove_counter = 0; guess_branch = new int[MAXGUESS](); pioneer_count = new int[max_natoms]; - local_mega_glove = NULL; - ghostly_mega_glove = NULL; - global_mega_glove = NULL; + local_mega_glove = nullptr; + ghostly_mega_glove = nullptr; + global_mega_glove = nullptr; // these are merely loop indices that became important pion = neigh = trace = 0; - id_fix1 = NULL; - id_fix2 = NULL; - id_fix3 = NULL; - statted_id = NULL; + id_fix1 = nullptr; + id_fix2 = nullptr; + id_fix3 = nullptr; + statted_id = nullptr; custom_exclude_flag = 0; // used to store restart info @@ -708,7 +708,7 @@ void FixBondReact::post_constructor() int unused; char * idprop; idprop = (char *) fix->extract("property",unused); - if (idprop == NULL) + if (idprop == nullptr) error->all(FLERR,"Exclude group must be a per-atom property group"); len = strlen(idprop) + 1; @@ -750,7 +750,7 @@ void FixBondReact::init() // check cutoff for iatomtype,jatomtype for (int i = 0; i < nreacts; i++) { - if (force->pair == NULL || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) + if (force->pair == nullptr || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) error->all(FLERR,"Bond/react: Fix bond/react cutoff is longer than pairwise cutoff"); } @@ -3132,7 +3132,7 @@ void FixBondReact::read(int myrxn) // skip 1st line of file eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); + if (eof == nullptr) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); // read header lines // skip blank lines or lines that start with "#" @@ -3403,7 +3403,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int mode, int myID) void FixBondReact::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Bond/react: Cannot open map file %s",file); error->one(FLERR,str); @@ -3414,7 +3414,7 @@ void FixBondReact::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -3431,11 +3431,11 @@ void FixBondReact::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return @@ -3477,7 +3477,7 @@ int FixBondReact::parse(char *line, char **words, int max) int nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((ptr = strtok(NULL," \t\n\r\f"))) { + while ((ptr = strtok(nullptr," \t\n\r\f"))) { if (nwords < max) words[nwords] = ptr; nwords++; } diff --git a/src/USER-REAXC/compute_spec_atom.cpp b/src/USER-REAXC/compute_spec_atom.cpp index bc5b26b699..1c4856d728 100644 --- a/src/USER-REAXC/compute_spec_atom.cpp +++ b/src/USER-REAXC/compute_spec_atom.cpp @@ -117,8 +117,8 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 4a61cfa03b..71a84a4130 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -60,7 +60,7 @@ static const char cite_fix_qeq_reax[] = /* ---------------------------------------------------------------------- */ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pertype_option(NULL) + Fix(lmp, narg, arg), pertype_option(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_qeq_reax); @@ -83,33 +83,33 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[8],"dual") == 0) dual_enabled = 1; else error->all(FLERR,"Illegal fix qeq/reax command"); } - shld = NULL; + shld = nullptr; n = n_cap = 0; N = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 4; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; - b_prc = NULL; - b_prm = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; + b_prc = nullptr; + b_prm = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // dual CG support // Update comm sizes for this fix @@ -119,10 +119,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - reaxc = NULL; + reaxc = nullptr; reaxc = (PairReaxC *) force->pair_match("^reax/c",0); - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); for (int i = 0; i < atom->nmax; i++) @@ -184,13 +184,13 @@ void FixQEqReax::pertype_parameters(char *arg) if (strcmp(arg,"reax/c") == 0) { reaxflag = 1; Pair *pair = force->pair_match("reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/reax"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/reax"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/reax could not extract params from pair reax/c"); return; @@ -208,7 +208,7 @@ void FixQEqReax::pertype_parameters(char *arg) memory->create(gamma,ntypes+1,"qeq/reax:gamma"); if (comm->me == 0) { - if ((pf = fopen(arg,"r")) == NULL) + if ((pf = fopen(arg,"r")) == nullptr) error->one(FLERR,"Fix qeq/reax parameter file could not be found"); for (i = 1; i <= ntypes && !feof(pf); i++) { @@ -390,7 +390,7 @@ void FixQEqReax::init_shielding() int ntypes; ntypes = atom->ntypes; - if (shld == NULL) + if (shld == nullptr) memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); for (i = 1; i <= ntypes; ++i) diff --git a/src/USER-REAXC/fix_reaxc.cpp b/src/USER-REAXC/fix_reaxc.cpp index c98adf5b45..14f4762ce1 100644 --- a/src/USER-REAXC/fix_reaxc.cpp +++ b/src/USER-REAXC/fix_reaxc.cpp @@ -41,8 +41,8 @@ FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : // register with atom class oldnmax = 0; - num_bonds = NULL; - num_hbonds = NULL; + num_bonds = nullptr; + num_hbonds = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index c0ffd4c17e..a16446e769 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -65,7 +65,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[4],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/bonds file %s",arg[4]); error->one(FLERR,str); @@ -75,9 +75,9 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : if (atom->tag_consecutive() == 0) error->all(FLERR,"Atom IDs must be consecutive for fix reax/c bonds"); - abo = NULL; - neighid = NULL; - numneigh = NULL; + abo = nullptr; + neighid = nullptr; + numneigh = nullptr; allocate(); } @@ -114,7 +114,7 @@ void FixReaxCBonds::setup(int /*vflag*/) void FixReaxCBonds::init() { reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); } @@ -235,7 +235,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) } j += (5+numbonds); - if (atom->molecule == NULL ) buf[j] = 0.0; + if (atom->molecule == nullptr ) buf[j] = 0.0; else buf[j] = atom->molecule[i]; j ++; diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index ec03ab1808..9527485705 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -97,7 +97,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : error->warning(FLERR,"Resetting reneighboring criteria for fix reax/c/species"); } - tmparg = NULL; + tmparg = nullptr; memory->create(tmparg,4,4,"reax/c/species:tmparg"); strcpy(tmparg[0],arg[3]); strcpy(tmparg[1],arg[4]); @@ -119,28 +119,28 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[6],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/species file %s",arg[6]); error->one(FLERR,str); } } - x0 = NULL; - clusterID = NULL; + x0 = nullptr; + clusterID = nullptr; int ntmp = 1; memory->create(x0,ntmp,"reax/c/species:x0"); memory->create(clusterID,ntmp,"reax/c/species:clusterID"); vector_atom = clusterID; - BOCut = NULL; - Name = NULL; - MolName = NULL; - MolType = NULL; - NMol = NULL; - nd = NULL; - molmap = NULL; + BOCut = nullptr; + Name = nullptr; + MolName = nullptr; + MolType = nullptr; + NMol = nullptr; + nd = nullptr; + molmap = nullptr; nmax = 0; setupflag = 0; @@ -156,8 +156,8 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : BOCut[i][j] = bg_cut; // optional args - eletype = NULL; - ele = filepos = NULL; + eletype = nullptr; + ele = filepos = nullptr; eleflag = posflag = padflag = 0; singlepos_opened = multipos_opened = 0; @@ -213,7 +213,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else { if (me == 0) { pos = fopen(filepos, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); } singlepos_opened = 1; multipos = 0; @@ -278,7 +278,7 @@ int FixReaxCSpecies::setmask() void FixReaxCSpecies::setup(int /*vflag*/) { ntotal = static_cast (atom->natoms); - if (Name == NULL) + if (Name == nullptr) memory->create(Name,ntypes,"reax/c/species:Name"); post_integrate(); @@ -292,7 +292,7 @@ void FixReaxCSpecies::init() error->all(FLERR,"Cannot use fix reax/c/species unless atoms have IDs"); reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/species without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/species without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); reaxc->fixspecies_flag = 1; @@ -579,7 +579,7 @@ void FixReaxCSpecies::FindMolecule () void FixReaxCSpecies::SortMolecule(int &Nmole) { memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; int n, idlo, idhi; int *mask =atom->mask; @@ -641,7 +641,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) } memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; } @@ -656,11 +656,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) int *Nameall, *NMolall; memory->destroy(MolName); - MolName = NULL; + MolName = nullptr; memory->create(MolName,Nmole*(ntypes+1),"reax/c/species:MolName"); memory->destroy(NMol); - NMol = NULL; + NMol = nullptr; memory->create(NMol,Nmole,"reax/c/species:NMol"); for (m = 0; m < Nmole; m ++) NMol[m] = 1; @@ -705,11 +705,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) memory->destroy(Nameall); memory->destroy(nd); - nd = NULL; + nd = nullptr; memory->create(nd,Nspec,"reax/c/species:nd"); memory->destroy(MolType); - MolType = NULL; + MolType = nullptr; memory->create(MolType,Nspec*(ntypes+2),"reax/c/species:MolType"); } @@ -793,8 +793,8 @@ void FixReaxCSpecies::OpenPos() if (me == 0) { pos = fopen(filecurrent, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); - } else pos = NULL; + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); + } else pos = nullptr; multipos_opened = 1; free(filecurrent); @@ -831,7 +831,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) fprintf(pos,"ID\tAtom_Count\tType\tAve_q\t\tCoM_x\t\tCoM_y\t\tCoM_z\n"); } - Nameall = NULL; + Nameall = nullptr; memory->create(Nameall,ntypes,"reax/c/species:Nameall"); for (m = 1; m <= Nmole; m ++) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c38257ae30..6a2ba7d754 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -117,16 +117,16 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->bndry_cuts.ghost_hbond = 0; system->bndry_cuts.ghost_bond = 0; system->bndry_cuts.ghost_cutoff = 0; - system->my_atoms = NULL; + system->my_atoms = nullptr; system->pair_ptr = this; system->error_ptr = error; control->error_ptr = error; system->omp_active = 0; - fix_reax = NULL; - tmpid = NULL; - tmpbo = NULL; + fix_reax = nullptr; + tmpid = nullptr; + tmpbo = nullptr; nextra = 14; pvector = new double[nextra]; @@ -318,7 +318,7 @@ void PairReaxC::coeff( int nargs, char **args ) char *file = args[2]; FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if (fp != NULL) + if (fp != nullptr) Read_Force_Field(fp, &(system->reax_param), control); else { char str[128]; @@ -327,7 +327,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr int itmp = 0; int nreax_types = system->reax_param.num_atom_types; @@ -424,7 +424,7 @@ void PairReaxC::init_style( ) if (lists[i].allocated != 1) lists[i].allocated = 0; - if (fix_reax == NULL) { + if (fix_reax == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) fix_id; fixarg[1] = (char *) "all"; @@ -819,7 +819,7 @@ void *PairReaxC::extract(const char *str, int &dim) else gamma[i] = 0.0; return (void *) gamma; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index f0b0e82299..0390769b53 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -57,10 +57,10 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); #ifdef LMP_USER_OMP - workspace->CdDeltaReduction = NULL; - workspace->forceReduction = NULL; - workspace->valence_angle_atom_myoffset = NULL; - workspace->my_ext_pressReduction = NULL; + workspace->CdDeltaReduction = nullptr; + workspace->forceReduction = nullptr; + workspace->valence_angle_atom_myoffset = nullptr; + workspace->my_ext_pressReduction = nullptr; #else LMP_UNUSED_PARAM(workspace); #endif diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 12aa989fa2..1c8c24c315 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -41,7 +41,7 @@ char Read_Control_File( char *control_file, control_params* control, double val; /* open control file */ - if ( (fp = fopen( control_file, "r" ) ) == NULL ) { + if ( (fp = fopen( control_file, "r" ) ) == nullptr ) { control->error_ptr->all(FLERR, "The control file cannot be opened"); } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index f68a2a2abb..866e3c9891 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -50,7 +50,7 @@ int Init_Output_Files( reax_system *system, control_params *control, /* init potentials file */ sprintf( temp, "%s.pot", control->sim_name ); - if ((out_control->pot = fopen( temp, "w" )) != NULL) { + if ((out_control->pot = fopen( temp, "w" )) != nullptr) { fflush( out_control->pot ); } else { strcpy( msg, "init_out_controls: .pot file could not be opened\n" ); @@ -65,7 +65,7 @@ int Init_Output_Files( reax_system *system, control_params *control, control->ensemble == iNPT || control->ensemble == sNPT ) { sprintf( temp, "%s.prs", control->sim_name ); - if ((out_control->prs = fopen( temp, "w" )) != NULL) { + if ((out_control->prs = fopen( temp, "w" )) != nullptr) { fprintf(out_control->prs,"%8s%13s%13s%13s%13s%13s%13s%13s\n", "step", "Pint/norm[x]", "Pint/norm[y]", "Pint/norm[z]", "Pext/Ptot[x]", "Pext/Ptot[y]", "Pext/Ptot[z]", "Pkin/V" ); @@ -91,12 +91,12 @@ int Close_Output_Files( reax_system *system, control_params * /* control */, if (system->my_rank == MASTER_NODE) { if (out_control->pot) { fclose( out_control->pot ); - out_control->pot = NULL; + out_control->pot = nullptr; } if (out_control->prs) { fclose(out_control->prs); - out_control->prs = NULL; + out_control->prs = nullptr; } } diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 0880d96311..ea59b84ff9 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -106,37 +106,37 @@ void Delete_List( reax_list *l ) sfree(l->error_ptr, l->index, "list:index" ); sfree(l->error_ptr, l->end_index, "list:end_index" ); - l->index = NULL; - l->end_index = NULL; + l->index = nullptr; + l->end_index = nullptr; switch(l->type) { case TYP_VOID: sfree(l->error_ptr, l->select.v, "list:v" ); - l->select.v = NULL; + l->select.v = nullptr; break; case TYP_HBOND: sfree(l->error_ptr, l->select.hbond_list, "list:hbonds" ); - l->select.hbond_list = NULL; + l->select.hbond_list = nullptr; break; case TYP_FAR_NEIGHBOR: sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs" ); - l->select.far_nbr_list = NULL; + l->select.far_nbr_list = nullptr; break; case TYP_BOND: sfree(l->error_ptr, l->select.bond_list, "list:bonds" ); - l->select.bond_list = NULL; + l->select.bond_list = nullptr; break; case TYP_DBO: sfree(l->error_ptr, l->select.dbo_list, "list:dbos" ); - l->select.dbo_list = NULL; + l->select.dbo_list = nullptr; break; case TYP_DDELTA: sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas" ); - l->select.dDelta_list = NULL; + l->select.dDelta_list = nullptr; break; case TYP_THREE_BODY: sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies" ); - l->select.three_body_list = NULL; + l->select.three_body_list = nullptr; break; default: diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index 07a45b9467..b78b00568d 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -48,7 +48,7 @@ double Get_Time( ) t /= 1000.0; return t; #else - gettimeofday(&tim, NULL ); + gettimeofday(&tim, nullptr ); return( tim.tv_sec + (tim.tv_usec / 1000000.0) ); #endif } @@ -62,7 +62,7 @@ int Tokenize( char* s, char*** tok ) strncpy( test, s, MAX_LINE-1); - for( word = strtok(test, sep); word; word = strtok(NULL, sep) ) { + for( word = strtok(test, sep); word; word = strtok(nullptr, sep) ) { strncpy( (*tok)[count], word, MAX_LINE ); count++; } @@ -84,11 +84,11 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = malloc( n ); - if (ptr == NULL) { + if (ptr == nullptr) { snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); @@ -109,7 +109,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL.\n", n, name ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } if (size <= 0) { @@ -117,11 +117,11 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL", name, size ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = calloc( n, size ); - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -135,7 +135,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c /* safe free */ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) { - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -144,6 +144,6 @@ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) } free( ptr ); - ptr = NULL; + ptr = nullptr; } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 717bf741e7..698715de22 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -41,7 +41,7 @@ int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_ out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (out_control->buffer == NULL) { + if (out_control->buffer == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*REAX_SAFE_ZONE)); error_ptr->one(FLERR,errmsg); @@ -341,7 +341,7 @@ int Init_Traj( reax_system *system, control_params *control, /* allocate line & buffer space */ out_control->line = (char*) calloc( MAX_TRJ_LINE_LEN + 1, sizeof(char) ); out_control->buffer_len = 0; - out_control->buffer = NULL; + out_control->buffer = nullptr; /* write trajectory header and atom info, if applicable */ if (out_control->traj_method == REG_TRAJ) { diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index c49f99a5a0..4dd796a340 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -42,10 +42,10 @@ Scafacos::Scafacos(LAMMPS *lmp) : KSpace(lmp) initialized = 0; maxatom = 0; - xpbc = NULL; - epot = NULL; - efield = NULL; - fcs = NULL; + xpbc = nullptr; + epot = nullptr; + efield = nullptr; + fcs = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SDPD/fix_meso_move.cpp b/src/USER-SDPD/fix_meso_move.cpp index c39d142a6e..45843268f0 100644 --- a/src/USER-SDPD/fix_meso_move.cpp +++ b/src/USER-SDPD/fix_meso_move.cpp @@ -43,9 +43,9 @@ enum{EQUAL,ATOM}; FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), - vxvarstr(NULL), vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), displace(NULL), velocity(NULL) { + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), + vxvarstr(nullptr), vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), displace(nullptr), velocity(nullptr) { if ((atom->esph_flag != 1) || (atom->rho_flag != 1)) error->all(FLERR, "fix meso/move command requires atom_style with both energy and density"); @@ -126,37 +126,37 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix meso/move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -237,7 +237,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : atom->add_callback(0); atom->add_callback(1); - displace = velocity = NULL; + displace = velocity = nullptr; // xoriginal = initial unwrapped positions of atoms @@ -353,9 +353,9 @@ void FixMesoMove::init () { memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; } void FixMesoMove::setup_pre_force (int /*vflag*/) { @@ -731,7 +731,7 @@ void FixMesoMove::initial_integrate (int /*vflag*/) { } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMesoMove::final_integrate () { diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index bf2fc73b01..b3a084ab1d 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -307,7 +307,7 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { void PairSDPDTaitwaterIsothermal::init_style() { - if ((!atom->rho_flag) || (atom->drho == NULL)) + if ((!atom->rho_flag) || (atom->drho == nullptr)) error->all(FLERR,"Pair style dpd/taitwater/isothermal requires atom " "attributes rho and drho"); diff --git a/src/USER-SMD/compute_smd_contact_radius.cpp b/src/USER-SMD/compute_smd_contact_radius.cpp index 46cbc602f2..ccab79f85e 100644 --- a/src/USER-SMD/compute_smd_contact_radius.cpp +++ b/src/USER-SMD/compute_smd_contact_radius.cpp @@ -46,7 +46,7 @@ ComputeSMDContactRadius::ComputeSMDContactRadius(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - contact_radius_vector = NULL; + contact_radius_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_damage.cpp b/src/USER-SMD/compute_smd_damage.cpp index 96a936cd82..9e58903c95 100644 --- a/src/USER-SMD/compute_smd_damage.cpp +++ b/src/USER-SMD/compute_smd_damage.cpp @@ -46,7 +46,7 @@ ComputeSMDDamage::ComputeSMDDamage(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - damage_vector = NULL; + damage_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_hourglass_error.cpp b/src/USER-SMD/compute_smd_hourglass_error.cpp index 3b6b900004..4118025039 100644 --- a/src/USER-SMD/compute_smd_hourglass_error.cpp +++ b/src/USER-SMD/compute_smd_hourglass_error.cpp @@ -49,7 +49,7 @@ ComputeSMDHourglassError::ComputeSMDHourglassError(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - hourglass_error_vector = NULL; + hourglass_error_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void ComputeSMDHourglassError::compute_peratom() { int itmp = 0; double *hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); - if (hourglass_error == NULL) { + if (hourglass_error == nullptr) { error->all(FLERR, "compute smd/hourglass_error failed to access hourglass_error array"); } diff --git a/src/USER-SMD/compute_smd_internal_energy.cpp b/src/USER-SMD/compute_smd_internal_energy.cpp index 90ddb74839..c7b11e22cf 100644 --- a/src/USER-SMD/compute_smd_internal_energy.cpp +++ b/src/USER-SMD/compute_smd_internal_energy.cpp @@ -46,7 +46,7 @@ ComputeSMDInternalEnergy::ComputeSMDInternalEnergy(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - internal_energy_vector = NULL; + internal_energy_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain.cpp b/src/USER-SMD/compute_smd_plastic_strain.cpp index c1c001a5dd..842d848890 100644 --- a/src/USER-SMD/compute_smd_plastic_strain.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrain::ComputeSMDPlasticStrain(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - plastic_strain_vector = NULL; + plastic_strain_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp index 272a2c59e5..907e503f54 100644 --- a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrainRate::ComputeSMDPlasticStrainRate(LAMMPS *lmp, int narg, size_peratom_cols = 0; nmax = 0; - plastic_strain_rate_vector = NULL; + plastic_strain_rate_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_rho.cpp b/src/USER-SMD/compute_smd_rho.cpp index d9c0a99b07..89db0b0acd 100644 --- a/src/USER-SMD/compute_smd_rho.cpp +++ b/src/USER-SMD/compute_smd_rho.cpp @@ -46,7 +46,7 @@ ComputeSMDRho::ComputeSMDRho(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp index 81792355e0..b283a41c4f 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp @@ -49,7 +49,7 @@ ComputeSMDTLSPHDefgrad::ComputeSMDTLSPHDefgrad(LAMMPS *lmp, int narg, char **arg size_peratom_cols = 10; nmax = 0; - defgradVector = NULL; + defgradVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_dt.cpp b/src/USER-SMD/compute_smd_tlsph_dt.cpp index 7752436b8a..a02ff838d4 100644 --- a/src/USER-SMD/compute_smd_tlsph_dt.cpp +++ b/src/USER-SMD/compute_smd_tlsph_dt.cpp @@ -49,7 +49,7 @@ ComputeSMDTlsphDt::ComputeSMDTlsphDt(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMDTlsphDt::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/tlsph_dt failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp index 347b138412..f5f14fa500 100644 --- a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDTLSPHNumNeighs::ComputeSMDTLSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsRefConfigOutput = NULL; + numNeighsRefConfigOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDTLSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighsRefConfig = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (numNeighsRefConfig == NULL) { + if (numNeighsRefConfig == nullptr) { error->all(FLERR, "compute smd/tlsph_num_neighs failed to access numNeighsRefConfig array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_shape.cpp b/src/USER-SMD/compute_smd_tlsph_shape.cpp index a3727871de..a978fd2e9e 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.cpp +++ b/src/USER-SMD/compute_smd_tlsph_shape.cpp @@ -51,7 +51,7 @@ ComputeSmdTlsphShape::ComputeSmdTlsphShape(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 7; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,12 +89,12 @@ void ComputeSmdTlsphShape::compute_peratom() { int itmp = 0; Matrix3d *R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); - if (R == NULL) { + if (R == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access rotation array"); } Matrix3d *F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (F == NULL) { + if (F == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access deformation gradient array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain.cpp b/src/USER-SMD/compute_smd_tlsph_strain.cpp index db51ca4125..5e86f4fd38 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHstrain::ComputeSMDTLSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ void ComputeSMDTLSPHstrain::compute_peratom() { // copy data to output array int itmp = 0; Matrix3d *Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (Fincr == NULL) { + if (Fincr == nullptr) { error->all(FLERR, "compute smd/tlsph_strain failed to access Fincr array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp index 577dc0e40f..3d9f467694 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHStrainRate::ComputeSMDTLSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,7 +89,7 @@ void ComputeSMDTLSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); - if (D == NULL) { + if (D == nullptr) { error->all(FLERR, "compute smd/tlsph_strain_rate could not access strain rate. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_tlsph_stress.cpp b/src/USER-SMD/compute_smd_tlsph_stress.cpp index 9c78b192ce..f668a7f82b 100644 --- a/src/USER-SMD/compute_smd_tlsph_stress.cpp +++ b/src/USER-SMD/compute_smd_tlsph_stress.cpp @@ -60,7 +60,7 @@ ComputeSMDTLSPHStress::ComputeSMDTLSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDTLSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/tlsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_triangle_vertices.cpp b/src/USER-SMD/compute_smd_triangle_vertices.cpp index 06706a85ad..46555559d3 100644 --- a/src/USER-SMD/compute_smd_triangle_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_vertices.cpp @@ -46,7 +46,7 @@ ComputeSMDTriangleVertices::ComputeSMDTriangleVertices(LAMMPS *lmp, int narg, ch size_peratom_cols = 9; nmax = 0; - outputVector = NULL; + outputVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_effm.cpp b/src/USER-SMD/compute_smd_ulsph_effm.cpp index fc8637bbf0..4285d1c981 100644 --- a/src/USER-SMD/compute_smd_ulsph_effm.cpp +++ b/src/USER-SMD/compute_smd_ulsph_effm.cpp @@ -49,7 +49,7 @@ ComputeSMD_Ulsph_Effm::ComputeSMD_Ulsph_Effm(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMD_Ulsph_Effm::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/ulsph_effm failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp index 4ef339db98..57460c2929 100644 --- a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDULSPHNumNeighs::ComputeSMDULSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsOutput = NULL; + numNeighsOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDULSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighs = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (numNeighs == NULL) { + if (numNeighs == nullptr) { error->all(FLERR, "compute smd/ulsph_num_neighs failed to access numNeighs array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_strain.cpp b/src/USER-SMD/compute_smd_ulsph_strain.cpp index cf1535759c..a4211a6b60 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDULSPHstrain::ComputeSMDULSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp index f5ff4fef98..9118e6dded 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp @@ -49,7 +49,7 @@ ComputeSMDULSPHStrainRate::ComputeSMDULSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ void ComputeSMDULSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->all(FLERR, "compute smd/ulsph_strain_rate could not access any velocity gradients. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_ulsph_stress.cpp b/src/USER-SMD/compute_smd_ulsph_stress.cpp index ea477375ce..c7078a5741 100644 --- a/src/USER-SMD/compute_smd_ulsph_stress.cpp +++ b/src/USER-SMD/compute_smd_ulsph_stress.cpp @@ -59,7 +59,7 @@ ComputeSMDULSPHStress::ComputeSMDULSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDULSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/ulsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_vol.cpp b/src/USER-SMD/compute_smd_vol.cpp index 5999dfaa5d..46aa7ea3c4 100644 --- a/src/USER-SMD/compute_smd_vol.cpp +++ b/src/USER-SMD/compute_smd_vol.cpp @@ -48,7 +48,7 @@ ComputeSMDVol::ComputeSMDVol(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - volVector = NULL; + volVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index b5dab3d3a1..ccb64b8f2f 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -108,28 +108,28 @@ void FixSMDTlsphDtReset::end_of_step() { double *dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); double *dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); - if ((dtCFL_TLSPH == NULL) && (dtCFL_ULSPH == NULL) && (dt_TRI == NULL) && (dt_HERTZ == NULL) - && (dt_PERI_IPMB == NULL)) { + if ((dtCFL_TLSPH == nullptr) && (dtCFL_ULSPH == nullptr) && (dt_TRI == nullptr) && (dt_HERTZ == nullptr) + && (dt_PERI_IPMB == nullptr)) { error->all(FLERR, "fix smd/adjust_dt failed to access a valid dtCFL"); } - if (dtCFL_TLSPH != NULL) { + if (dtCFL_TLSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_TLSPH); } - if (dtCFL_ULSPH != NULL) { + if (dtCFL_ULSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_ULSPH); } - if (dt_TRI != NULL) { + if (dt_TRI != nullptr) { dtmin = MIN(dtmin, *dt_TRI); } - if (dt_HERTZ != NULL) { + if (dt_HERTZ != nullptr) { dtmin = MIN(dtmin, *dt_HERTZ); } - if (dt_PERI_IPMB != NULL) { + if (dt_PERI_IPMB != nullptr) { dtmin = MIN(dtmin, *dt_PERI_IPMB); } diff --git a/src/USER-SMD/fix_smd_integrate_tlsph.cpp b/src/USER-SMD/fix_smd_integrate_tlsph.cpp index 7d5e89f895..743cd09f0d 100644 --- a/src/USER-SMD/fix_smd_integrate_tlsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_tlsph.cpp @@ -139,7 +139,7 @@ void FixSMDIntegrateTlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVelDifference == NULL) { + if (smoothVelDifference == nullptr) { error->one(FLERR, "fix smd/integrate_tlsph failed to access smoothVel array. Check if a pair style exist which calculates this quantity."); } diff --git a/src/USER-SMD/fix_smd_integrate_ulsph.cpp b/src/USER-SMD/fix_smd_integrate_ulsph.cpp index 215759331e..c261537dfa 100644 --- a/src/USER-SMD/fix_smd_integrate_ulsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_ulsph.cpp @@ -171,7 +171,7 @@ void FixSMDIntegrateUlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVel == NULL) { + if (smoothVel == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to access smoothVel array"); } } @@ -259,12 +259,12 @@ void FixSMDIntegrateUlsph::final_integrate() { int itmp; int *nn = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss num_neighs array"); } Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss velocityGradient array"); } diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index d3e71f0e50..3301999270 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -57,7 +57,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3], "v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -93,7 +93,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -241,7 +241,7 @@ void FixSMDSetVel::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp index 3e63de08f3..f0b405f947 100644 --- a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp +++ b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp @@ -59,12 +59,12 @@ FixSMD_TLSPH_ReferenceConfiguration::FixSMD_TLSPH_ReferenceConfiguration(LAMMPS error->all(FLERR, "Pair tlsph with partner list requires an atom map, see atom_modify"); maxpartner = 1; - npartner = NULL; - partner = NULL; - wfd_list = NULL; - wf_list = NULL; - energy_per_bond = NULL; - degradation_ij = NULL; + npartner = nullptr; + partner = nullptr; + wfd_list = nullptr; + wf_list = nullptr; + energy_per_bond = nullptr; + degradation_ij = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -130,13 +130,13 @@ void FixSMD_TLSPH_ReferenceConfiguration::pre_exchange() { } int *updateFlag_ptr = (int *) force->pair->extract("smd/tlsph/updateFlag_ptr", itmp); - if (updateFlag_ptr == NULL) { + if (updateFlag_ptr == nullptr) { error->one(FLERR, "fix FixSMD_TLSPH_ReferenceConfiguration failed to access updateFlag pointer. Check if a pair style exist which calculates this quantity."); } int *nn = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->all(FLERR, "FixSMDIntegrateTlsph::updateReferenceConfiguration() failed to access numNeighsRefConfig_ptr array"); } @@ -468,7 +468,7 @@ int FixSMD_TLSPH_ReferenceConfiguration::pack_restart(int i, double *buf) { ------------------------------------------------------------------------- */ void FixSMD_TLSPH_ReferenceConfiguration::unpack_restart(int /*nlocal*/, int /*nth*/) { -// ipage = NULL if being called from granular pair style init() +// ipage = nullptr if being called from granular pair style init() // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index 10f248c39f..26190a5a98 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -69,7 +69,7 @@ FixSMDWallSurface::FixSMDWallSurface(LAMMPS *lmp, int narg, char **arg) : FixSMDWallSurface::~FixSMDWallSurface() { free(filename); - filename = NULL; + filename = nullptr; // unregister this fix so atom class doesn't invoke it any more //atom->delete_callback(id, 0); @@ -198,12 +198,12 @@ int FixSMDWallSurface::count_words(const char *line) { if ((ptr = strchr(copy, '#'))) *ptr = '\0'; - if (strtok(copy, " \t\n\r\f") == NULL) { + if (strtok(copy, " \t\n\r\f") == nullptr) { memory->destroy(copy); return 0; } n = 1; - while (strtok(NULL, " \t\n\r\f")) + while (strtok(nullptr, " \t\n\r\f")) n++; memory->destroy(copy); @@ -229,7 +229,7 @@ void FixSMDWallSurface::read_triangles(int pass) { Vector3d normal, center; FILE *fp = fopen(filename, "r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128, "Cannot open file %s", filename); error->one(FLERR, str); @@ -261,7 +261,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read STL solid name retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading number of triangle pairs"); } @@ -272,11 +272,11 @@ void FixSMDWallSurface::read_triangles(int pass) { // values = new char*[nwords]; // values[0] = strtok(line, " \t\n\r\f"); -// if (values[0] == NULL) +// if (values[0] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // for (m = 1; m < nwords; m++) { -// values[m] = strtok(NULL, " \t\n\r\f"); -// if (values[m] == NULL) +// values[m] = strtok(nullptr, " \t\n\r\f"); +// if (values[m] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // } // delete[] values; @@ -301,11 +301,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); } @@ -318,7 +318,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read outer loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading outer loop"); } @@ -331,7 +331,7 @@ void FixSMDWallSurface::read_triangles(int pass) { for (int k = 0; k < 3; k++) { retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading vertex line"); } @@ -342,11 +342,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect vertex line"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect vertex line"); } @@ -362,7 +362,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading endloop"); } @@ -373,7 +373,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end facet line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading endfacet"); } diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 8d3c06d5e6..c966f5ba75 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -51,9 +51,9 @@ using namespace LAMMPS_NS; PairHertz::PairHertz(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -374,6 +374,6 @@ void *PairHertz::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index 25301685a7..3c87119553 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -63,28 +63,28 @@ using namespace SMD_Math; PairTlsph::PairTlsph(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; - failureModel = NULL; - strengthModel = eos = NULL; + failureModel = nullptr; + strengthModel = eos = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - Fdot = Fincr = K = PK1 = NULL; - R = FincrInv = W = D = NULL; - detF = NULL; - smoothVelDifference = NULL; - numNeighsRefConfig = NULL; - CauchyStress = NULL; - hourglass_error = NULL; - Lookup = NULL; - particle_dt = NULL; + Fdot = Fincr = K = PK1 = nullptr; + R = FincrInv = W = D = nullptr; + detF = nullptr; + smoothVelDifference = nullptr; + numNeighsRefConfig = nullptr; + CauchyStress = nullptr; + hourglass_error = nullptr; + Lookup = nullptr; + particle_dt = nullptr; updateFlag = 0; first = true; dtCFL = 0.0; // initialize dtCFL so it is set to safe value if extracted on zero-th timestep comm_forward = 22; // this pair style communicates 20 doubles to ghost atoms : PK1 tensor + F tensor + shepardWeight - fix_tlsph_reference_configuration = NULL; + fix_tlsph_reference_configuration = nullptr; cut_comm = MAX(neighbor->cutneighmax, comm->cutghostuser); // cutoff radius within which ghost atoms are communicated. } @@ -1748,7 +1748,7 @@ void PairTlsph::init_style() { if (igroup == -1) error->all(FLERR, "Pair style tlsph requires its particles to be part of a group named tlsph. This group does not exist."); - if (fix_tlsph_reference_configuration == NULL) { + if (fix_tlsph_reference_configuration == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) "SMD_TLSPH_NEIGHBORS"; fixarg[1] = (char *) "tlsph"; @@ -1824,7 +1824,7 @@ void *PairTlsph::extract(const char *str, int &/*i*/) { return (void *) R; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 8ccba562e2..6e702ef825 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -54,9 +54,9 @@ using namespace Eigen; PairTriSurf::PairTriSurf(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -833,6 +833,6 @@ void *PairTriSurf::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 3a6cdf5d2f..bbb8cf3729 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -56,22 +56,22 @@ PairULSPH::PairULSPH(LAMMPS *lmp) : Pair(lmp) { // per-type arrays - Q1 = NULL; - eos = viscosity = strength = NULL; - c0_type = NULL; - c0 = NULL; - Lookup = NULL; - artificial_stress = NULL; - artificial_pressure = NULL; + Q1 = nullptr; + eos = viscosity = strength = nullptr; + c0_type = nullptr; + c0 = nullptr; + Lookup = nullptr; + artificial_stress = nullptr; + artificial_pressure = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - stressTensor = L = K = NULL; - shepardWeight = NULL; - smoothVel = NULL; - numNeighs = NULL; - F = NULL; - rho = NULL; - effm = NULL; + stressTensor = L = K = nullptr; + shepardWeight = nullptr; + smoothVel = nullptr; + numNeighs = nullptr; + F = nullptr; + rho = nullptr; + effm = nullptr; velocity_gradient_required = false; // turn off computation of velocity gradient by default density_summation = velocity_gradient = false; @@ -1575,7 +1575,7 @@ void *PairULSPH::extract(const char *str, int &/*i*/) { return (void *) K; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 875d254ac9..a40f676ff1 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -101,50 +101,50 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) kmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - intparams = NULL; - - intype = NULL; - coultype = NULL; - fafb = NULL; - dfafb = NULL; - potqn = NULL; - dpotqn = NULL; + params = nullptr; + intparams = nullptr; + + intype = nullptr; + coultype = nullptr; + fafb = nullptr; + dfafb = nullptr; + potqn = nullptr; + dpotqn = nullptr; Vself = 0.0; - tabsmb = NULL; - tabsmr = NULL; - dtabsmb = NULL; - dtabsmr = NULL; - - sbcov = NULL; - coord = NULL; - sbmet = NULL; - ecov = NULL; - - potmad = NULL; - potself = NULL; - potcov = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; - tab_comm = NULL; - - nvsm = NULL; - vsm = NULL; - flag_QEq = NULL; - nQEqaall = NULL; - nQEqcall = NULL; - nQEqall = NULL; + tabsmb = nullptr; + tabsmr = nullptr; + dtabsmb = nullptr; + dtabsmr = nullptr; + + sbcov = nullptr; + coord = nullptr; + sbmet = nullptr; + ecov = nullptr; + + potmad = nullptr; + potself = nullptr; + potcov = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; + tab_comm = nullptr; + + nvsm = nullptr; + vsm = nullptr; + flag_QEq = nullptr; + nQEqaall = nullptr; + nQEqcall = nullptr; + nQEqall = nullptr; nteam = 0; cluster = 0; Nevery = 0.0; Neverypot = 0.0; - fct = NULL; + fct = nullptr; maxpage = 0; @@ -277,7 +277,7 @@ void PairSMTBQ::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -286,7 +286,7 @@ void PairSMTBQ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -392,9 +392,9 @@ void PairSMTBQ::read_file(char *file) char **words; memory->sfree(params); - params = NULL; + params = nullptr; memory->sfree(intparams); - intparams = NULL; + intparams = nullptr; nparams = 0; maxparam = 0; maxintparam = 0; @@ -411,7 +411,7 @@ void PairSMTBQ::read_file(char *file) // open file on all processors FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if ( fp == NULL ) { + if ( fp == nullptr ) { char str[128]; snprintf(str,128,"Cannot open SMTBQ potential file %s",file); error->one(FLERR,str); @@ -3562,12 +3562,12 @@ int PairSMTBQ::Tokenize( char* s, char*** tok ) const char *sep = "' "; char *mot; int count=0; - mot = NULL; + mot = nullptr; strncpy( test, s, MAXLINE-1 ); - for( mot = strtok(test, sep); mot; mot = strtok(NULL, sep) ) { + for( mot = strtok(test, sep); mot; mot = strtok(nullptr, sep) ) { strncpy( (*tok)[count], mot, MAXLINE ); count++; } diff --git a/src/USER-SPH/compute_sph_e_atom.cpp b/src/USER-SPH/compute_sph_e_atom.cpp index 8869dae5f7..d8142fd790 100644 --- a/src/USER-SPH/compute_sph_e_atom.cpp +++ b/src/USER-SPH/compute_sph_e_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHEAtom::ComputeSPHEAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - evector = NULL; + evector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_rho_atom.cpp b/src/USER-SPH/compute_sph_rho_atom.cpp index 1d6d03811c..edc788a1ab 100644 --- a/src/USER-SPH/compute_sph_rho_atom.cpp +++ b/src/USER-SPH/compute_sph_rho_atom.cpp @@ -35,7 +35,7 @@ ComputeSPHRhoAtom::ComputeSPHRhoAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_t_atom.cpp b/src/USER-SPH/compute_sph_t_atom.cpp index 063af70026..253e637485 100644 --- a/src/USER-SPH/compute_sph_t_atom.cpp +++ b/src/USER-SPH/compute_sph_t_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHTAtom::ComputeSPHTAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - tvector = NULL; + tvector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index d010b004d5..a5ad46e77b 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -49,7 +49,7 @@ ComputeForceTally::ComputeForceTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - fatom = NULL; + fatom = nullptr; vector = new double[size_peratom_cols]; } @@ -66,7 +66,7 @@ ComputeForceTally::~ComputeForceTally() void ComputeForceTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute force/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 1a2dd36285..f57899c593 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -48,8 +48,8 @@ ComputeHeatFluxTally::ComputeHeatFluxTally(LAMMPS *lmp, int narg, char **arg) : did_setup = 0; invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; - eatom = NULL; + stress = nullptr; + eatom = nullptr; vector = new double[size_vector]; heatj = new double[size_vector]; } @@ -69,7 +69,7 @@ ComputeHeatFluxTally::~ComputeHeatFluxTally() void ComputeHeatFluxTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute heat/flux/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index 835d1e80bd..77bf7973da 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -59,7 +59,7 @@ ComputePEMolTally::~ComputePEMolTally() void ComputePEMolTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/mol/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index ef7c13fed2..e330b56a80 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -48,7 +48,7 @@ ComputePETally::ComputePETally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - eatom = NULL; + eatom = nullptr; vector = new double[size_peratom_cols]; } @@ -65,7 +65,7 @@ ComputePETally::~ComputePETally() void ComputePETally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/tally without a pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 2a0cbc8e4b..58d42cd93d 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -49,7 +49,7 @@ ComputeStressTally::ComputeStressTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; + stress = nullptr; vector = new double[size_peratom_cols]; virial = new double[size_peratom_cols]; } @@ -68,7 +68,7 @@ ComputeStressTally::~ComputeStressTally() void ComputeStressTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute stress/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index f910caac59..e833502952 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -57,7 +57,7 @@ static const char cite_user_uef_package[] = * temp/pressure fixes ---------------------------------------------------------------------- */ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), uefbox(NULL) + FixNH(lmp, narg, arg), uefbox(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_uef_package); diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index 59dba0d90d..cb468fc3db 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -128,11 +128,11 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : if (filewriter) reset_vtk_data_containers(); - label = NULL; + label = nullptr; { // parallel vtp/vtu requires proc number to be preceded by underscore '_' - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { multiname_ex = new char[strlen(filename) + 16]; @@ -160,12 +160,12 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : nclusterprocs = nprocs; } - filecurrent = NULL; - domainfilecurrent = NULL; - parallelfilecurrent = NULL; - header_choice = NULL; - write_choice = NULL; - boxcorners = NULL; + filecurrent = nullptr; + domainfilecurrent = nullptr; + parallelfilecurrent = nullptr; + header_choice = nullptr; + write_choice = nullptr; + boxcorners = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void DumpVTK::init_style() { // default for element names = C - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[2]; @@ -880,7 +880,7 @@ void DumpVTK::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // filewriter = 1 = this proc writes to file @@ -939,13 +939,13 @@ void DumpVTK::write_data(int n, double *mybuf) void DumpVTK::setFileCurrent() { delete [] filecurrent; - filecurrent = NULL; + filecurrent = nullptr; char *filestar = filename; if (multiproc) { if (multiproc > 1) { // if dump_modify fileper or nfile was used delete [] multiname_ex; - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { int id; @@ -983,7 +983,7 @@ void DumpVTK::setFileCurrent() { // filename of domain box data file delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multiproc) { // remove '%' character char *ptr = strchr(filename,'%'); @@ -997,7 +997,7 @@ void DumpVTK::setFileCurrent() { *ptr = '\0'; sprintf(filestar,"%s_boundingBox.%s",domainfilecurrent,ptr+1); delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multifile == 0) { domainfilecurrent = new char[strlen(filestar) + 1]; @@ -1018,7 +1018,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } else { domainfilecurrent = new char[strlen(filecurrent) + 16]; char *ptr = strrchr(filecurrent,'.'); @@ -1030,7 +1030,7 @@ void DumpVTK::setFileCurrent() { // filename of parallel file if (multiproc && me == 0) { delete [] parallelfilecurrent; - parallelfilecurrent = NULL; + parallelfilecurrent = nullptr; // remove '%' character and add 'p' to file extension // -> string length stays the same @@ -1066,7 +1066,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } } @@ -1995,7 +1995,7 @@ int DumpVTK::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -2075,7 +2075,7 @@ int DumpVTK::modify_param(int narg, char **arg) if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; @@ -2094,9 +2094,9 @@ int DumpVTK::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; } nthresh = 0; return 2; diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index c45af1d198..69dac7f58b 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -279,12 +279,12 @@ void AngleCross::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&kss[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index 34de772672..d165a2d17c 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -226,8 +226,8 @@ void AngleMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index f5d5fed946..2c310c6310 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -179,8 +179,8 @@ void BondMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 37039b27e4..757695c3c8 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -257,8 +257,8 @@ void ImproperDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index ddc4d78c93..79245d3413 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -257,8 +257,8 @@ void ImproperSQDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 98fd317794..5508ffbfdc 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairLJSwitch3CoulGaussLong::PairLJSwitch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -358,11 +358,11 @@ void PairLJSwitch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairLJSwitch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairLJSwitch3CoulGaussLong::write_restart_settings(FILE *fp) void PairLJSwitch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairLJSwitch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index e1ee0e0b98..d63f42cf3a 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairMM3Switch3CoulGaussLong::PairMM3Switch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -360,11 +360,11 @@ void PairMM3Switch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairMM3Switch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairMM3Switch3CoulGaussLong::write_restart_settings(FILE *fp) void PairMM3Switch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairMM3Switch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index be77b8457b..aa8488e86f 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -41,10 +41,10 @@ using namespace voro; /* ---------------------------------------------------------------------- */ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), con_mono(NULL), con_poly(NULL), - radstr(NULL), voro(NULL), edge(NULL), sendvector(NULL), - rfield(NULL), tags(NULL), occvec(NULL), sendocc(NULL), - lroot(NULL), lnext(NULL), faces(NULL) + Compute(lmp, narg, arg), con_mono(nullptr), con_poly(nullptr), + radstr(nullptr), voro(nullptr), edge(nullptr), sendvector(nullptr), + rfield(nullptr), tags(nullptr), occvec(nullptr), sendocc(nullptr), + lroot(nullptr), lnext(nullptr), faces(nullptr) { int sgroup; @@ -56,16 +56,16 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : surface = VOROSURF_NONE; maxedge = 0; fthresh = ethresh = 0.0; - radstr = NULL; + radstr = nullptr; onlyGroup = false; occupation = false; - con_mono = NULL; - con_poly = NULL; - tags = NULL; + con_mono = nullptr; + con_poly = nullptr; + tags = nullptr; oldmaxtag = 0; - occvec = sendocc = lroot = lnext = NULL; - faces = NULL; + occvec = sendocc = lroot = lnext = nullptr; + faces = nullptr; int iarg = 3; while ( iargall(FLERR,"Compute voronoi/atom occupation requires an atom map, see atom_modify"); nmax = rmax = 0; - edge = rfield = sendvector = NULL; - voro = NULL; + edge = rfield = sendvector = nullptr; + voro = nullptr; if ( maxedge > 0 ) { vector_flag = 1; @@ -207,7 +207,7 @@ void ComputeVoronoi::compute_peratom() if (occupation) { // build cells only once int i, nall = atom->nlocal + atom->nghost; - if (con_mono==NULL && con_poly==NULL) { + if (con_mono==nullptr && con_poly==nullptr) { // generate the voronoi cell network for the initial structure buildCells(); @@ -218,7 +218,7 @@ void ComputeVoronoi::compute_peratom() // linked list structure for cell occupation count on the atoms oldnall= nall; memory->create(lroot,nall,"voronoi/atom:lroot"); // point to first atom index in cell (or -1 for empty cell) - lnext = NULL; + lnext = nullptr; lmax = 0; // build the occupation buffer. diff --git a/src/angle.cpp b/src/angle.cpp index 2796ae01b7..4eedd7c69b 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -36,10 +36,10 @@ Angle::Angle(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 56590d6757..70779aa7b2 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -174,7 +174,7 @@ void AngleHybrid::allocate() maxangle = new int[nstyles]; anglelist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxangle[m] = 0; - for (int m = 0; m < nstyles; m++) anglelist[m] = NULL; + for (int m = 0; m < nstyles; m++) anglelist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -358,7 +358,7 @@ void AngleHybrid::write_restart(FILE *fp) void AngleHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Angle*[nstyles]; keywords = new char*[nstyles]; @@ -367,10 +367,10 @@ void AngleHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_angle(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index e087b774e0..9d8255e84c 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -128,7 +128,7 @@ void AngleZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/atom.cpp b/src/atom.cpp index 49ff262764..a58e1e3181 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -83,113 +83,113 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0; nbonds = nangles = ndihedrals = nimpropers = 0; - firstgroupname = NULL; + firstgroupname = nullptr; sortfreq = 1000; nextsort = 0; userbinsize = 0.0; maxbin = maxnext = 0; - binhead = NULL; - next = permute = NULL; + binhead = nullptr; + next = permute = nullptr; // data structure with info on per-atom vectors/arrays nperatom = maxperatom = 0; - peratom = NULL; + peratom = nullptr; // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variables - tag = NULL; - type = mask = NULL; - image = NULL; - x = v = f = NULL; + tag = nullptr; + type = mask = nullptr; + image = nullptr; + x = v = f = nullptr; // charged and dipolar particles - q = NULL; - mu = NULL; + q = nullptr; + mu = nullptr; // finite-size particles - omega = angmom = torque = NULL; - radius = rmass = NULL; - ellipsoid = line = tri = body = NULL; + omega = angmom = torque = nullptr; + radius = rmass = nullptr; + ellipsoid = line = tri = body = nullptr; // molecular systems - molecule = NULL; - molindex = molatom = NULL; + molecule = nullptr; + molindex = molatom = nullptr; bond_per_atom = extra_bond_per_atom = 0; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; angle_per_atom = extra_angle_per_atom = 0; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; dihedral_per_atom = extra_dihedral_per_atom = 0; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; improper_per_atom = extra_improper_per_atom = 0; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; maxspecial = 1; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; // PERI package - vfrac = s0 = NULL; - x0 = NULL; + vfrac = s0 = nullptr; + x0 = nullptr; // SPIN package - sp = fm = fm_long = NULL; + sp = fm = fm_long = nullptr; // USER-EFF and USER-AWPMD packages - spin = NULL; - eradius = ervel = erforce = NULL; - ervelforce = NULL; - cs = csforce = vforce = NULL; - etag = NULL; + spin = nullptr; + eradius = ervel = erforce = nullptr; + ervelforce = nullptr; + cs = csforce = vforce = nullptr; + etag = nullptr; // USER-DPD package - uCond = uMech = uChem = uCG = uCGnew = NULL; - duChem = dpdTheta = NULL; + uCond = uMech = uChem = uCG = uCGnew = nullptr; + duChem = dpdTheta = nullptr; // USER-MESO package - cc = cc_flux = NULL; - edpd_temp = edpd_flux = edpd_cv = NULL; + cc = cc_flux = nullptr; + edpd_temp = edpd_flux = edpd_cv = nullptr; // USER-MESONT package - length = NULL; - buckling = NULL; - bond_nt = NULL; + length = nullptr; + buckling = nullptr; + bond_nt = nullptr; // USER-SMD package - contact_radius = NULL; - smd_data_9 = NULL; - smd_stress = NULL; - eff_plastic_strain = NULL; - eff_plastic_strain_rate = NULL; - damage = NULL; + contact_radius = nullptr; + smd_data_9 = nullptr; + smd_stress = nullptr; + eff_plastic_strain = nullptr; + eff_plastic_strain_rate = nullptr; + damage = nullptr; // USER-SPH package - rho = drho = esph = desph = cv = NULL; - vest = NULL; + rho = drho = esph = desph = cv = nullptr; + vest = nullptr; // end of customization section // -------------------------------------------------------------------- @@ -197,14 +197,14 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // user-defined molecules nmolecule = 0; - molecules = NULL; + molecules = nullptr; // custom atom arrays nivector = ndvector = 0; - ivector = NULL; - dvector = NULL; - iname = dname = NULL; + ivector = nullptr; + dvector = nullptr; + iname = dname = nullptr; // initialize atom style and array existence flags @@ -216,16 +216,16 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // ntype-length arrays - mass = NULL; - mass_setflag = NULL; + mass = nullptr; + mass_setflag = nullptr; // callback lists & extra restart info nextra_grow = nextra_restart = nextra_border = 0; - extra_grow = extra_restart = extra_border = NULL; + extra_grow = extra_restart = extra_border = nullptr; nextra_grow_max = nextra_restart_max = nextra_border_max = 0; nextra_store = 0; - extra = NULL; + extra = nullptr; // default atom ID and mapping values @@ -235,15 +235,15 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) map_maxarray = map_nhash = map_nbucket = -1; max_same = 0; - sametag = NULL; - map_array = NULL; - map_bucket = NULL; - map_hash = NULL; + sametag = nullptr; + map_array = nullptr; + map_bucket = nullptr; + map_hash = nullptr; unique_tags = nullptr; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; avec_map = new AtomVecCreatorMap(); @@ -288,7 +288,7 @@ Atom::~Atom() delete [] iname[i]; memory->destroy(ivector[i]); } - if (dvector != NULL) { + if (dvector != nullptr) { for (int i = 0; i < ndvector; i++) { delete [] dname[i]; memory->destroy(dvector[i]); @@ -352,7 +352,7 @@ void Atom::peratom_create() delete [] peratom[i].name; memory->sfree(peratom); - peratom = NULL; + peratom = nullptr; nperatom = maxperatom = 0; // -------------------------------------------------------------------- @@ -533,7 +533,7 @@ void Atom::add_peratom(const char *name, void *address, peratom[nperatom].datatype = datatype; peratom[nperatom].cols = cols; peratom[nperatom].threadflag = threadflag; - peratom[nperatom].address_length = NULL; + peratom[nperatom].address_length = nullptr; nperatom++; } @@ -629,8 +629,8 @@ void Atom::create_avec(const std::string &style, int narg, char **arg, int trysu { delete [] atom_style; if (avec) delete avec; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; // unset atom style and array existence flags // may have been set by old avec @@ -702,7 +702,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag) } error->all(FLERR,utils::check_packages_for_style("atom",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -723,7 +723,7 @@ void Atom::init() if (nextra_store) { memory->destroy(extra); - extra = NULL; + extra = nullptr; nextra_store = 0; } @@ -756,7 +756,7 @@ void Atom::setup() /* ---------------------------------------------------------------------- return ptr to AtomVec class if matches style or to matching hybrid sub-class - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ AtomVec *Atom::style_match(const char *style) @@ -768,7 +768,7 @@ AtomVec *Atom::style_match(const char *style) if (strcmp(avec_hybrid->keywords[i],style) == 0) return avec_hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -807,7 +807,7 @@ void Atom::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (strcmp(arg[iarg+1],"all") == 0) { delete [] firstgroupname; - firstgroupname = NULL; + firstgroupname = nullptr; } else { int n = strlen(arg[iarg+1]) + 1; firstgroupname = new char[n]; @@ -983,33 +983,33 @@ void Atom::deallocate_topology() { memory->destroy(atom->bond_type); memory->destroy(atom->bond_atom); - atom->bond_type = NULL; - atom->bond_atom = NULL; + atom->bond_type = nullptr; + atom->bond_atom = nullptr; memory->destroy(atom->angle_type); memory->destroy(atom->angle_atom1); memory->destroy(atom->angle_atom2); memory->destroy(atom->angle_atom3); - atom->angle_type = NULL; - atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; + atom->angle_type = nullptr; + atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = nullptr; memory->destroy(atom->dihedral_type); memory->destroy(atom->dihedral_atom1); memory->destroy(atom->dihedral_atom2); memory->destroy(atom->dihedral_atom3); memory->destroy(atom->dihedral_atom4); - atom->dihedral_type = NULL; + atom->dihedral_type = nullptr; atom->dihedral_atom1 = atom->dihedral_atom2 = - atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; + atom->dihedral_atom3 = atom->dihedral_atom4 = nullptr; memory->destroy(atom->improper_type); memory->destroy(atom->improper_atom1); memory->destroy(atom->improper_atom2); memory->destroy(atom->improper_atom3); memory->destroy(atom->improper_atom4); - atom->improper_type = NULL; + atom->improper_type = nullptr; atom->improper_atom1 = atom->improper_atom2 = - atom->improper_atom3 = atom->improper_atom4 = NULL; + atom->improper_atom3 = atom->improper_atom4 = nullptr; } /* ---------------------------------------------------------------------- @@ -1108,11 +1108,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL," \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr," \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); } @@ -1195,7 +1195,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1210,7 +1210,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) /* ---------------------------------------------------------------------- process N bonds read into buf from data files - if count is non-NULL, just count bonds per atom + if count is non-nullptr, just count bonds per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1265,7 +1265,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N angles read into buf from data files - if count is non-NULL, just count angles per atom + if count is non-nullptr, just count angles per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1337,7 +1337,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N dihedrals read into buf from data files - if count is non-NULL, just count diihedrals per atom + if count is non-nullptr, just count diihedrals per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1428,7 +1428,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N impropers read into buf from data files - if count is non-NULL, just count impropers per atom + if count is non-nullptr, just count impropers per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1547,7 +1547,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1577,8 +1577,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) int maxint = 0; int maxdouble = 0; - int *ivalues = NULL; - double *dvalues = NULL; + int *ivalues = nullptr; + double *dvalues = nullptr; if (!unique_tags) unique_tags = new std::set; @@ -1588,7 +1588,7 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) for (int i = 0; i < n; i++) { if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset; - else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset; + else tagdata = ATOTAGINT(strtok(nullptr," \t\n\r\f")) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Bodies section of data file"); @@ -1598,8 +1598,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) else error->one(FLERR,"Duplicate atom ID in Bodies section of data file"); - ninteger = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); - ndouble = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ninteger = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); + ndouble = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); if ((m = map(tagdata)) >= 0) { if (ninteger > maxint) { @@ -1614,16 +1614,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) } for (j = 0; j < ninteger; j++) - ivalues[j] = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ivalues[j] = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); for (j = 0; j < ndouble; j++) - dvalues[j] = utils::numeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + dvalues[j] = utils::numeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues); } else { nvalues = ninteger + ndouble; // number of values to skip for (j = 0; j < nvalues; j++) - strtok(NULL," \t\n\r\f"); + strtok(nullptr," \t\n\r\f"); } } @@ -1680,7 +1680,7 @@ void Atom::allocate_type_arrays() void Atom::set_mass(const char *file, int line, const char *str, int type_offset) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int itype; double mass_one; @@ -1704,7 +1704,7 @@ void Atom::set_mass(const char *file, int line, const char *str, int type_offset void Atom::set_mass(const char *file, int line, int itype, double value) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); if (itype < 1 || itype > ntypes) error->all(file,line,"Invalid type for mass set"); @@ -1721,7 +1721,7 @@ void Atom::set_mass(const char *file, int line, int itype, double value) void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int lo,hi; utils::bounds(file,line,arg[0],1,ntypes,lo,hi,error); @@ -1754,7 +1754,7 @@ void Atom::set_mass(double *values) void Atom::check_mass(const char *file, int line) { - if (mass == NULL) return; + if (mass == nullptr) return; if (rmass_flag) return; for (int itype = 1; itype <= ntypes; itype++) if (mass_setflag[itype] == 0) @@ -1864,7 +1864,7 @@ void Atom::add_molecule(int narg, char **arg) int Atom::find_molecule(char *id) { - if(id == NULL) return -1; + if(id == nullptr) return -1; int imol; for (imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; @@ -2201,14 +2201,14 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find NULL ptr: + // if find nullptr ptr: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find NULL ptr: + // if don't find nullptr ptr: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) - if (modify->fix[ifix] == NULL) break; + if (modify->fix[ifix] == nullptr) break; // add callback to lists and sort, reallocating if necessary // sorting is required in cases where fixes were replaced as it ensures atom @@ -2249,7 +2249,7 @@ void Atom::add_callback(int flag) void Atom::delete_callback(const char *id, int flag) { - if (id == NULL) return; + if (id == nullptr) return; int ifix = modify->find_fix(id); @@ -2310,7 +2310,7 @@ void Atom::update_callback(int ifix) int Atom::find_custom(const char *name, int &flag) { - if(name == NULL) return -1; + if(name == nullptr) return -1; for (int i = 0; i < nivector; i++) if (iname[i] && strcmp(iname[i],name) == 0) { @@ -2374,7 +2374,7 @@ int Atom::add_custom(const char *name, int flag) \verbatim embed:rst This will remove a property that was requested e.g. by the :doc:`fix property/atom ` command. It frees the -allocated memory and sets the pointer to ``NULL`` to the entry in +allocated memory and sets the pointer to ``nullptr`` to the entry in the list can be reused. The lists of those pointers will never be compacted or never shrink, so that index to name mappings remain valid. \endverbatim @@ -2386,14 +2386,14 @@ void Atom::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { memory->destroy(dvector[index]); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } @@ -2483,7 +2483,7 @@ length of the data area, and a short description. * - rmass - double - 1 - - per-atom mass of the particles. ``NULL`` if per-type masses are + - per-atom mass of the particles. ``nullptr`` if per-type masses are used. See the :cpp:func:`rmass_flag` setting. * - ellipsoid - int @@ -2506,7 +2506,7 @@ length of the data area, and a short description. * * \param name string with the keyword of the desired property. Typically the name of the pointer variable returned - * \return pointer to the requested data cast to ``void *`` or NULL */ + * \return pointer to the requested data cast to ``void *`` or nullptr */ void *Atom::extract(char *name) { @@ -2577,7 +2577,7 @@ void *Atom::extract(char *name) // end of customization section // -------------------------------------------------------------------- - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/atom.h b/src/atom.h index 21b9c06f8c..841d224d23 100644 --- a/src/atom.h +++ b/src/atom.h @@ -55,7 +55,7 @@ class Atom : protected Pointers { int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc - char *firstgroupname; // group-ID to store first, NULL if unset + char *firstgroupname; // group-ID to store first, nullptr if unset // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variable diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 02b97a1134..45808d086f 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -323,18 +323,18 @@ int Atom::map_style_set() void Atom::map_delete() { memory->destroy(sametag); - sametag = NULL; + sametag = nullptr; max_same = 0; if (map_style == 1) { memory->destroy(map_array); - map_array = NULL; + map_array = nullptr; } else { if (map_nhash) { delete [] map_bucket; delete [] map_hash; - map_bucket = NULL; - map_hash = NULL; + map_bucket = nullptr; + map_hash = nullptr; } map_nhash = map_nbucket = 0; } diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 4a00e5852b..8dcec3a784 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -2060,7 +2060,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) } /* ---------------------------------------------------------------------- - pack bond info for data file into buf if non-NULL + pack bond info for data file into buf if non-nullptr return count of bonds from this proc do not count/pack bonds with bondtype = 0 if bondtype is negative, flip back to positive @@ -2118,7 +2118,7 @@ void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index) } /* ---------------------------------------------------------------------- - pack angle info for data file into buf if non-NULL + pack angle info for data file into buf if non-nullptr return count of angles from this proc do not count/pack angles with angletype = 0 if angletype is negative, flip back to positive diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index e9044519c9..9f5ec26cce 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -49,9 +49,9 @@ AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp) atom->radius_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; - bptr = NULL; + bptr = nullptr; if (sizeof(double) == sizeof(int)) intdoubleratio = 1; else if (sizeof(double) == 2*sizeof(int)) intdoubleratio = 2; @@ -104,7 +104,7 @@ void AtomVecBody::process_args(int narg, char **arg) if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); - if (0) bptr = NULL; + if (0) bptr = nullptr; #define BODY_CLASS #define BodyStyle(key,Class) \ @@ -582,7 +582,7 @@ void AtomVecBody::pack_data_pre(int ilocal) /* ---------------------------------------------------------------------- pack bonus body info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index c22111f48c..e673ac295a 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -46,7 +46,7 @@ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp) atom->rmass_flag = atom->angmom_flag = atom->torque_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -484,7 +484,7 @@ void AtomVecEllipsoid::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus ellipsoid info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 7a8c73570d..e343bcbdb2 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -30,13 +30,13 @@ enum{ELLIPSOID,LINE,TRIANGLE,BODY}; // also in WriteData AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) { nstyles = 0; - styles = NULL; - keywords = NULL; - fieldstrings = NULL; + styles = nullptr; + keywords = nullptr; + fieldstrings = nullptr; bonus_flag = 0; nstyles_bonus = 0; - styles_bonus = NULL; + styles_bonus = nullptr; // these strings will be concatenated from sub-style strings // fields_data_atom & fields_data_vel start with fields common to all styles @@ -187,7 +187,7 @@ void AtomVecHybrid::process_args(int narg, char **arg) // save concat_grow to check for duplicates of special-case fields char *concat_grow;; - char *null = NULL; + char *null = nullptr; fields_grow = merge_fields(0,fields_grow,1,concat_grow); fields_copy = merge_fields(1,fields_copy,0,null); diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index 88dcb8c2fa..8776c33e51 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -47,7 +47,7 @@ AtomVecLine::AtomVecLine(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -457,7 +457,7 @@ void AtomVecLine::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus line info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index e391a73215..abcd628e51 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -49,7 +49,7 @@ AtomVecTri::AtomVecTri(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -688,7 +688,7 @@ void AtomVecTri::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus tri info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/balance.cpp b/src/balance.cpp index af8d904812..494d43cf8e 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -52,17 +52,17 @@ Balance::Balance(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - user_xsplit = user_ysplit = user_zsplit = NULL; + user_xsplit = user_ysplit = user_zsplit = nullptr; shift_allocate = 0; - proccost = allproccost = NULL; + proccost = allproccost = nullptr; - rcb = NULL; + rcb = nullptr; nimbalance = 0; - imbalances = NULL; - fixstore = NULL; + imbalances = nullptr; + fixstore = nullptr; - fp = NULL; + fp = nullptr; firststep = 1; } @@ -97,7 +97,7 @@ Balance::~Balance() // check nfix in case all fixes have already been deleted if (fixstore && modify->nfix) modify->delete_fix(fixstore->id); - fixstore = NULL; + fixstore = nullptr; if (fp) fclose(fp); } @@ -246,7 +246,7 @@ void Balance::command(int narg, char **arg) // process remaining optional args options(iarg,narg,arg); - if (wtflag) weight_storage(NULL); + if (wtflag) weight_storage(nullptr); // insure particles are in current box & update box via shrink-wrap // init entire system since comm->setup is done @@ -425,7 +425,7 @@ void Balance::options(int iarg, int narg, char **arg) oldrcb = 0; outflag = 0; int outarg = 0; - fp = NULL; + fp = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"weight") == 0) { @@ -473,7 +473,7 @@ void Balance::options(int iarg, int narg, char **arg) if (outflag && comm->me == 0) { fp = fopen(arg[outarg],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open (fix) balance output file {}: {}", arg[outarg], utils::getsyserror())); } @@ -639,12 +639,12 @@ int *Balance::bisection(int sortflag) if (wtflag) { weight = fixstore->vstore; rcb->compute_old(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute_old(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute_old(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } else { if (wtflag) { weight = fixstore->vstore; rcb->compute(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } if (triclinic) domain->lamda2x(nlocal); @@ -1273,7 +1273,7 @@ void Balance::dumpout(bigint tstep) void Balance::debug_shift_output(int idim, int m, int np, double *split) { int i; - const char *dim = NULL; + const char *dim = nullptr; double *boxlo = domain->boxlo; double *prd = domain->prd; diff --git a/src/body.cpp b/src/body.cpp index c0e58d3f4c..9bc0bfc041 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -23,8 +23,8 @@ Body::Body(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) int n = strlen(arg[0]) + 1; style = new char[n]; strcpy(style,arg[0]); - icp = NULL; - dcp = NULL; + icp = nullptr; + dcp = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/bond.cpp b/src/bond.cpp index 1f953bbd19..1ff7017132 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -44,9 +44,9 @@ Bond::Bond(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -276,7 +276,7 @@ void Bond::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -284,7 +284,7 @@ void Bond::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by bond_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open bond_write file {}: {}", arg[4], utils::getsyserror())); } diff --git a/src/bond.h b/src/bond.h index 8d7585b388..5406aa3f02 100644 --- a/src/bond.h +++ b/src/bond.h @@ -52,7 +52,7 @@ class Bond : protected Pointers { virtual void write_data(FILE *) {} virtual double single(int, double, int, int, double &) = 0; virtual double memory_usage(); - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void reinit(); void write_file(int, char**); diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index b42683c300..46eeab5802 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -166,7 +166,7 @@ void BondHybrid::allocate() maxbond = new int[nstyles]; bondlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxbond[m] = 0; - for (int m = 0; m < nstyles; m++) bondlist[m] = NULL; + for (int m = 0; m < nstyles; m++) bondlist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -351,7 +351,7 @@ void BondHybrid::write_restart(FILE *fp) void BondHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Bond*[nstyles]; keywords = new char*[nstyles]; @@ -360,10 +360,10 @@ void BondHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_bond(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index 71146ec4d6..06e5549161 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -126,7 +126,7 @@ void BondZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -157,5 +157,5 @@ void *BondZero::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/citeme.cpp b/src/citeme.cpp index c8745891cf..b638eaf475 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -28,7 +28,7 @@ static const char cite_nagline[] = "\nPlease see the log.cite file " CiteMe::CiteMe(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; cs = new citeset(); } diff --git a/src/comm.cpp b/src/comm.cpp index 7b351e12fc..becb52df91 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -57,15 +57,15 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) mode = 0; bordergroup = 0; cutghostuser = 0.0; - cutusermulti = NULL; + cutusermulti = nullptr; ghost_velocity = 0; user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0; coregrid[0] = coregrid[1] = coregrid[2] = 1; gridflag = ONELEVEL; mapflag = CART; - customfile = NULL; - outfile = NULL; + customfile = nullptr; + outfile = nullptr; recv_from_partition = send_to_partition = -1; otherflag = 0; @@ -73,8 +73,8 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) maxexchange_fix_dynamic = 0; bufextra = BUFEXTRA; - grid2proc = NULL; - xsplit = ysplit = zsplit = NULL; + grid2proc = nullptr; + xsplit = ysplit = zsplit = nullptr; rcbnew = 0; // use of OpenMP threads @@ -88,7 +88,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) #ifdef _OPENMP if (lmp->kokkos) { nthreads = lmp->kokkos->nthreads * lmp->kokkos->numa; - } else if (getenv("OMP_NUM_THREADS") == NULL) { + } else if (getenv("OMP_NUM_THREADS") == nullptr) { nthreads = 1; if (me == 0) error->message(FLERR,"OMP_NUM_THREADS environment is not set. " @@ -276,7 +276,7 @@ void Comm::modify_params(int narg, char **arg) // need to reset cutghostuser when switching comm mode if (mode == Comm::MULTI) cutghostuser = 0.0; memory->destroy(cutusermulti); - cutusermulti = NULL; + cutusermulti = nullptr; mode = Comm::SINGLE; } else if (strcmp(arg[iarg+1],"multi") == 0) { // need to reset cutghostuser when switching comm mode @@ -289,7 +289,7 @@ void Comm::modify_params(int narg, char **arg) bordergroup = group->find(arg[iarg+1]); if (bordergroup < 0) error->all(FLERR,"Invalid group in comm_modify command"); - if (bordergroup && (atom->firstgroupname == NULL || + if (bordergroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR,"Comm_modify group != atom_modify first group"); iarg += 2; @@ -313,7 +313,7 @@ void Comm::modify_params(int narg, char **arg) const int ntypes = atom->ntypes; if (iarg+3 > narg) error->all(FLERR,"Illegal comm_modify command"); - if (cutusermulti == NULL) { + if (cutusermulti == nullptr) { memory->create(cutusermulti,ntypes+1,"comm:cutusermulti"); for (i=0; i < ntypes+1; ++i) cutusermulti[i] = -1.0; @@ -770,7 +770,7 @@ int Comm::binary(double value, int n, double *vec) callback() is invoked to allow caller to process/update each proc's inbuf if self=1 (default), then callback() is invoked on final iteration using original inbuf, which may have been updated - for non-NULL outbuf, final updated inbuf is copied to it + for non-nullptr outbuf, final updated inbuf is copied to it ok to specify outbuf = inbuf the ptr argument is a pointer to the instance of calling class ------------------------------------------------------------------------- */ @@ -792,7 +792,7 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag, // sanity check - if ((nbytes > 0) && inbuf == NULL) + if ((nbytes > 0) && inbuf == nullptr) error->one(FLERR,"Cannot put data on ring from NULL pointer"); char *buf,*bufcopy; @@ -888,7 +888,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, if (inorder) nrvous = irregular->create_data_grouped(n,procs); else nrvous = irregular->create_data(n,procs); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -925,7 +925,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); @@ -967,7 +967,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!inorder) { memory->create(procs_a2a,nprocs,"rendezvous:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr inbuf_a2a = (char *) memory->smalloc((bigint) n*insize+1, "rendezvous:inbuf"); @@ -1032,7 +1032,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, } // all2all comm of inbuf from caller decomp to rendezvous decomp - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -1074,7 +1074,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!outorder) { memory->create(procs_a2a,nprocs,"rendezvous_a2a:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); @@ -1135,7 +1135,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of outbuf from rendezvous decomp back to caller decomp // caller will free outbuf - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,"rendezvous:outbuf"); diff --git a/src/comm.h b/src/comm.h index 1743436e22..7ba79843d1 100644 --- a/src/comm.h +++ b/src/comm.h @@ -118,7 +118,7 @@ class Comm : protected Pointers { int read_lines_from_file_universe(FILE *, int, int, char *); // extract data useful to other classes - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} protected: int bordergroup; // only communicate this group in borders @@ -242,7 +242,7 @@ E: Processor count in z must be 1 for 2d simulation Self-explanatory. -E: Cannot put data on ring from NULL pointer +E: Cannot put data on ring from nullptr pointer W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 37a4f0ae3d..bce069fb3a 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -41,17 +41,17 @@ using namespace LAMMPS_NS; CommBrick::CommBrick(LAMMPS *lmp) : Comm(lmp), - sendnum(NULL), recvnum(NULL), sendproc(NULL), recvproc(NULL), - size_forward_recv(NULL), - size_reverse_send(NULL), size_reverse_recv(NULL), - slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL), - cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL), - sendlist(NULL), localsendlist(NULL), maxsendlist(NULL), - buf_send(NULL), buf_recv(NULL) + sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr), + size_forward_recv(nullptr), + size_reverse_send(nullptr), size_reverse_recv(nullptr), + slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr), + cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), + sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr), + buf_send(nullptr), buf_recv(nullptr) { style = 0; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; + pbc_flag = nullptr; init_buffers(); } @@ -98,10 +98,10 @@ CommBrick::CommBrick(LAMMPS * /*lmp*/, Comm *oldcomm) : Comm(*oldcomm) void CommBrick::init_buffers() { - multilo = multihi = NULL; - cutghostmulti = NULL; + multilo = multihi = nullptr; + cutghostmulti = nullptr; - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); @@ -130,7 +130,7 @@ void CommBrick::init() // memory for multi-style communication - if (mode == Comm::MULTI && multilo == NULL) { + if (mode == Comm::MULTI && multilo == nullptr) { allocate_multi(maxswap); memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti"); } @@ -1463,7 +1463,7 @@ void CommBrick::free_multi() { memory->destroy(multilo); memory->destroy(multihi); - multilo = multihi = NULL; + multilo = multihi = nullptr; } /* ---------------------------------------------------------------------- @@ -1492,7 +1492,7 @@ void *CommBrick::extract(const char *str, int &dim) return (void *) localsendlist; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 48c9680d2f..cb236fd726 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -47,12 +47,12 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp) { style = 1; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; - buf_send = NULL; - buf_recv = NULL; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; + pbc_flag = nullptr; + buf_send = nullptr; + buf_recv = nullptr; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; init_buffers(); } @@ -89,16 +89,16 @@ CommTiled::~CommTiled() void CommTiled::init_buffers() { - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); maxoverlap = 0; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; - sendbox_multi = NULL; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; + sendbox_multi = nullptr; maxswap = 6; allocate_swap(maxswap); @@ -2085,22 +2085,22 @@ void CommTiled::allocate_swap(int n) sendlist = new int**[n]; for (int i = 0; i < n; i++) { - sendproc[i] = recvproc[i] = NULL; - sendnum[i] = recvnum[i] = NULL; - size_forward_recv[i] = firstrecv[i] = NULL; - size_reverse_send[i] = size_reverse_recv[i] = NULL; - forward_recv_offset[i] = reverse_recv_offset[i] = NULL; - - pbc_flag[i] = NULL; - pbc[i] = NULL; - sendbox[i] = NULL; - sendbox_multi[i] = NULL; - maxsendlist[i] = NULL; - sendlist[i] = NULL; + sendproc[i] = recvproc[i] = nullptr; + sendnum[i] = recvnum[i] = nullptr; + size_forward_recv[i] = firstrecv[i] = nullptr; + size_reverse_send[i] = size_reverse_recv[i] = nullptr; + forward_recv_offset[i] = reverse_recv_offset[i] = nullptr; + + pbc_flag[i] = nullptr; + pbc[i] = nullptr; + sendbox[i] = nullptr; + sendbox_multi[i] = nullptr; + maxsendlist[i] = nullptr; + sendlist[i] = nullptr; } maxrequest = 0; - requests = NULL; + requests = nullptr; for (int i = 0; i < n; i++) { nprocmax[i] = DELTA_PROCS; diff --git a/src/compute.cpp b/src/compute.cpp index 4cde9ff567..bd07b0c6d6 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -37,10 +37,10 @@ int Compute::instance_total = 0; Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp), - id(NULL), style(NULL), - vector(NULL), array(NULL), vector_atom(NULL), - array_atom(NULL), vector_local(NULL), array_local(NULL), extlist(NULL), - tlist(NULL), vbiasall(NULL) + id(nullptr), style(nullptr), + vector(nullptr), array(nullptr), vector_atom(nullptr), + array_atom(nullptr), vector_local(nullptr), array_local(nullptr), extlist(nullptr), + tlist(nullptr), vbiasall(nullptr) { instance_me = instance_total++; diff --git a/src/compute_adf.cpp b/src/compute_adf.cpp index 5d55f1fbbb..e0213872d6 100644 --- a/src/compute_adf.cpp +++ b/src/compute_adf.cpp @@ -43,18 +43,18 @@ enum{DEGREE, RADIAN, COSINE}; ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), klo(NULL), khi(NULL), - hist(NULL), histall(NULL), - rcutinnerj(NULL), rcutinnerk(NULL), - rcutouterj(NULL), rcutouterk(NULL), - list(NULL), - iatomcount(NULL), iatomcountall(NULL), iatomflag(NULL), - maxjatom(NULL), maxkatom(NULL), - numjatom(NULL), numkatom(NULL), - neighjatom(NULL),neighkatom(NULL), - jatomflag(NULL), katomflag(NULL), - maxjkatom(NULL), numjkatom(NULL), - neighjkatom(NULL), bothjkatom(NULL), delrjkatom(NULL) + ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), klo(nullptr), khi(nullptr), + hist(nullptr), histall(nullptr), + rcutinnerj(nullptr), rcutinnerk(nullptr), + rcutouterj(nullptr), rcutouterk(nullptr), + list(nullptr), + iatomcount(nullptr), iatomcountall(nullptr), iatomflag(nullptr), + maxjatom(nullptr), maxkatom(nullptr), + numjatom(nullptr), numkatom(nullptr), + neighjatom(nullptr),neighkatom(nullptr), + jatomflag(nullptr), katomflag(nullptr), + maxjkatom(nullptr), numjkatom(nullptr), + neighjkatom(nullptr), bothjkatom(nullptr), delrjkatom(nullptr) { int nargsperadf = 7; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 6b6f376b4c..97f8c6ff9e 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - aggregateID(NULL) + aggregateID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute aggregate/atom command"); @@ -71,10 +71,10 @@ void ComputeAggregateAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute aggregate/atom unless atoms have IDs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Compute aggregate/atom requires a bond style to be defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_angle.cpp b/src/compute_angle.cpp index e3e44efbbb..83daeedb9a 100644 --- a/src/compute_angle.cpp +++ b/src/compute_angle.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute angle command"); diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index b100824ea9..8f9f728cf8 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -38,7 +38,7 @@ enum{THETA,ENG,VARIABLE}; ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), tstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), tstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute angle/local command"); @@ -77,7 +77,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - tstr = NULL; + tstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -123,8 +123,8 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -146,7 +146,7 @@ ComputeAngleLocal::~ComputeAngleLocal() void ComputeAngleLocal::init() { - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"No angle style is defined for compute angle/local"); if (nvar) { diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 6c9f1d65a2..eb22dcee5d 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), angmom(NULL), angmomall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), angmom(nullptr), angmomall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute angmom/chunk command"); diff --git a/src/compute_bond.cpp b/src/compute_bond.cpp index 503582bc65..f7c4206857 100644 --- a/src/compute_bond.cpp +++ b/src/compute_bond.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute bond command"); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 010e8db627..c201a9886d 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -39,7 +39,7 @@ enum{DIST,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE}; ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), dstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), dstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute bond/local command"); @@ -84,7 +84,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - dstr = NULL; + dstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -142,8 +142,8 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeBondLocal::~ComputeBondLocal() void ComputeBondLocal::init() { - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"No bond style is defined for compute bond/local"); if (nvar) { diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index f88dea9ebe..af32a8e9a3 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), centro(NULL) + distsq(nullptr), nearest(nullptr), centro(nullptr) { if (narg < 4 || narg > 6) error->all(FLERR,"Illegal compute centro/atom command"); @@ -88,7 +88,7 @@ ComputeCentroAtom::~ComputeCentroAtom() void ComputeCentroAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute centro/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 7c979c66d7..499d903451 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute centroid/stress/atom command"); @@ -49,7 +49,7 @@ ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -237,7 +237,7 @@ void ComputeCentroidStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index d0044410d8..7fe9394b43 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -54,10 +54,10 @@ enum{LIMITMAX,LIMITEXACT}; ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - chunk_volume_vec(NULL), coord(NULL), ichunk(NULL), chunkID(NULL), - cfvid(NULL), idregion(NULL), region(NULL), cchunk(NULL), fchunk(NULL), - varatom(NULL), id_fix(NULL), fixstore(NULL), lockfix(NULL), chunk(NULL), - exclude(NULL), hash(NULL) + chunk_volume_vec(nullptr), coord(nullptr), ichunk(nullptr), chunkID(nullptr), + cfvid(nullptr), idregion(nullptr), region(nullptr), cchunk(nullptr), fchunk(nullptr), + varatom(nullptr), id_fix(nullptr), fixstore(nullptr), lockfix(nullptr), chunk(nullptr), + exclude(nullptr), hash(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute chunk/atom command"); @@ -73,7 +73,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : binflag = 0; ncoord = 0; - cfvid = NULL; + cfvid = nullptr; if (strcmp(arg[3],"bin/1d") == 0) { binflag = 1; @@ -177,7 +177,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // optional args regionflag = 0; - idregion = NULL; + idregion = nullptr; nchunksetflag = 0; nchunkflag = EVERY; limit = 0; @@ -448,16 +448,16 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // initialize chunk vector and per-chunk info nmax = 0; - chunk = NULL; + chunk = nullptr; nmaxint = -1; - ichunk = NULL; - exclude = NULL; + ichunk = nullptr; + exclude = nullptr; nchunk = 0; chunk_volume_scalar = 1.0; - chunk_volume_vec = NULL; - coord = NULL; - chunkID = NULL; + chunk_volume_vec = nullptr; + coord = nullptr; + chunkID = nullptr; // computeflag = 1 if this compute might invoke another compute // during assign_chunk_ids() @@ -470,17 +470,17 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : invoked_setup = -1; invoked_ichunk = -1; - id_fix = NULL; - fixstore = NULL; + id_fix = nullptr; + fixstore = nullptr; if (compress) hash = new std::map(); - else hash = NULL; + else hash = nullptr; maxvar = 0; - varatom = NULL; + varatom = nullptr; lockcount = 0; - lockfix = NULL; + lockfix = nullptr; if (which == MOLECULE) molcheck = 1; else molcheck = 0; @@ -593,7 +593,7 @@ void ComputeChunkAtom::init() if ((idsflag != ONCE && !lockcount) && fixstore) { modify->delete_fix(id_fix); - fixstore = NULL; + fixstore = nullptr; } } @@ -665,7 +665,7 @@ double ComputeChunkAtom::compute_scalar() void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) { - if (lockfix == NULL) { + if (lockfix == nullptr) { lockfix = fixptr; lockstart = startstep; lockstop = stopstep; @@ -689,7 +689,7 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) void ComputeChunkAtom::unlock(Fix *fixptr) { if (fixptr != lockfix) return; - lockfix = NULL; + lockfix = nullptr; } /* ---------------------------------------------------------------------- @@ -1049,7 +1049,7 @@ void ComputeChunkAtom::compress_chunk_ids() // create my list of populated IDs - int *list = NULL; + int *list = nullptr; memory->create(list,n,"chunk/atom:list"); n = 0; @@ -1094,7 +1094,7 @@ void ComputeChunkAtom::compress_chunk_ids() memory->destroy(listall); } else { - comm->ring(n,sizeof(int),list,1,idring,NULL,(void *)this,0); + comm->ring(n,sizeof(int),list,1,idring,nullptr,(void *)this,0); } memory->destroy(list); diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 98a3ea9a2b..14c86383b7 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -96,7 +96,7 @@ class ComputeChunkAtom : public Compute { class FixStore *fixstore; class Fix *lockfix; // ptr to FixAveChunk that is locking out setups - // NULL if no lock currently in place + // nullptr if no lock currently in place bigint lockstart,lockstop; // timesteps for start and stop of locking bigint invoked_setup; // last timestep setup_chunks and nchunk calculated diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 953ae3a8cb..b3b57d75d3 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -37,7 +37,7 @@ enum{COMPUTE,FIX}; ComputeChunkSpreadAtom:: ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), ids(NULL), which(NULL), argindex(NULL), value2index(NULL) + idchunk(nullptr), ids(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute chunk/spread/atom command"); @@ -68,7 +68,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0) { @@ -161,8 +161,8 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom vector or array nmax = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 8086ef3f41..fa31e738bc 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -37,7 +37,7 @@ enum{CLUSTER,MASK,COORDS}; ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - clusterID(NULL) + clusterID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cluster/atom command"); @@ -64,7 +64,7 @@ void ComputeClusterAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute cluster/atom unless atoms have IDs"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index e9b6f16990..9a7a9b5d15 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -44,7 +44,7 @@ enum{NCOMMON,NBOND,MAXBOND,MINBOND}; ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), pattern(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), pattern(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cna/atom command"); @@ -71,7 +71,7 @@ ComputeCNAAtom::~ComputeCNAAtom() void ComputeCNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cna/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR,"Compute cna/atom cutoff is longer than pairwise cutoff"); diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index 8398311a05..39ea6cfa82 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -31,7 +31,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeCOMChunk::ComputeCOMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), masstotal(NULL), massproc(NULL), com(NULL), comall(NULL) + idchunk(nullptr), masstotal(nullptr), massproc(nullptr), com(nullptr), comall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute com/chunk command"); diff --git a/src/compute_contact_atom.cpp b/src/compute_contact_atom.cpp index 7a288afb43..11f0c14893 100644 --- a/src/compute_contact_atom.cpp +++ b/src/compute_contact_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeContactAtom::ComputeContactAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - contact(NULL) + contact(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute contact/atom command"); @@ -57,7 +57,7 @@ ComputeContactAtom::~ComputeContactAtom() void ComputeContactAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute contact/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index cb919d3a83..05d299fa26 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -38,8 +38,8 @@ using namespace LAMMPS_NS; ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - typelo(NULL), typehi(NULL), cvec(NULL), carray(NULL), - group2(NULL), id_orientorder(NULL), normv(NULL) + typelo(nullptr), typehi(nullptr), cvec(nullptr), carray(nullptr), + group2(nullptr), id_orientorder(nullptr), normv(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute coord/atom command"); @@ -147,7 +147,7 @@ void ComputeCoordAtom::init() "option in compute orientorder/atom"); } - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute coord/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index 8853887f18..64d9c8b37e 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dihedral command"); diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index ac2c884c3f..d1ff051940 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -38,7 +38,7 @@ enum{PHI,VARIABLE}; ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), pstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), pstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute dihedral/local command"); @@ -74,7 +74,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - pstr = NULL; + pstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -122,8 +122,8 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -145,7 +145,7 @@ ComputeDihedralLocal::~ComputeDihedralLocal() void ComputeDihedralLocal::init() { - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"No dihedral style is defined for compute dihedral/local"); if (nvar) { diff --git a/src/compute_dipole_chunk.cpp b/src/compute_dipole_chunk.cpp index 361ee36c18..f387786b83 100644 --- a/src/compute_dipole_chunk.cpp +++ b/src/compute_dipole_chunk.cpp @@ -34,9 +34,9 @@ enum { MASSCENTER, GEOMCENTER }; ComputeDipoleChunk::ComputeDipoleChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), chrgproc(NULL), - chrgtotal(NULL), com(NULL), - comall(NULL), dipole(NULL), dipoleall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), chrgproc(nullptr), + chrgtotal(nullptr), com(nullptr), + comall(nullptr), dipole(nullptr), dipoleall(nullptr) { if ((narg != 4) && (narg != 5)) error->all(FLERR,"Illegal compute dipole/chunk command"); diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index 4b194cfab1..bd939f1402 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - displace(NULL), id_fix(NULL) + displace(nullptr), id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute displace/atom command"); @@ -44,7 +44,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // optional args refreshflag = 0; - rvar = NULL; + rvar = nullptr; int iarg = 3; while (iarg < narg) { @@ -102,7 +102,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom displacement array nmax = nvmax = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 78664a912f..d3f0d723c6 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeErotateSphereAtom:: ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - erot(NULL) + erot(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute erotate/sphere//atom command"); diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index db003c93e7..85497bce02 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - fragmentID(NULL) + fragmentID(nullptr) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Compute fragment/atom used when bonds are not allowed"); @@ -61,9 +61,9 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - stack = NULL; - clist = NULL; - markflag = NULL; + stack = nullptr; + clist = nullptr; + markflag = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_global_atom.cpp b/src/compute_global_atom.cpp index b3e4f88bf3..03d9ba4ecb 100644 --- a/src/compute_global_atom.cpp +++ b/src/compute_global_atom.cpp @@ -39,8 +39,8 @@ enum{VECTOR,ARRAY}; ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idref(NULL), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - indices(NULL), varatom(NULL), vecglobal(NULL) + idref(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + indices(nullptr), varatom(nullptr), vecglobal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute global/atom command"); @@ -96,7 +96,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || strncmp(arg[iarg],"v_",2) == 0) { @@ -234,8 +234,8 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : else size_peratom_cols = nvalues; nmax = maxvector = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index ca0483fce9..90956c6b15 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -45,7 +45,7 @@ enum{OFF,INTER,INTRA}; ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute group/group command"); @@ -122,15 +122,15 @@ void ComputeGroupGroup::init() // if non-hybrid, then error if single_enable = 0 // if hybrid, let hybrid determine if sub-style sets single_enable = 0 - if (pairflag && force->pair == NULL) + if (pairflag && force->pair == nullptr) error->all(FLERR,"No pair style defined for compute group/group"); - if (force->pair_match("^hybrid",0) == NULL + if (force->pair_match("^hybrid",0) == nullptr && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute group/group"); // error if Kspace style does not compute group/group interactions - if (kspaceflag && force->kspace == NULL) + if (kspaceflag && force->kspace == nullptr) error->all(FLERR,"No Kspace style defined for compute group/group"); if (kspaceflag && force->kspace->group_group_enable == 0) error->all(FLERR,"Kspace style does not support compute group/group"); @@ -138,10 +138,10 @@ void ComputeGroupGroup::init() if (pairflag) { pair = force->pair; cutsq = force->pair->cutsq; - } else pair = NULL; + } else pair = nullptr; if (kspaceflag) kspace = force->kspace; - else kspace = NULL; + else kspace = nullptr; // compute Kspace correction terms diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index ad0520bc01..f7e7c8ced9 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -29,8 +29,8 @@ using namespace LAMMPS_NS; ComputeGyrationChunk::ComputeGyrationChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - rg(NULL), rgall(NULL), rgt(NULL), rgtall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + rg(nullptr), rgall(nullptr), rgt(nullptr), rgtall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute gyration/chunk command"); diff --git a/src/compute_heat_flux.cpp b/src/compute_heat_flux.cpp index 15a17949eb..bcb10c833a 100644 --- a/src/compute_heat_flux.cpp +++ b/src/compute_heat_flux.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeHeatFlux::ComputeHeatFlux(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_ke(NULL), id_pe(NULL), id_stress(NULL) + id_ke(nullptr), id_pe(nullptr), id_stress(nullptr) { if (narg != 6) error->all(FLERR,"Illegal compute heat/flux command"); diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index 00f81dc845..736a7e64c6 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -45,7 +45,7 @@ using namespace MathConst; ComputeHexOrderAtom::ComputeHexOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), qnarray(NULL) + distsq(nullptr), nearest(nullptr), qnarray(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute hexorder/atom command"); @@ -104,7 +104,7 @@ ComputeHexOrderAtom::~ComputeHexOrderAtom() void ComputeHexOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute hexorder/atom requires a pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; else if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 3721dbfd48..aa65bde661 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute improper command"); diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index e363749b67..4d230cd1ec 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -35,7 +35,7 @@ using namespace MathConst; ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL) + vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute improper/local command"); @@ -57,8 +57,8 @@ ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -73,7 +73,7 @@ ComputeImproperLocal::~ComputeImproperLocal() void ComputeImproperLocal::init() { - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"No improper style is defined for compute improper/local"); // do initial memory allocation so that memory_usage() is correct @@ -135,7 +135,7 @@ int ComputeImproperLocal::compute_impropers(int flag) if (cflag >= 0) cbuf = vlocal; } else { if (cflag >= 0 && alocal) cbuf = &alocal[0][cflag]; - else cbuf = NULL; + else cbuf = nullptr; } } diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index 65de1d7bb5..ba7c4f36fc 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - inertia(NULL), inertiaall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + inertia(nullptr), inertiaall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute inertia/chunk command"); diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index 102d6364ff..65b3140d79 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputeKEAtom::ComputeKEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ke(NULL) + ke(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute ke/atom command"); diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index d23c389ab6..41ffa95fef 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute msd command"); diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index b0e2520f99..2c3c2811d2 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), id_fix(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), msd(NULL) + idchunk(nullptr), id_fix(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute msd/chunk command"); diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 4151b2cdb8..40f13f7483 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL),massproc(NULL),masstotal(NULL),com(NULL),comall(NULL), - inertia(NULL),inertiaall(NULL),angmom(NULL),angmomall(NULL),omega(NULL) + idchunk(nullptr),massproc(nullptr),masstotal(nullptr),com(nullptr),comall(nullptr), + inertia(nullptr),inertiaall(nullptr),angmom(nullptr),angmomall(nullptr),omega(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute omega/chunk command"); diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 7323b6ef01..e76081e0b8 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -49,8 +49,8 @@ using namespace MathConst; ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - qlist(NULL), distsq(NULL), nearest(NULL), rlist(NULL), - qnarray(NULL), qnm_r(NULL), qnm_i(NULL), cglist(NULL) + qlist(nullptr), distsq(nullptr), nearest(nullptr), rlist(nullptr), + qnarray(nullptr), qnm_r(nullptr), qnm_i(nullptr), cglist(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute orientorder/atom command"); @@ -186,7 +186,7 @@ ComputeOrientOrderAtom::~ComputeOrientOrderAtom() void ComputeOrientOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute orientorder/atom requires a " "pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index 7ace5615a7..15b5bec19a 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -28,7 +28,7 @@ enum{EPAIR,EVDWL,ECOUL}; ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pair(NULL), one(NULL) + pstyle(nullptr), pair(nullptr), one(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair command"); @@ -82,7 +82,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : extvector = 1; one = new double[npair]; vector = new double[npair]; - } else one = vector = NULL; + } else one = vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index e41221f70b..a8fa247e4d 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -37,7 +37,7 @@ enum{TYPE,RADIUS}; ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pindex(NULL), vlocal(NULL), alocal(NULL) + pstyle(nullptr), pindex(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair/local command"); @@ -97,8 +97,8 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,7 +115,7 @@ ComputePairLocal::~ComputePairLocal() void ComputePairLocal::init() { - if (singleflag && force->pair == NULL) + if (singleflag && force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pair/local"); if (singleflag && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pair/local"); diff --git a/src/compute_pe_atom.cpp b/src/compute_pe_atom.cpp index 6bdd729502..374a3151ce 100644 --- a/src/compute_pe_atom.cpp +++ b/src/compute_pe_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - energy(NULL) + energy(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute pe/atom command"); diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index 90e4f9b39c..ae1bb4747d 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure command"); if (igroup) error->all(FLERR,"Compute pressure must use group all"); @@ -51,7 +51,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -130,13 +130,13 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void ComputePressure::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairhybridflag && force->pair) nvirial++; if (pairflag && force->pair) nvirial++; @@ -221,7 +221,7 @@ void ComputePressure::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 9c637edc1e..e23458d201 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - index(NULL), pack_choice(NULL) + index(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/atom command"); @@ -441,7 +441,7 @@ void ComputePropertyAtom::compute_peratom() (this->*pack_choice[0])(0); } else { if (nmax) buf = &array_atom[0][0]; - else buf = NULL; + else buf = nullptr; for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n); } diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index c27cfc4096..ad21e80296 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputePropertyChunk::ComputePropertyChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), count_one(NULL), count_all(NULL) + idchunk(nullptr), count_one(nullptr), count_all(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute property/chunk command"); diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 651e1190b1..8478535e9e 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -35,7 +35,7 @@ enum{TYPE,RADIUS}; ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL), indices(NULL), pack_choice(NULL) + vlocal(nullptr), alocal(nullptr), indices(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/local command"); @@ -254,8 +254,8 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/local requires atom attribute radius"); nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -273,7 +273,7 @@ ComputePropertyLocal::~ComputePropertyLocal() void ComputePropertyLocal::init() { if (kindflag == NEIGH || kindflag == PAIR) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute property/local"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute property/local"); diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index a28223b3a7..f4d553d2db 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -41,9 +41,9 @@ using namespace MathConst; ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rdfpair(NULL), nrdfpair(NULL), ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), - hist(NULL), histall(NULL), typecount(NULL), icount(NULL), jcount(NULL), - duplicates(NULL) + rdfpair(nullptr), nrdfpair(nullptr), ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), + hist(nullptr), histall(nullptr), typecount(nullptr), icount(nullptr), jcount(nullptr), + duplicates(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rdf command"); diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index b024b4365c..66af301e48 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -44,14 +44,14 @@ enum{PERATOM,LOCAL}; ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), flavor(NULL), - value2index(NULL), ids(NULL), onevec(NULL), replace(NULL), indices(NULL), - owner(NULL), idregion(NULL), varatom(NULL) + nvalues(0), which(nullptr), argindex(nullptr), flavor(nullptr), + value2index(nullptr), ids(nullptr), onevec(nullptr), replace(nullptr), indices(nullptr), + owner(nullptr), idregion(nullptr), varatom(nullptr) { int iarg = 0; if (strcmp(style,"reduce") == 0) { if (narg < 5) error->all(FLERR,"Illegal compute reduce command"); - idregion = NULL; + idregion = nullptr; iarg = 3; } else if (strcmp(style,"reduce/region") == 0) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/region command"); @@ -93,13 +93,13 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = flavor[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"x") == 0) { which[nvalues] = X; @@ -190,7 +190,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : if (replace[i] >= 0) flag = 1; if (!flag) { delete [] replace; - replace = NULL; + replace = nullptr; } // if wildcard expansion occurred, free earg memory from expand_args() @@ -285,8 +285,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; if (mode == SUM || mode == SUMSQ) extscalar = 1; else extscalar = 0; - vector = onevec = NULL; - indices = owner = NULL; + vector = onevec = nullptr; + indices = owner = nullptr; } else { vector_flag = 1; size_vector = nvalues; @@ -299,7 +299,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : } maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 6e8aa48410..fbcf82619f 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -40,8 +40,8 @@ enum{UNKNOWN=-1,COMPUTE,FIX,VARIABLE}; ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), argindex(NULL), value2index(NULL), idchunk(NULL), ids(NULL), - vlocal(NULL), vglobal(NULL), alocal(NULL), aglobal(NULL), varatom(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), idchunk(nullptr), ids(nullptr), + vlocal(nullptr), vglobal(nullptr), alocal(nullptr), aglobal(nullptr), varatom(nullptr) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/chunk command"); @@ -78,13 +78,13 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || @@ -193,11 +193,11 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : else if (mode == MAXX) initvalue = -BIG; maxchunk = 0; - vlocal = vglobal = NULL; - alocal = aglobal = NULL; + vlocal = vglobal = nullptr; + alocal = aglobal = nullptr; maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index ca4b735d6e..036a9bb289 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute slice command"); diff --git a/src/compute_stress_atom.cpp b/src/compute_stress_atom.cpp index 9c65ee86c2..279d2af07c 100644 --- a/src/compute_stress_atom.cpp +++ b/src/compute_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute stress/atom command"); @@ -49,7 +49,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -213,7 +213,7 @@ void ComputeStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 54f0529006..f3110cfeca 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -31,8 +31,8 @@ enum{TEMP,KECOM,INTERNAL}; ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), idchunk(NULL), id_bias(NULL), sum(NULL), sumall(NULL), count(NULL), - countall(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + which(nullptr), idchunk(nullptr), id_bias(nullptr), sum(nullptr), sumall(nullptr), count(nullptr), + countall(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute temp/chunk command"); @@ -71,7 +71,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : comflag = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index b50962a2c6..75b784c858 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -47,7 +47,7 @@ ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index 85e51d2a5d..5ce62dfeb2 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -47,7 +47,7 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute temp/partial cannot use vz for 2d systemx"); maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index eacca87e19..0344880e13 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -30,7 +30,7 @@ enum{TENSOR,BIN}; ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bin(NULL), vbin(NULL), binave(NULL), tbin(NULL), tbinall(NULL) + bin(nullptr), vbin(nullptr), binave(nullptr), tbin(nullptr), tbinall(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute temp/profile command"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 3874c1f286..17509b85a0 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -98,7 +98,7 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : } maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 74955da421..8a8d671dfd 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute temp/region command"); @@ -48,7 +48,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 6ef3038d68..42dc790a3a 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -32,7 +32,7 @@ enum{ROTATE,ALL}; ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL) + id_bias(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/sphere command"); diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index c0b648418b..df25591450 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), torque(NULL), torqueall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), torque(nullptr), torqueall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute torque/chunk command"); diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index 635c3e4161..a34c4bac8e 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute vacf command"); diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index 6651110e77..7edab91d54 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -29,7 +29,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute vcm/chunk command"); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 7e84e9cce0..d7f862de93 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -130,7 +130,7 @@ void CreateAtoms::command(int narg, char **arg) mode = ATOM; int molseed; varflag = 0; - vstr = xstr = ystr = zstr = NULL; + vstr = xstr = ystr = zstr = nullptr; quatone[0] = quatone[1] = quatone[2] = 0.0; subsetflag = NONE; int subsetseed; @@ -245,7 +245,7 @@ void CreateAtoms::command(int narg, char **arg) // error check and further setup for mode = MOLECULE - ranmol = NULL; + ranmol = nullptr; if (mode == MOLECULE) { if (onemol->xflag == 0) error->all(FLERR,"Create_atoms molecule must have coordinates"); @@ -267,7 +267,7 @@ void CreateAtoms::command(int narg, char **arg) ranmol = new RanMars(lmp,molseed+me); } - ranlatt = NULL; + ranlatt = nullptr; if (subsetflag != NONE) ranlatt = new RanMars(lmp,subsetseed+me); // error check and further setup for variable test diff --git a/src/create_atoms.h b/src/create_atoms.h index 87d15d00bd..5508752f00 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -62,7 +62,7 @@ class CreateAtoms : protected Pointers { void add_random(); void add_lattice(); void loop_lattice(int); - void add_molecule(double *, double * = NULL); + void add_molecule(double *, double * = nullptr); int vartest(double *); // evaluate a variable with new atom position }; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 9e3eb65801..7bface4d02 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -197,14 +197,14 @@ void CreateBonds::many() // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Create_bonds requires a pair style be defined"); if (rmax > neighbor->cutneighmax) error->all(FLERR,"Create_bonds max distance > neighbor cutoff"); if (rmax > neighbor->cutneighmin && comm->me == 0) error->warning(FLERR,"Create_bonds max distance > minimum neighbor cutoff"); - // require special_bonds 1-2 weights = 0.0 and KSpace = NULL + // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr // so that already bonded atom pairs do not appear in neighbor list // otherwise with newton_bond = 1, // would be hard to check if I-J bond already existed diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 8baee645cf..9f73a64f75 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -299,7 +299,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Delete_atoms requires a pair style be defined"); if (cut > neighbor->cutneighmax) error->all(FLERR,"Delete_atoms cutoff > max neighbor cutoff"); @@ -476,7 +476,7 @@ void DeleteAtoms::delete_bond() for (int i = 0; i < nlocal; i++) if (dlist[i]) list[n++] = tag[i]; - comm->ring(n,sizeof(tagint),list,1,bondring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,bondring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -514,7 +514,7 @@ void DeleteAtoms::delete_molecule() std::map::iterator pos; for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index b8ec5f7883..4b68a461f1 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -75,7 +75,7 @@ void DeleteBonds::command(int narg, char **arg) // use utils::bounds(FLERR,) to allow setting of range of types // range can be 0 to ntypes inclusive - int *tlist = NULL; + int *tlist = nullptr; int iarg = 2; if (style != MULTI && style != STATS) { diff --git a/src/dihedral.cpp b/src/dihedral.cpp index ac2d432cfb..f75b89139f 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -36,10 +36,10 @@ Dihedral::Dihedral(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 61e0fdc72a..83feb2f841 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -161,7 +161,7 @@ void DihedralHybrid::allocate() maxdihedral = new int[nstyles]; dihedrallist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxdihedral[m] = 0; - for (int m = 0; m < nstyles; m++) dihedrallist[m] = NULL; + for (int m = 0; m < nstyles; m++) dihedrallist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void DihedralHybrid::write_restart(FILE *fp) void DihedralHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Dihedral*[nstyles]; keywords = new char*[nstyles]; @@ -338,10 +338,10 @@ void DihedralHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_dihedral(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 018288d470..4f84956991 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -44,7 +44,7 @@ enum{MOVE,RAMP,RANDOM,ROTATE}; DisplaceAtoms::DisplaceAtoms(LAMMPS *lmp) : Pointers(lmp) { - mvec = NULL; + mvec = nullptr; } /* ---------------------------------------------------------------------- */ @@ -313,7 +313,7 @@ void DisplaceAtoms::command(int narg, char **arg) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -384,7 +384,7 @@ void DisplaceAtoms::move(int idim, char *arg, double scale) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += delta; } else if (input->variable->atomstyle(ivar)) { - if (mvec == NULL) memory->create(mvec,nlocal,"displace_atoms:mvec"); + if (mvec == nullptr) memory->create(mvec,nlocal,"displace_atoms:mvec"); input->variable->compute_atom(ivar,igroup,mvec,1,0); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += scale*mvec[i]; diff --git a/src/domain.cpp b/src/domain.cpp index 984c735a20..086f0228b1 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -89,7 +89,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxlo_lamda[0] = boxlo_lamda[1] = boxlo_lamda[2] = 0.0; boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; - lattice = NULL; + lattice = nullptr; char **args = new char*[2]; args[0] = (char *) "none"; args[1] = (char *) "1.0"; @@ -97,7 +97,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) delete [] args; nregion = maxregion = 0; - regions = NULL; + regions = nullptr; copymode = 0; @@ -1640,7 +1640,7 @@ void Domain::image_flip(int m, int n, int p) return 1 if this proc owns atom with coords x, else return 0 x is returned remapped into periodic box if image flag is passed, flag is updated via remap(x,image) - if image = NULL is passed, no update with remap(x) + if image = nullptr is passed, no update with remap(x) if shrinkexceed, atom can be outside shrinkwrap boundaries called from create_atoms() in library.cpp ------------------------------------------------------------------------- */ @@ -1727,7 +1727,7 @@ int Domain::ownatom(int /*id*/, double *x, imageint *image, int shrinkexceed) void Domain::set_lattice(int narg, char **arg) { if (lattice) delete lattice; - lattice = NULL; + lattice = nullptr; lattice = new Lattice(lmp,narg,arg); } diff --git a/src/dump.cpp b/src/dump.cpp index febc3d0821..3f1e997d13 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -66,17 +66,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = NULL; - format_default = NULL; + format = nullptr; + format_default = nullptr; - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_column_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_column_user = nullptr; refreshflag = 0; - refresh = NULL; + refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -93,20 +93,20 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = NULL; + nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + buf = bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; maxsbuf = 0; - sbuf = NULL; + sbuf = nullptr; maxpbc = 0; - xpbc = vpbc = NULL; - imagepbc = NULL; + xpbc = vpbc = nullptr; + imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -117,7 +117,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .zst = Zstd compressed text file // else ASCII text file - fp = NULL; + fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; @@ -128,7 +128,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = NULL; + multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { @@ -202,15 +202,15 @@ Dump::~Dump() delete[] nameslist; } - // XTC style sets fp to NULL since it closes file in its destructor + // XTC style sets fp to nullptr since it closes file in its destructor - if (multifile == 0 && fp != NULL) { + if (multifile == 0 && fp != nullptr) { if (compressed) { if (filewriter) pclose(fp); } else { if (filewriter) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -229,10 +229,10 @@ void Dump::init() delete irregular; maxids = maxsort = maxproc = 0; - bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; } if (sort_flag) { @@ -243,7 +243,7 @@ void Dump::init() error->all(FLERR,"Cannot dump sort on atom IDs with no atom IDs defined"); if (sortcol && sortcol > size_one) error->all(FLERR,"Dump sort column is invalid"); - if (nprocs > 1 && irregular == NULL) + if (nprocs > 1 && irregular == nullptr) irregular = new Irregular(lmp); bigint size = group->count(igroup); @@ -438,7 +438,7 @@ void Dump::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // if buffering, convert doubles into strings @@ -528,11 +528,11 @@ void Dump::write() if (multifile) { if (compressed) { - if (filewriter && fp != NULL) pclose(fp); + if (filewriter && fp != nullptr) pclose(fp); } else { - if (filewriter && fp != NULL) fclose(fp); + if (filewriter && fp != nullptr) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -609,8 +609,8 @@ void Dump::openfile() fp = fopen(filecurrent,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); - } else fp = NULL; + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else fp = nullptr; // delete string with timestep replaced @@ -1013,10 +1013,10 @@ void Dump::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; // pass format none to child classes which may use it // not an error if they don't modify_param(narg-iarg,&arg[iarg]); @@ -1055,7 +1055,7 @@ void Dump::modify_params(int narg, char **arg) nameslist = new char*[maxfiles]; numfiles = 0; for (int idx=0; idx < maxfiles; ++idx) - nameslist[idx] = NULL; + nameslist[idx] = nullptr; fileidx = 0; } iarg += 2; diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index a68e950597..f8d02904fa 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -34,7 +34,7 @@ DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) image_flag = 0; buffer_allow = 1; buffer_flag = 1; - format_default = NULL; + format_default = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index da9740d9ca..ffff1e85c7 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), auxname(NULL) + DumpCustom(lmp, narg, arg), auxname(nullptr) { multifile_override = 0; @@ -63,7 +63,7 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : // convert 'X_ID[m]' (X=c,f,v) to 'X_ID_m' if (nfield > 5) auxname = new char*[nfield]; - else auxname = NULL; + else auxname = nullptr; int i = 0; for (int iarg = 5; iarg < nfield; iarg++, i++) { diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 167d88789c..1439e68cef 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -53,13 +53,13 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - idregion(NULL), thresh_array(NULL), thresh_op(NULL), thresh_value(NULL), - thresh_last(NULL), thresh_fix(NULL), thresh_fixID(NULL), thresh_first(NULL), - earg(NULL), vtype(NULL), vformat(NULL), columns(NULL), choose(NULL), - dchoose(NULL), clist(NULL), field2index(NULL), argindex(NULL), id_compute(NULL), - compute(NULL), id_fix(NULL), fix(NULL), id_variable(NULL), variable(NULL), - vbuf(NULL), id_custom(NULL), flag_custom(NULL), typenames(NULL), - pack_choice(NULL) + idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr), + thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr), + earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), choose(nullptr), + dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr), id_compute(nullptr), + compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr), variable(nullptr), + vbuf(nullptr), id_custom(nullptr), flag_custom(nullptr), typenames(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); @@ -87,37 +87,37 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : buffer_allow = 1; buffer_flag = 1; iregion = -1; - idregion = NULL; + idregion = nullptr; nthresh = 0; - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; nthreshlast = 0; - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; // computes, fixes, variables which the dump accesses ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; nvariable = 0; - id_variable = NULL; - variable = NULL; - vbuf = NULL; + id_variable = nullptr; + variable = nullptr; + vbuf = nullptr; ncustom = 0; - id_custom = NULL; - flag_custom = NULL; + id_custom = nullptr; + flag_custom = nullptr; // process attributes // ioptional = start of additional optional args in expanded args @@ -142,9 +142,9 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : // atom selection arrays maxlocal = 0; - choose = NULL; - dchoose = NULL; - clist = NULL; + choose = nullptr; + dchoose = nullptr; + clist = nullptr; // default element name for all types = C @@ -167,11 +167,11 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::DOUBLE) strcat(format_default,"%g "); else if (vtype[i] == Dump::STRING) strcat(format_default,"%s "); else if (vtype[i] == Dump::BIGINT) strcat(format_default,BIGINT_FORMAT " "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -279,8 +279,8 @@ void DumpCustom::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { @@ -1648,7 +1648,7 @@ int DumpCustom::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -1711,7 +1711,7 @@ int DumpCustom::modify_param(int narg, char **arg) // just clear format_column_user allocated by this dump child class for (int i = 0; i < size_one; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } return 2; } @@ -1729,7 +1729,7 @@ int DumpCustom::modify_param(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Dump_modify int format does not contain d character"); char str[8]; @@ -1791,17 +1791,17 @@ int DumpCustom::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; for (int i = 0; i < nthreshlast; i++) { modify->delete_fix(thresh_fixID[i]); delete [] thresh_fixID[i]; } - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; } nthresh = nthreshlast = 0; return 2; diff --git a/src/dump_dcd.cpp b/src/dump_dcd.cpp index 254b371e22..8c848d261e 100644 --- a/src/dump_dcd.cpp +++ b/src/dump_dcd.cpp @@ -51,7 +51,7 @@ static inline void fwrite_int32(FILE* fd, uint32_t i) /* ---------------------------------------------------------------------- */ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump dcd command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), sortcol = 0; unwrap_flag = 0; - format_default = NULL; + format_default = nullptr; // allocate global array for atom coords @@ -115,7 +115,7 @@ void DumpDCD::openfile() { if (me == 0) { fp = fopen(filename,"wb"); - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); } } @@ -342,7 +342,7 @@ void DumpDCD::write_dcd_header(const char *remarks) strncpy(title_string,remarks,80); title_string[79] = '\0'; fwrite(title_string,80,1,fp); - cur_time=time(NULL); + cur_time=time(nullptr); tmbuf=localtime(&cur_time); memset(title_string,' ',81); strftime(title_string,80,"REMARKS Created %d %B,%Y at %H:%M",tmbuf); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 96a338950b..bbaa9038b6 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -50,12 +50,12 @@ enum{NO,YES}; /* ---------------------------------------------------------------------- */ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), thetastr(NULL), phistr(NULL), cxstr(NULL), - cystr(NULL), czstr(NULL), upxstr(NULL), upystr(NULL), upzstr(NULL), - zoomstr(NULL), perspstr(NULL), diamtype(NULL), diamelement(NULL), - bdiamtype(NULL), colortype(NULL), colorelement(NULL), bcolortype(NULL), - avec_line(NULL), avec_tri(NULL), avec_body(NULL), fixptr(NULL), image(NULL), - chooseghost(NULL), bufcopy(NULL) + DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr), + cystr(nullptr), czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr), + zoomstr(nullptr), perspstr(nullptr), diamtype(nullptr), diamelement(nullptr), + bdiamtype(nullptr), colortype(nullptr), colorelement(nullptr), bcolortype(nullptr), + avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr), image(nullptr), + chooseghost(nullptr), bufcopy(nullptr) { if (binary || multiproc) error->all(FLERR,"Invalid dump image filename"); @@ -124,16 +124,16 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : bdiam = NUMERIC; bdiamvalue = 0.5; } - char *fixID = NULL; + char *fixID = nullptr; - thetastr = phistr = NULL; + thetastr = phistr = nullptr; cflag = STATIC; cx = cy = cz = 0.5; - cxstr = cystr = czstr = NULL; + cxstr = cystr = czstr = nullptr; - upxstr = upystr = upzstr = NULL; - zoomstr = NULL; - perspstr = NULL; + upxstr = upystr = upzstr = nullptr; + zoomstr = nullptr; + perspstr = nullptr; boxflag = YES; boxdiam = 0.02; axesflag = NO; @@ -441,8 +441,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : else if (i % 6 == 0) bcolortype[i] = image->color2rgb("cyan"); } } else { - bdiamtype = NULL; - bcolortype = NULL; + bdiamtype = nullptr; + bcolortype = nullptr; } // viewflag = DYNAMIC if any view parameter is dynamic @@ -458,8 +458,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : // local data maxbufcopy = 0; - chooseghost = NULL; - bufcopy = NULL; + chooseghost = nullptr; + bufcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -566,7 +566,7 @@ void DumpImage::init_style() if (atomflag && acolor == ELEMENT) { for (int i = 1; i <= ntypes; i++) { colorelement[i] = image->element2color(typenames[i]); - if (colorelement[i] == NULL) + if (colorelement[i] == nullptr) error->all(FLERR,"Invalid dump image element name"); } } @@ -606,7 +606,7 @@ void DumpImage::write() // pack buf with color & diameter - pack(NULL); + pack(nullptr); // set minmax color range if using dynamic atom color map @@ -641,7 +641,7 @@ void DumpImage::write() else image->write_PPM(fp); if (multifile) { fclose(fp); - fp = NULL; + fp = nullptr; } } } @@ -1261,7 +1261,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1269,7 +1269,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { colortype[i] = image->color2rgb(ptrs[m%ncount]); - if (colortype[i] == NULL) + if (colortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1324,7 +1324,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1332,7 +1332,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { bcolortype[i] = image->color2rgb(ptrs[m%ncount]); - if (bcolortype[i] == NULL) + if (bcolortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1356,7 +1356,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"backcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); double *color = image->color2rgb(arg[1]); - if (color == NULL) error->all(FLERR,"Invalid color in dump_modify command"); + if (color == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); image->background[0] = static_cast (color[0]*255.0); image->background[1] = static_cast (color[1]*255.0); image->background[2] = static_cast (color[2]*255.0); @@ -1366,7 +1366,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"boxcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); image->boxcolor = image->color2rgb(arg[1]); - if (image->boxcolor == NULL) + if (image->boxcolor == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); return 2; } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index a71166ec57..988ff269de 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -35,9 +35,9 @@ enum{INT,DOUBLE}; DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - label(NULL), vtype(NULL), vformat(NULL), columns(NULL), field2index(NULL), - argindex(NULL), id_compute(NULL), compute(NULL), id_fix(NULL), fix(NULL), - pack_choice(NULL) + label(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), field2index(nullptr), + argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump local arguments specified"); @@ -73,12 +73,12 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : argindex = new int[nfield]; ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; // process attributes @@ -95,11 +95,11 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < size_one; i++) { if (vtype[i] == INT) strcat(format_default,"%d "); else if (vtype[i] == DOUBLE) strcat(format_default,"%g "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -180,8 +180,8 @@ void DumpLocal::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/dump_movie.cpp b/src/dump_movie.cpp index 5f6d0b80d7..951768978c 100644 --- a/src/dump_movie.cpp +++ b/src/dump_movie.cpp @@ -35,7 +35,7 @@ DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) : filetype = PPM; bitrate = 2000; framerate = 24; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ void DumpMovie::openfile() { char moviecmd[1024]; - if ((comm->me == 0) && (fp == NULL)) { + if ((comm->me == 0) && (fp == nullptr)) { #ifdef LAMMPS_FFMPEG sprintf(moviecmd,"ffmpeg -v error -y -r %.2f -f image2pipe -c:v ppm -i - " @@ -59,7 +59,7 @@ void DumpMovie::openfile() fp = popen(moviecmd,"w"); #endif - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Failed to open FFmpeg pipeline to " "file {}",filename)); } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 10ba10f995..d4352b0747 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - typenames(NULL) + typenames(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xyz command"); if (binary || multiproc) error->all(FLERR,"Invalid dump xyz filename"); @@ -46,7 +46,7 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), strcpy(format_default,str); ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,13 +54,13 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), DumpXYZ::~DumpXYZ() { delete[] format_default; - format_default = NULL; + format_default = nullptr; if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -83,7 +83,7 @@ void DumpXYZ::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; @@ -114,7 +114,7 @@ int DumpXYZ::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/error.cpp b/src/error.cpp index 0ea218887f..d89ea5b681 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -95,7 +95,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -143,7 +143,7 @@ void Error::all(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -169,7 +169,7 @@ void Error::all(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - write to world screen only if non-NULL on this proc + write to world screen only if non-nullptr on this proc always write to universe screen forces abort of entire world (and universe) if any proc in world calls ------------------------------------------------------------------------- */ @@ -192,7 +192,7 @@ void Error::one(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -207,7 +207,7 @@ void Error::one(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - only write to screen if non-NULL on this proc since could be file + only write to screen if non-nullptr on this proc since could be file ------------------------------------------------------------------------- */ void Error::warning(const std::string &file, int line, const std::string &str, int logflag) diff --git a/src/fix.cpp b/src/fix.cpp index 03313739a1..8d6d3f8829 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -33,8 +33,8 @@ int Fix::instance_total = 0; Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), extlist(NULL), vector_atom(NULL), array_atom(NULL), - vector_local(NULL), array_local(NULL), eatom(NULL), vatom(NULL) + id(nullptr), style(nullptr), extlist(nullptr), vector_atom(nullptr), array_atom(nullptr), + vector_local(nullptr), array_local(nullptr), eatom(nullptr), vatom(nullptr) { instance_me = instance_total++; diff --git a/src/fix.h b/src/fix.h index ab8dddf1d9..07a222063c 100644 --- a/src/fix.h +++ b/src/fix.h @@ -215,7 +215,7 @@ class Fix : protected Pointers { virtual int image(int *&, double **&) {return 0;} virtual int modify_param(int, char **) {return 0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual double memory_usage() {return 0.0;} diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index dba4fde077..52f4236985 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -43,7 +43,7 @@ enum{DIAMETER,CHARGE}; /* ---------------------------------------------------------------------- */ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) +nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -96,7 +96,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].pstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].pparam = new char[n]; - adapt[nadapt].pair = NULL; + adapt[nadapt].pair = nullptr; strcpy(adapt[nadapt].pparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -118,7 +118,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].bstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].bparam = new char[n]; - adapt[nadapt].bond = NULL; + adapt[nadapt].bond = nullptr; strcpy(adapt[nadapt].bparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -263,8 +263,8 @@ void FixAdapt::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; if (diamflag && atom->radius_flag) { std::string fixcmd = id + std::string("_FIX_STORE_DIAM"); @@ -340,7 +340,7 @@ void FixAdapt::init() if (ad->which == PAIR) { anypair = 1; - ad->pair = NULL; + ad->pair = nullptr; // if ad->pstyle has trailing sub-style annotation ":N", // strip it for pstyle arg to pair_match() and set nsub = N @@ -366,12 +366,12 @@ void FixAdapt::init() ad->pair = force->pair_match(psuffix,1,nsub); delete[] psuffix; } - if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub); - if (ad->pair == NULL) + if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub); + if (ad->pair == nullptr) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = ad->pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt pair style param not supported"); // for pair styles only parameters that are 2-d arrays in atom types or @@ -396,7 +396,7 @@ void FixAdapt::init() delete [] pstyle; } else if (ad->which == BOND){ - ad->bond = NULL; + ad->bond = nullptr; anybond = 1; int n = strlen(ad->bstyle) + 1; @@ -412,13 +412,13 @@ void FixAdapt::init() ad->bond = force->bond_match(bsuffix); delete [] bsuffix; } - if (ad->bond == NULL) ad->bond = force->bond_match(bstyle); - if (ad->bond == NULL ) + if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle); + if (ad->bond == nullptr ) error->all(FLERR,"Fix adapt bond style does not exist"); void *ptr = ad->bond->extract(ad->bparam,ad->bdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt bond style param not supported"); // for bond styles, use a vector @@ -431,7 +431,7 @@ void FixAdapt::init() delete [] bstyle; } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 0983728ea9..a8b7a46e4f 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -36,7 +36,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), estr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix addforce command"); @@ -52,7 +52,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : ilevel_respa = 0; virial_flag = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -253,7 +253,7 @@ void FixAddForce::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index da009c55d5..e4a04c6f9f 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -35,8 +35,8 @@ enum{X,V,F,COMPUTE,FIX,VARIABLE}; FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), array(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command"); @@ -64,7 +64,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nvalues]; for (int i = 0; i < nvalues; i++) { - ids[i] = NULL; + ids[i] = nullptr; if (strcmp(arg[i],"x") == 0) { which[i] = X; @@ -376,7 +376,7 @@ void FixAveAtom::end_of_step() } else if (which[m] == VARIABLE) { if (array) input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1); - else input->variable->compute_atom(n,igroup,NULL,nvalues,1); + else input->variable->compute_atom(n,igroup,nullptr,nvalues,1); } } @@ -394,7 +394,7 @@ void FixAveAtom::end_of_step() nvalid = ntimestep+peratom_freq - (nrepeat-1)*nevery; modify->addstep_compute(nvalid); - if (array == NULL) return; + if (array == nullptr) return; // average the final result for the Nfreq timestep @@ -424,7 +424,7 @@ void FixAveAtom::grow_arrays(int nmax) memory->grow(array,nmax,nvalues,"fix_ave/atom:array"); array_atom = array; if (array) vector_atom = array[0]; - else vector_atom = NULL; + else vector_atom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 18fb335279..c178cf63c0 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -46,12 +46,12 @@ enum{ONE,RUNNING,WINDOW}; FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nvalues(0), nrepeat(0), - which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - fp(NULL), idchunk(NULL), varatom(NULL), - count_one(NULL), count_many(NULL), count_sum(NULL), - values_one(NULL), values_many(NULL), values_sum(NULL), - count_total(NULL), count_list(NULL), - values_total(NULL), values_list(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + fp(nullptr), idchunk(nullptr), varatom(nullptr), + count_one(nullptr), count_many(nullptr), count_sum(nullptr), + values_one(nullptr), values_many(nullptr), values_sum(nullptr), + count_total(nullptr), count_list(nullptr), + values_total(nullptr), values_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/chunk command"); @@ -88,7 +88,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : int iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"vx") == 0) { which[nvalues] = V; @@ -164,15 +164,15 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : ave = ONE; nwindow = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"norm") == 0) { @@ -225,7 +225,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/chunk file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -409,12 +409,12 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : normcount = 0; maxvar = 0; - varatom = NULL; + varatom = nullptr; - count_one = count_many = count_sum = count_total = NULL; - count_list = NULL; - values_one = values_many = values_sum = values_total = NULL; - values_list = NULL; + count_one = count_many = count_sum = count_total = nullptr; + count_list = nullptr; + values_one = values_many = values_sum = values_total = nullptr; + values_list = nullptr; maxchunk = 0; nchunk = 1; @@ -466,24 +466,24 @@ FixAveChunk::~FixAveChunk() } delete [] idchunk; - which = NULL; - argindex = NULL; - ids = NULL; - value2index = NULL; - fp = NULL; - varatom = NULL; - count_one = NULL; - count_many = NULL; - count_sum = NULL; - count_total = NULL; - count_list = NULL; - values_one = NULL; - values_many = NULL; - values_sum = NULL; - values_total = NULL; - values_list = NULL; - idchunk = NULL; - cchunk = NULL; + which = nullptr; + argindex = nullptr; + ids = nullptr; + value2index = nullptr; + fp = nullptr; + varatom = nullptr; + count_one = nullptr; + count_many = nullptr; + count_sum = nullptr; + count_total = nullptr; + count_list = nullptr; + values_one = nullptr; + values_many = nullptr; + values_sum = nullptr; + values_total = nullptr; + values_list = nullptr; + idchunk = nullptr; + cchunk = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1110,7 +1110,7 @@ void FixAveChunk::allocate() double FixAveChunk::compute_array(int i, int j) { - if (values_total == NULL) return 0.0; + if (values_total == nullptr) return 0.0; if (i >= nchunk) return 0.0; if (j < colextra) { if (cchunk->compress) { diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 031dfc26bf..5576c7fb66 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -45,8 +45,8 @@ enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): Fix (lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL), - count(NULL), values(NULL), corr(NULL), save_count(NULL), save_corr(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), fp(nullptr), + count(nullptr), values(nullptr), corr(nullptr), save_count(nullptr), save_corr(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/correlate command"); @@ -112,11 +112,11 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): ave = ONE; startstep = 0; prefactor = 1.0; - fp = NULL; + fp = nullptr; overwrite = 0; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"type") == 0) { @@ -147,7 +147,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/correlate file {}:"" {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 3a9346498f..4d1cd5b2dd 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -45,10 +45,10 @@ enum{IGNORE,END,EXTRA}; FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), fp(NULL), stats_list(NULL), - bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL), - coord(NULL), vector(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), fp(nullptr), stats_list(nullptr), + bin(nullptr), bin_total(nullptr), bin_all(nullptr), bin_list(nullptr), + coord(nullptr), vector(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command"); @@ -120,41 +120,41 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[i],"x") == 0) { which[i] = X; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"y") == 0) { which[i] = X; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"z") == 0) { which[i] = X; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vx") == 0) { which[i] = V; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vy") == 0) { which[i] = V; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vz") == 0) { which[i] = V; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fx") == 0) { which[i] = F; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fy") == 0) { which[i] = F; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fz") == 0) { which[i] = F; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if ((strncmp(arg[i],"c_",2) == 0) || (strncmp(arg[i],"f_",2) == 0) || @@ -467,9 +467,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : bin_all = new double[nbins]; coord = new double[nbins]; - stats_list = NULL; - bin_list = NULL; - vector = NULL; + stats_list = nullptr; + bin_list = nullptr; + vector = nullptr; maxatom = 0; if (ave == WINDOW) { @@ -944,16 +944,16 @@ void FixAveHisto::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; kind = DEFAULT; ave = ONE; startstep = 0; mode = SCALAR; beyond = IGNORE; overwrite = 0; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -962,7 +962,7 @@ void FixAveHisto::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/histo file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 5e93df0313..586c36af8a 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -126,7 +126,7 @@ void FixAveHistoWeight::end_of_step() // calculate weight factors which are 2nd value (i = 1) double weight = 0.0; - double *weights = NULL; + double *weights = nullptr; int stride = 0; i = 1; @@ -270,11 +270,11 @@ void FixAveHistoWeight::end_of_step() // atom attributes - if (which[i] == X && weights != NULL) + if (which[i] == X && weights != nullptr) bin_atoms_weights(&atom->x[0][j],3,weights,stride); - else if (which[i] == V && weights != NULL) + else if (which[i] == V && weights != nullptr) bin_atoms_weights(&atom->v[0][j],3,weights,stride); - else if (which[i] == F && weights != NULL) + else if (which[i] == F && weights != nullptr) bin_atoms_weights(&atom->f[0][j],3,weights,stride); // invoke compute if not previously invoked diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 9c493b9846..b40a7eb009 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -43,11 +43,11 @@ enum{SCALAR,VECTOR}; FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - offcol(NULL), varlen(NULL), ids(NULL), - fp(NULL), offlist(NULL), format(NULL), format_user(NULL), - vector(NULL), vector_total(NULL), vector_list(NULL), - column(NULL), array(NULL), array_total(NULL), array_list(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + offcol(nullptr), varlen(nullptr), ids(nullptr), + fp(nullptr), offlist(nullptr), format(nullptr), format_user(nullptr), + vector(nullptr), vector_total(nullptr), vector_list(nullptr), + column(nullptr), array(nullptr), array_total(nullptr), array_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/time command"); @@ -243,7 +243,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // nrows = # of rows in output array // if all columns are variable length, just set nrows = 1 for now - column = NULL; + column = nullptr; if (mode == VECTOR) { if (all_variable_length == 0) nrows = column_length(0); else nrows = 1; @@ -304,10 +304,10 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; - array = array_total = NULL; - array_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; + array = array_total = nullptr; + array_list = nullptr; if (mode == SCALAR) { vector = new double[nvalues]; @@ -321,7 +321,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // VECTOR mode produces either a vector or array // intensive/extensive flags set by compute,fix,variable that produces value - extlist = NULL; + extlist = nullptr; if (mode == SCALAR) { if (nvalues == 1) { @@ -1022,18 +1022,18 @@ void FixAveTime::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; mode = SCALAR; noff = 0; - offlist = NULL; + offlist = nullptr; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -1042,7 +1042,7 @@ void FixAveTime::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/time file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 00ec0d67ba..324f6eaa6b 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -34,7 +34,7 @@ enum{NONE,CONSTANT,EQUAL}; FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix aveforce command"); @@ -46,7 +46,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -197,7 +197,7 @@ void FixAveForce::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -265,7 +265,7 @@ void FixAveForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 7cee835375..735b6b3bd0 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -35,7 +35,7 @@ enum{SHIFT,BISECTION}; /* ---------------------------------------------------------------------- */ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), balance(NULL), irregular(NULL) + Fix(lmp, narg, arg), balance(nullptr), irregular(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix balance command"); diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 5fd9ef190e..8d8b4af107 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -43,7 +43,7 @@ enum{ISO,ANISO,TRICLINIC}; FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix box/relax command"); @@ -395,7 +395,7 @@ void FixBoxRelax::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index 92fd42f3db..edeaf60f42 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; FixController::FixController(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pvID(NULL), cvID(NULL) + pvID(nullptr), cvID(nullptr) { if (narg != 11) error->all(FLERR,"Illegal fix controller command"); diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index b4c36ca43e..4d3b1c647b 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -42,7 +42,7 @@ enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; /* ---------------------------------------------------------------------- */ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -rfix(NULL), irregular(NULL), set(NULL) +rfix(nullptr), irregular(nullptr), set(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix deform command"); @@ -353,7 +353,7 @@ rfix(NULL), irregular(NULL), set(NULL) flip = 0; if (force_reneighbor) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; TWOPI = 2.0*MY_PI; } @@ -618,7 +618,7 @@ void FixDeform::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index be2a74d81b..02d76b8c27 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -28,7 +28,7 @@ using namespace FixConst; FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - flist(NULL) + flist(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix enforce2d command"); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 1db7e15295..c44261b338 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -29,7 +29,7 @@ enum{PF_CALLBACK,PF_ARRAY}; FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fexternal(NULL), caller_vector(NULL) + fexternal(nullptr), caller_vector(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix external command"); @@ -53,7 +53,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : if (napply <= 0) error->all(FLERR,"Illegal fix external command"); } else error->all(FLERR,"Illegal fix external command"); - callback = NULL; + callback = nullptr; // perform initial allocation of atom-based array // register with Atom class @@ -66,7 +66,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : // optional vector of values provided by caller // vector_flag and size_vector are setup via set_vector_length() - caller_vector = NULL; + caller_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ int FixExternal::setmask() void FixExternal::init() { - if (mode == PF_CALLBACK && callback == NULL) + if (mode == PF_CALLBACK && callback == nullptr) error->all(FLERR,"Fix external callback function not set"); } diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 6dff937385..abef474b4c 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -37,8 +37,8 @@ enum{CONSTANT,EQUAL}; // same as FixPour FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - mstr(NULL), vstr(NULL), pstr(NULL), tstr(NULL), - xstr(NULL), ystr(NULL), zstr(NULL) + mstr(nullptr), vstr(nullptr), pstr(nullptr), tstr(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix gravity command"); @@ -49,7 +49,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - mstr = vstr = pstr = tstr = xstr = ystr = zstr = NULL; + mstr = vstr = pstr = tstr = xstr = ystr = zstr = nullptr; mstyle = vstyle = pstyle = tstyle = xstyle = ystyle = zstyle = CONSTANT; if (strstr(arg[3],"v_") == arg[3]) { @@ -394,5 +394,5 @@ void *FixGravity::extract(const char *name, int &dim) dim = 1; return (void *) gvec; } - return NULL; + return nullptr; } diff --git a/src/fix_group.cpp b/src/fix_group.cpp index bb51fafa12..108a97157e 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -34,7 +34,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), idvar(NULL), idprop(NULL) +idregion(nullptr), idvar(nullptr), idprop(nullptr) { // dgroupbit = bitmask of dynamic group // group ID is last part of fix ID @@ -210,9 +210,9 @@ void FixGroup::set_group() // operate differently due to invocation this early in timestep // e.g. perform ghost comm update due to atoms having just moved - double *var = NULL; - int *ivector = NULL; - double *dvector = NULL; + double *var = nullptr; + int *ivector = nullptr; + double *dvector = nullptr; if (varflag) { update->post_integrate = 1; @@ -265,5 +265,5 @@ void *FixGroup::extract(const char *str, int &/*unused*/) if (strcmp(str,"property") == 0 && propflag) return (void *) idprop; if (strcmp(str,"variable") == 0 && varflag) return (void *) idvar; if (strcmp(str,"region") == 0 && regionflag) return (void *) idregion; - return NULL; + return nullptr; } diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index f8222e3ece..42f5c46a85 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -37,7 +37,7 @@ enum{NOMSG,YESMSG}; /* ---------------------------------------------------------------------- */ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idvar(NULL), dlimit_path(NULL) + Fix(lmp, narg, arg), idvar(nullptr), dlimit_path(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix halt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -45,7 +45,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : // comparison args - idvar = NULL; + idvar = nullptr; int iarg = 4; if (strcmp(arg[iarg],"tlimit") == 0) { diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index e2eb399322..3c91341940 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -39,7 +39,7 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) +idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix heat command"); @@ -50,7 +50,7 @@ idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); - hstr = NULL; + hstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; @@ -192,7 +192,7 @@ void FixHeat::end_of_step() // vsub = velocity subtracted from each atom to preserve momentum // overall KE cannot go negative - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index ae58f27913..e96ad7ab8a 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -40,7 +40,7 @@ enum{INSIDE,OUTSIDE}; FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL), pstr(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix indent command"); @@ -407,7 +407,7 @@ void FixIndent::options(int narg, char **arg) if (narg < 0) error->all(FLERR,"Illegal fix indent command"); istyle = NONE; - xstr = ystr = zstr = rstr = pstr = NULL; + xstr = ystr = zstr = rstr = pstr = nullptr; xvalue = yvalue = zvalue = rvalue = pvalue = 0.0; scaleflag = 1; side = OUTSIDE; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 9d0b5f28f1..5cfb860b56 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -53,8 +53,8 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gjfflag(0), gfactor1(NULL), gfactor2(NULL), ratio(NULL), tstr(NULL), - flangevin(NULL), tforce(NULL), franprev(NULL), lv(NULL), id_temp(NULL), random(NULL) + gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), tstr(nullptr), + flangevin(nullptr), tforce(nullptr), franprev(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix langevin command"); @@ -154,10 +154,10 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix langevin command"); } - // set temperature = NULL, user can override via fix_modify if wants bias + // set temperature = nullptr, user can override via fix_modify if wants bias - id_temp = NULL; - temperature = NULL; + id_temp = nullptr; + temperature = nullptr; energy = 0.0; @@ -165,11 +165,11 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : // compute_scalar checks for this and returns 0.0 // if flangevin_allocated is not set - flangevin = NULL; + flangevin = nullptr; flangevin_allocated = 0; - franprev = NULL; - lv = NULL; - tforce = NULL; + franprev = nullptr; + lv = nullptr; + tforce = nullptr; maxatom1 = maxatom2 = 0; // setup atom-based array for franprev @@ -1104,7 +1104,7 @@ void *FixLangevin::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index 93b13fac49..a3814f185d 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixMinimize::FixMinimize(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvector(0), peratom(NULL), vectors(NULL) + nvector(0), peratom(nullptr), vectors(nullptr) { // register callback to this fix from Atom class // don't perform initial allocation here, must wait until add_vector() diff --git a/src/fix_move.cpp b/src/fix_move.cpp index d6f61af091..aaa2422fa9 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -46,10 +46,10 @@ enum{EQUAL,ATOM}; FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), vxvarstr(NULL), - vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), toriginal(NULL), qoriginal(NULL), - displace(NULL), velocity(NULL) + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), vxvarstr(nullptr), + vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), toriginal(nullptr), qoriginal(nullptr), + displace(nullptr), velocity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix move command"); @@ -127,37 +127,37 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -259,7 +259,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : atom->add_callback(0); atom->add_callback(1); - displace = velocity = NULL; + displace = velocity = nullptr; // AtomVec pointers to retrieve per-atom storage of extra quantities @@ -297,7 +297,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (quat_flag) { double *quat; for (int i = 0; i < nlocal; i++) { - quat = NULL; + quat = nullptr; if (mask[i] & groupbit) { if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; @@ -439,9 +439,9 @@ void FixMove::init() memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; if (strstr(update->integrate_style,"respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; @@ -664,7 +664,7 @@ void FixMove::initial_integrate(int /*vflag*/) // angmom for ellipsoids, tris, and bodies if (angmom_flag) { - quat = inertia = NULL; + quat = inertia = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) { quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; shape = avec_ellipsoid->bonus[ellipsoid[i]].shape; @@ -701,7 +701,7 @@ void FixMove::initial_integrate(int /*vflag*/) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -873,7 +873,7 @@ void FixMove::initial_integrate(int /*vflag*/) } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMove::final_integrate() @@ -1121,7 +1121,7 @@ void FixMove::set_arrays(int i) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 43415a6ef5..766d4de143 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -34,8 +34,8 @@ enum{DEFAULT,NPARTNER,PERPARTNER}; // also set in fix neigh/history/omp FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), npartner(NULL), partner(NULL), valuepartner(NULL), - ipage_atom(NULL), dpage_atom(NULL), ipage_neigh(NULL), dpage_neigh(NULL) + pair(nullptr), npartner(nullptr), partner(nullptr), valuepartner(nullptr), + ipage_atom(nullptr), dpage_atom(nullptr), ipage_neigh(nullptr), dpage_neigh(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix NEIGH_HISTORY command"); @@ -70,16 +70,16 @@ FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : // other per-atom vectors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; maxatom = 0; // per-atom and per-neighbor data structs - ipage_atom = NULL; - dpage_atom = NULL; - ipage_neigh = NULL; - dpage_neigh = NULL; + ipage_atom = nullptr; + dpage_atom = nullptr; + ipage_neigh = nullptr; + dpage_neigh = nullptr; // initialize npartner to 0 so neighbor list creation is OK the 1st time @@ -120,13 +120,13 @@ FixNeighHistory::~FixNeighHistory() // to better detect use-after-delete errors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; - pair = NULL; - npartner = NULL; - partner = NULL; - valuepartner = NULL; + pair = nullptr; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; } /* ---------------------------------------------------------------------- */ @@ -172,7 +172,7 @@ void FixNeighHistory::init() void FixNeighHistory::allocate_pages() { int create = 0; - if (ipage_atom == NULL) create = 1; + if (ipage_atom == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -279,7 +279,7 @@ void FixNeighHistory::pre_exchange_onesided() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -383,7 +383,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -392,7 +392,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -506,7 +506,7 @@ void FixNeighHistory::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -864,9 +864,9 @@ int FixNeighHistory::pack_restart(int i, double *buf) void FixNeighHistory::unpack_restart(int nlocal, int nth) { - // ipage_atom = NULL if being called from granular pair style init() + // ipage_atom = nullptr if being called from granular pair style init() - if (ipage_atom == NULL) allocate_pages(); + if (ipage_atom == nullptr) allocate_pages(); // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 0e3dc8931f..aa353b19a2 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -51,10 +51,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix nvt/npt/nph command"); @@ -72,7 +72,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -88,8 +88,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; // turn on tilt factor scaling, whenever applicable @@ -579,10 +579,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -740,7 +740,7 @@ void FixNH::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -767,7 +767,7 @@ void FixNH::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1768,7 +1768,7 @@ void *FixNH::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_numdiff.cpp b/src/fix_numdiff.cpp index 145d60e8df..cd186eb9a8 100644 --- a/src/fix_numdiff.cpp +++ b/src/fix_numdiff.cpp @@ -40,8 +40,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), numdiff_forces(NULL), - temp_x(NULL), temp_f(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), numdiff_forces(nullptr), + temp_x(nullptr), temp_f(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix numdiff command"); diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index a90bf86c56..a156c0d588 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -37,7 +37,7 @@ enum{ISO,ANISO}; FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix press/berendsen command"); @@ -239,7 +239,7 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : pflag = 1; nrigid = 0; - rfix = NULL; + rfix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,7 +308,7 @@ void FixPressBerendsen::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 78fceea184..c8a7c8e610 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -29,7 +29,7 @@ using namespace FixConst; FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), string(NULL), copy(NULL), work(NULL), var_print(NULL) + fp(nullptr), string(nullptr), copy(nullptr), work(nullptr), var_print(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix print command"); if (strstr(arg[3],"v_") == arg[3]) { @@ -54,9 +54,9 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : // parse optional args - fp = NULL; + fp = nullptr; screenflag = 1; - char *title = NULL; + char *title = nullptr; int iarg = 5; while (iarg < narg) { @@ -65,7 +65,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : if (me == 0) { if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix print file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 07108721c4..35ac20e370 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -30,7 +30,7 @@ enum{MOLECULE,CHARGE,RMASS,INTEGER,DOUBLE}; FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalue(0), style(NULL), index(NULL), astyle(NULL) + nvalue(0), style(nullptr), index(nullptr), astyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); @@ -152,21 +152,21 @@ FixPropertyAtom::~FixPropertyAtom() if (border) atom->delete_callback(id,2); // deallocate per-atom vectors in Atom class - // set ptrs to NULL, so they no longer exist for Atom class + // set ptrs to nullptr, so they no longer exist for Atom class for (int m = 0; m < nvalue; m++) { if (style[m] == MOLECULE) { atom->molecule_flag = 0; memory->destroy(atom->molecule); - atom->molecule = NULL; + atom->molecule = nullptr; } else if (style[m] == CHARGE) { atom->q_flag = 0; memory->destroy(atom->q); - atom->q = NULL; + atom->q = nullptr; } else if (style[m] == RMASS) { atom->rmass_flag = 0; memory->destroy(atom->rmass); - atom->rmass = NULL; + atom->rmass = nullptr; } else if (style[m] == INTEGER) { atom->remove_custom(0,index[m]); } else if (style[m] == DOUBLE) { @@ -237,13 +237,13 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,fmt::format("Too few lines in {} section of data file",keyword)); int format_ok = 1; for (j = 1; j < nwords; j++) { - values[j] = strtok(NULL," \t\n\r\f"); - if (values[j] == NULL) format_ok = 0; + values[j] = strtok(nullptr," \t\n\r\f"); + if (values[j] == nullptr) format_ok = 0; } if (!format_ok) error->all(FLERR,fmt::format("Incorrect {} format in data file",keyword)); diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index 2e10b15ffa..cee1ed4cc1 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - count(NULL), extra(NULL) + count(nullptr), extra(nullptr) { nextra = utils::inumeric(FLERR,arg[3],false,lmp); int nfix = utils::inumeric(FLERR,arg[4],false,lmp); diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index b116f8ccac..abed4b4775 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -25,7 +25,7 @@ using namespace FixConst; FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - store_torque(0), f_level(NULL), t_level(NULL) + store_torque(0), f_level(nullptr), t_level(nullptr) { // nlevels = # of rRESPA levels @@ -41,8 +41,8 @@ FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - f_level = NULL; - t_level = NULL; + f_level = nullptr; + t_level = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); } diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 4f675bf7bf..31e32a478f 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -45,9 +45,9 @@ enum{BOND,LBOUND,ANGLE,DIHEDRAL}; FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rstyle(NULL), mult(NULL), ids(NULL), kstart(NULL), kstop(NULL), - deqstart(NULL), deqstop(NULL), target(NULL), cos_target(NULL), - sin_target(NULL) + rstyle(nullptr), mult(nullptr), ids(nullptr), kstart(nullptr), kstop(nullptr), + deqstart(nullptr), deqstop(nullptr), target(nullptr), cos_target(nullptr), + sin_target(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix restrain command"); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 229890c5df..3acd449646 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -35,7 +35,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix setforce command"); @@ -46,7 +46,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : extvector = 1; respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -228,7 +228,7 @@ void FixSetForce::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -305,7 +305,7 @@ void FixSetForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) foriginal[1] += foriginal_saved[1]; foriginal[2] += foriginal_saved[2]; } else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 2d695add26..ac08cbb497 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -37,7 +37,7 @@ enum{TETHER,COUPLE}; FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 9) error->all(FLERR,"Illegal fix spring command"); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index d8de88bd63..b7ffea3d68 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idchunk(NULL), idcom(NULL), com0(NULL), fcom(NULL) + idchunk(nullptr), idcom(nullptr), com0(nullptr), fcom(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix spring/chunk command"); @@ -155,7 +155,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // will be unlocked in destructor // necessary b/c this fix stores original COM - if (com0 == NULL) cchunk->lock(this,update->ntimestep,-1); + if (com0 == nullptr) cchunk->lock(this,update->ntimestep,-1); // calculate current centers of mass for each chunk // extract pointers from idchunk and idcom @@ -170,7 +170,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // check if first time cchunk was queried via ccom // if so, allocate com0,fcom and store initial COM - if (com0 == NULL) { + if (com0 == nullptr) { memory->create(com0,nchunk,3,"spring/chunk:com0"); memory->create(fcom,nchunk,3,"spring/chunk:fcom"); diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 5715e7eb88..2805395053 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -67,7 +67,7 @@ void FixSpringRG::init() { masstotal = group->mass(igroup); - // if rg0 was specified as NULL, compute current Rg + // if rg0 was specified as nullptr, compute current Rg // only occurs on 1st run if (rg0_flag) { diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 8e7b3eb925..12e933cd0f 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -33,7 +33,7 @@ using namespace FixConst; FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xoriginal(NULL) + xoriginal(nullptr) { if ((narg < 4) || (narg > 5)) error->all(FLERR,"Illegal fix spring/self command"); @@ -70,7 +70,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); diff --git a/src/fix_store.cpp b/src/fix_store.cpp index 3eb2075250..d8d6dbf90c 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -28,7 +28,7 @@ enum{UNKNOWN,GLOBAL,PERATOM}; /* ---------------------------------------------------------------------- */ FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -vstore(NULL), astore(NULL), rbuf(NULL) +vstore(nullptr), astore(nullptr), rbuf(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix store command"); @@ -69,8 +69,8 @@ vstore(NULL), astore(NULL), rbuf(NULL) if (nvalues == 1) vecflag = 1; } - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; // allocate vector or array and restart buffer rbuf // for PERATOM, register with Atom class @@ -84,7 +84,7 @@ vstore(NULL), astore(NULL), rbuf(NULL) grow_arrays(atom->nmax); atom->add_callback(0); if (restart_peratom) atom->add_callback(1); - rbuf = NULL; + rbuf = nullptr; } // zero the storage @@ -145,8 +145,8 @@ void FixStore::reset_global(int nrow_caller, int ncol_caller) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_caller == 1) vecflag = 1; @@ -199,8 +199,8 @@ void FixStore::restart(char *buf) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_restart == 1) vecflag = 1; diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index 5c25f0e162..ae01848d7b 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -26,7 +26,7 @@ using namespace FixConst; FixStoreForce::FixStoreForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - foriginal(NULL) + foriginal(nullptr) { if (narg < 3) error->all(FLERR,"Illegal fix store/coord command"); diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index fd4563b7ad..4ce65195b6 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -38,9 +38,9 @@ enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME}; FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), values(NULL), - vbuf(NULL), pack_choice(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), values(nullptr), + vbuf(nullptr), pack_choice(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix store/state command"); @@ -64,7 +64,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : int iarg = 4; while (iarg < narg) { which[nvalues] = KEYWORD; - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"id") == 0) { pack_choice[nvalues++] = &FixStoreState::pack_id; @@ -348,7 +348,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - values = NULL; + values = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); @@ -479,7 +479,7 @@ void FixStoreState::end_of_step() // fill vector or array with per-atom values if (values) vbuf = &values[0][0]; - else vbuf = NULL; + else vbuf = nullptr; for (int m = 0; m < nvalues; m++) { if (which[m] == KEYWORD && kflag) (this->*pack_choice[m])(m); @@ -572,7 +572,7 @@ void FixStoreState::grow_arrays(int nmax) memory->grow(values,nmax,nvalues,"store/state:values"); if (nvalues == 1) { if (nmax) vector_atom = &values[0][0]; - else vector_atom = NULL; + else vector_atom = nullptr; } else array_atom = values; } diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index ec2965d072..610cc7310a 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg != 6) error->all(FLERR,"Illegal fix temp/berendsen command"); @@ -50,7 +50,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : global_freq = nevery; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -280,5 +280,5 @@ void *FixTempBerendsen::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index cf7e9e9fe2..c8016f3200 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -43,7 +43,7 @@ enum{CONSTANT,EQUAL}; FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - vhold(NULL), tstr(NULL), id_temp(NULL), random(NULL) + vhold(nullptr), tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csld command"); @@ -56,7 +56,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -90,7 +90,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : modify->add_compute(cmd); tflag = 1; - vhold = NULL; + vhold = nullptr; nmax = -1; energy = 0.0; } @@ -108,7 +108,7 @@ FixTempCSLD::~FixTempCSLD() delete random; memory->destroy(vhold); - vhold = NULL; + vhold = nullptr; nmax = -1; } @@ -350,5 +350,5 @@ void *FixTempCSLD::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index c620905102..649f0d9870 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -120,7 +120,7 @@ double FixTempCSVR::resamplekin(double ekin_old, double ekin_new){ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), random(NULL) + tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csvr command"); @@ -133,7 +133,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -383,5 +383,5 @@ void *FixTempCSVR::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index b5cb9c9a1b..bd3ae9ecdc 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); @@ -50,7 +50,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; dynamic_group_allow = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; tstr = new char[n]; @@ -278,5 +278,5 @@ void *FixTempRescale::extract(const char *str, int &dim) dim = 0; return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 12e36d890e..17520d191a 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nfileevery(0), fp(NULL), xf(NULL), xold(NULL) +nfileevery(0), fp(nullptr), xf(nullptr), xold(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tmd command"); @@ -74,7 +74,7 @@ nfileevery(0), fp(NULL), xf(NULL), xold(NULL) if (narg != 7) error->all(FLERR,"Illegal fix tmd command"); if (me == 0) { fp = fopen(arg[6],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix tmd file {}: {}", arg[6], utils::getsyserror())); fprintf(fp,"%s %s\n","# Step rho_target rho_old gamma_back", @@ -396,7 +396,7 @@ void FixTMD::readfile(char *file) int firstline = 1; int ncount = 0; - char *eof = NULL; + char *eof = nullptr; xprd = yprd = zprd = -1.0; do { @@ -404,7 +404,7 @@ void FixTMD::readfile(char *file) m = 0; for (nlines = 0; nlines < CHUNK; nlines++) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) break; + if (eof == nullptr) break; m += strlen(&buffer[m]); } if (buffer[m-1] != '\n') strcpy(&buffer[m++],"\n"); @@ -486,7 +486,7 @@ void FixTMD::readfile(char *file) } bufptr = next + 1; } - } while (eof != NULL); + } while (eof != nullptr); // clean up @@ -540,7 +540,7 @@ void FixTMD::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 6bcdfe948e..141f00e65e 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -38,7 +38,7 @@ enum{SCALAR,VECTOR}; FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), vector(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), vector(nullptr), array(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix vector command"); @@ -154,8 +154,8 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : // ncount = current size of vector or array - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; ncount = ncountmax = 0; if (nvalues == 1) size_vector = 0; else size_array_rows = 0; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index 08649280d8..d07d547c29 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -27,7 +27,7 @@ using namespace FixConst; FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gamma(NULL) + gamma(nullptr) { dynamic_group_allow = 1; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index cb822f1090..2394922e26 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -51,7 +51,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : fldflag = 0; int pbcflag = 0; - for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = NULL; + for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = nullptr; int iarg = 3; while (iarg < narg) { diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index fc3735cfbf..6ec3a27a58 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -34,7 +34,7 @@ enum{LJ93,LJ126,LJ1043,COLLOID,HARMONIC,MORSE}; FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/region command"); diff --git a/src/force.cpp b/src/force.cpp index 701113d7ef..68cf5b247f 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -54,12 +54,12 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) qqr2e_lammps_real = 332.06371; // these constants are toggled qqr2e_charmm_real = 332.0716; // by new CHARMM pair styles - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; char *str = (char *) "none"; int n = strlen(str) + 1; @@ -76,7 +76,7 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) kspace_style = new char[n]; strcpy(kspace_style,str); - pair_restart = NULL; + pair_restart = nullptr; create_factories(); } @@ -159,12 +159,12 @@ Force::~Force() if (improper) delete improper; if (kspace) delete kspace; - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; delete pair_map; delete bond_map; @@ -233,9 +233,9 @@ void Force::create_pair(const std::string &style, int trysuffix) delete [] pair_style; if (pair) delete pair; if (pair_restart) delete [] pair_restart; - pair_style = NULL; - pair = NULL; - pair_restart = NULL; + pair_style = nullptr; + pair = nullptr; + pair_restart = nullptr; int sflag; pair = new_pair(style,trysuffix,sflag); @@ -270,7 +270,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (pair_map->find(style) != pair_map->end()) { PairCreator &pair_creator = (*pair_map)[style]; return pair_creator(lmp); @@ -278,7 +278,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("pair",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -296,7 +296,7 @@ Pair *Force::pair_creator(LAMMPS *lmp) if exact, then style name must be exact match to word if not exact, style name must contain word if nsub > 0, match Nth hybrid sub-style - return NULL if no match or if nsub=0 and multiple sub-styles match + return nullptr if no match or if nsub=0 and multiple sub-styles match ------------------------------------------------------------------------- */ Pair *Force::pair_match(const std::string &word, int exact, int nsub) @@ -318,13 +318,13 @@ Pair *Force::pair_match(const std::string &word, int exact, int nsub) if (count == 1) return hybrid->styles[iwhich]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- return style name of Pair class that matches Pair ptr called by Neighbor::print_neigh_info() - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ char *Force::pair_match_ptr(Pair *ptr) @@ -337,7 +337,7 @@ char *Force::pair_match_ptr(Pair *ptr) if (ptr == hybrid->styles[i]) return hybrid->keywords[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -381,7 +381,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (bond_map->find(style) != bond_map->end()) { BondCreator &bond_creator = (*bond_map)[style]; return bond_creator(lmp); @@ -389,7 +389,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("bond",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -414,7 +414,7 @@ Bond *Force::bond_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -458,7 +458,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (angle_map->find(style) != angle_map->end()) { AngleCreator &angle_creator = (*angle_map)[style]; return angle_creator(lmp); @@ -466,7 +466,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("angle",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -491,7 +491,7 @@ Angle *Force::angle_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -535,7 +535,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (dihedral_map->find(style) != dihedral_map->end()) { DihedralCreator &dihedral_creator = (*dihedral_map)[style]; return dihedral_creator(lmp); @@ -543,7 +543,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -568,7 +568,7 @@ Dihedral *Force::dihedral_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -612,7 +612,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (improper_map->find(style) != improper_map->end()) { ImproperCreator &improper_creator = (*improper_map)[style]; return improper_creator(lmp); @@ -620,7 +620,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("improper",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -645,7 +645,7 @@ Improper *Force::improper_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -689,7 +689,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (kspace_map->find(style) != kspace_map->end()) { KSpaceCreator &kspace_creator = (*kspace_map)[style]; return kspace_creator(lmp); @@ -697,7 +697,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -714,14 +714,14 @@ KSpace *Force::kspace_creator(LAMMPS *lmp) return ptr to Kspace class if matches word if exact, then style name must be exact match to word if not exact, style name must contain word - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ KSpace *Force::kspace_match(const std::string &word, int exact) { if (exact && (word == kspace_style)) return kspace; else if (!exact && utils::strmatch(kspace_style,word)) return kspace; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/group.cpp b/src/group.cpp index a2e20a6ab1..6b9121f506 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -58,7 +58,7 @@ Group::Group(LAMMPS *lmp) : Pointers(lmp) inversemask = new int[MAX_GROUP]; dynamic = new int[MAX_GROUP]; - for (int i = 0; i < MAX_GROUP; i++) names[i] = NULL; + for (int i = 0; i < MAX_GROUP; i++) names[i] = nullptr; for (int i = 0; i < MAX_GROUP; i++) bitmask[i] = 1 << i; for (int i = 0; i < MAX_GROUP; i++) inversemask[i] = bitmask[i] ^ ~0; for (int i = 0; i < MAX_GROUP; i++) dynamic[i] = 0; @@ -126,7 +126,7 @@ void Group::assign(int narg, char **arg) modify->delete_fix(std::string("GROUP_") + names[igroup]); delete [] names[igroup]; - names[igroup] = NULL; + names[igroup] = nullptr; dynamic[igroup] = 0; ngroup--; @@ -235,8 +235,8 @@ void Group::assign(int narg, char **arg) bound2 = utils::tnumeric(FLERR,arg[4],false,lmp); } else if (narg != 4) error->all(FLERR,"Illegal group command"); - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -296,8 +296,8 @@ void Group::assign(int narg, char **arg) // args = list of values } else { - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -310,9 +310,9 @@ void Group::assign(int narg, char **arg) if (strchr(arg[iarg],':')) { ptr = strtok(arg[iarg],":"); start = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); stop = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); if (ptr) delta = utils::tnumeric(FLERR,ptr,false,lmp); } else { start = stop = utils::tnumeric(FLERR,arg[iarg],false,lmp); @@ -617,7 +617,7 @@ int Group::find_or_create(const char *name) int Group::find_unused() { for (int igroup = 0; igroup < MAX_GROUP; igroup++) - if (names[igroup] == NULL) return igroup; + if (names[igroup] == nullptr) return igroup; return -1; } @@ -654,7 +654,7 @@ void Group::add_molecules(int /*igroup*/, int bit) for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; molbit = bit; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -724,7 +724,7 @@ void Group::read_restart(FILE *fp) for (i = 0; i < MAX_GROUP; i++) delete [] names[i]; - if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&ngroup,1,MPI_INT,0,world); // use count to not change restart format with deleted groups @@ -733,17 +733,17 @@ void Group::read_restart(FILE *fp) int count = 0; for (i = 0; i < MAX_GROUP; i++) { if (count == ngroup) { - names[i] = NULL; + names[i] = nullptr; continue; } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n) { names[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(names[i],n,MPI_CHAR,0,world); count++; - } else names[i] = NULL; + } else names[i] = nullptr; } } diff --git a/src/image.cpp b/src/image.cpp index 755be587d8..6912bdee80 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -74,8 +74,8 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) // colors ncolors = 0; - username = NULL; - userrgb = NULL; + username = nullptr; + userrgb = nullptr; boxcolor = color2rgb("yellow"); background[0] = background[1] = background[2] = 0; @@ -112,7 +112,7 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) backLightColor[1] = 0.9; backLightColor[2] = 0.9; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1029,13 +1029,13 @@ void Image::write_PNG(FILE *fp) png_structp png_ptr; png_infop info_ptr; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, NULL); + png_destroy_write_struct(&png_ptr, nullptr); return; } @@ -1166,7 +1166,7 @@ int Image::addcolor(char *name, double r, double g, double b) if index < 0, return ptr to -index-1 color from userrgb if index = 0, search the 2 lists of color names for the string color search user-defined color names first, then the list of NCOLORS names - return a pointer to the 3 floating point RGB values or NULL if didn't find + return a pointer to the 3 floating point RGB values or nullptr if didn't find ------------------------------------------------------------------------- */ double *Image::color2rgb(const char *color, int index) @@ -1458,11 +1458,11 @@ double *Image::color2rgb(const char *color, int index) }; if (index > 0) { - if (index > NCOLORS) return NULL; + if (index > NCOLORS) return nullptr; return rgb[index-1]; } if (index < 0) { - if (-index > ncolors) return NULL; + if (-index > ncolors) return nullptr; return userrgb[-index-1]; } @@ -1472,7 +1472,7 @@ double *Image::color2rgb(const char *color, int index) for (int i = 0; i < NCOLORS; i++) if (strcmp(color,name[i]) == 0) return rgb[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1620,7 +1620,7 @@ double *Image::element2color(char *element) for (int i = 0; i < NELEMENTS; i++) if (strcmp(element,name[i]) == 0) return rgb[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1791,13 +1791,13 @@ int ColorMap::reset(int narg, char **arg) if (n+1 > narg) return 1; mentry[i].color = image->color2rgb(arg[n]); } else if (expandflag == 1) { - mentry[i].color = image->color2rgb(NULL,i+1); + mentry[i].color = image->color2rgb(nullptr,i+1); } else if (expandflag == 2) { - mentry[i].color = image->color2rgb(NULL,-(i+1)); + mentry[i].color = image->color2rgb(nullptr,-(i+1)); } n += 1; } - if (mentry[i].color == NULL) return 1; + if (mentry[i].color == nullptr) return 1; } if (mstyle == CONTINUOUS) { @@ -1915,5 +1915,5 @@ double *ColorMap::value2color(double value) return mentry[ibin%nentry].color; } - return NULL; + return nullptr; } diff --git a/src/improper.cpp b/src/improper.cpp index ad79a1a972..c657530a40 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -33,10 +33,10 @@ Improper::Improper(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 096e0c3614..474d8c0c5a 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -160,7 +160,7 @@ void ImproperHybrid::allocate() maximproper = new int[nstyles]; improperlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maximproper[m] = 0; - for (int m = 0; m < nstyles; m++) improperlist[m] = NULL; + for (int m = 0; m < nstyles; m++) improperlist[m] = nullptr; } /* ---------------------------------------------------------------------- */ @@ -325,7 +325,7 @@ void ImproperHybrid::write_restart(FILE *fp) void ImproperHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Improper*[nstyles]; keywords = new char*[nstyles]; @@ -334,10 +334,10 @@ void ImproperHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_improper(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/info.cpp b/src/info.cpp index 87161e9ca5..3c0003db0a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -259,10 +259,10 @@ void Info::command(int narg, char **arg) } } - if (out == NULL) return; + if (out == nullptr) return; fputs("\nInfo-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info\n",out); - time_t now = time(NULL); + time_t now = time(nullptr); fmt::print(out,"Printed on {}\n",ctime(&now)); if (flags & CONFIG) { @@ -792,7 +792,7 @@ void Info::command_styles(FILE *out) bool Info::is_active(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; const char *style = "none"; if (strcmp(category,"package") == 0) { @@ -813,7 +813,7 @@ bool Info::is_active(const char *category, const char *name) else error->all(FLERR,"Unknown name for info newton category"); } else if (strcmp(category,"pair") == 0) { - if (force->pair == NULL) return false; + if (force->pair == nullptr) return false; if (strcmp(name,"single") == 0) return (force->pair->single_enable != 0); else if (strcmp(name,"respa") == 0) return (force->pair->respa_enable != 0); else if (strcmp(name,"manybody") == 0) return (force->pair->manybody_flag != 0); @@ -867,7 +867,7 @@ bool Info::is_active(const char *category, const char *name) bool Info::is_available(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (has_style(category, name)) { return true; @@ -897,7 +897,7 @@ bool Info::is_available(const char *category, const char *name) bool Info::is_defined(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (strcmp(category,"compute") == 0) { int ncompute = modify->ncompute; @@ -1137,7 +1137,7 @@ bool Info::has_exceptions() { } bool Info::has_package(const char * package_name) { - for(int i = 0; LAMMPS::installed_packages[i] != NULL; ++i) { + for(int i = 0; LAMMPS::installed_packages[i] != nullptr; ++i) { if(strcmp(package_name, LAMMPS::installed_packages[i]) == 0) { return true; } diff --git a/src/input.cpp b/src/input.cpp index 6456f6c229..5efbdfba3d 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -96,15 +96,15 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) MPI_Comm_rank(world,&me); maxline = maxcopy = maxwork = 0; - line = copy = work = NULL; + line = copy = work = nullptr; narg = maxarg = 0; - arg = NULL; + arg = nullptr; echo_screen = 0; echo_log = 1; label_active = 0; - labelstr = NULL; + labelstr = nullptr; jump_skip = 0; if (me == 0) { @@ -112,7 +112,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) maxfile = 16; infiles = new FILE *[maxfile]; infiles[0] = infile; - } else infiles = NULL; + } else infiles = nullptr; variable = new Variable(lmp); @@ -196,7 +196,7 @@ void Input::file() // end of file reached, so break // n == 0 if nothing read, else n = line with str terminator - if (fgets(&line[m],maxline-m,infile) == NULL) { + if (fgets(&line[m],maxline-m,infile) == nullptr) { if (m) n = strlen(line) + 1; else n = 0; break; @@ -252,7 +252,7 @@ void Input::file() // if no command, skip to next line in input script parse(); - if (command == NULL) continue; + if (command == nullptr) continue; // if scanning for label, skip command unless it's a label command @@ -292,7 +292,7 @@ void Input::file(const char *filename) error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(filename,"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", filename, utils::getsyserror())); @@ -317,7 +317,7 @@ void Input::file(const char *filename) This function takes the text in *single*, makes a copy, parses that, executes the command and returns the name of the command (without the arguments). If there was no command in *single* it will return -``NULL``. +``nullptr``. \endverbatim * @@ -338,14 +338,14 @@ char *Input::one(const std::string &single) } // parse the line - // if no command, just return NULL + // if no command, just return nullptr parse(); - if (command == NULL) return NULL; + if (command == nullptr) return nullptr; // if scanning for label, skip command unless it's a label command - if (label_active && strcmp(command,"label") != 0) return NULL; + if (label_active && strcmp(command,"label") != 0) return nullptr; // execute the command and return its name @@ -423,7 +423,7 @@ void Input::parse() char *next; command = nextword(copy,&next); - if (command == NULL) return; + if (command == nullptr) return; // point arg[] at each subsequent arg in copy string // nextword() inserts string terminators into copy string to delimit args @@ -450,7 +450,7 @@ void Input::parse() treat text between single/double/triple quotes as one arg matching quote must be followed by whitespace char if not end of string strip quotes from returned word - return ptr to start of word or NULL if no word in string + return ptr to start of word or nullptr if no word in string also return next = ptr after word ------------------------------------------------------------------------- */ @@ -461,16 +461,16 @@ char *Input::nextword(char *str, char **next) // start = first non-whitespace char start = &str[strspn(str," \t\n\v\f\r")]; - if (*start == '\0') return NULL; + if (*start == '\0') return nullptr; // if start is single/double/triple quote: // start = first char beyond quote // stop = first char of matching quote // next = first char beyond matching quote - // next must be NULL or whitespace + // next must be nullptr or whitespace // if start is not single/double/triple quote: // stop = first whitespace char after start - // next = char after stop, or stop itself if stop is NULL + // next = char after stop, or stop itself if stop is nullptr if (strstr(start,"\"\"\"") == start) { stop = strstr(&start[3],"\"\"\""); @@ -492,7 +492,7 @@ char *Input::nextword(char *str, char **next) else *next = stop+1; } - // set stop to NULL to terminate word + // set stop to nullptr to terminate word *stop = '\0'; return start; @@ -510,9 +510,9 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // use str2 as scratch space to expand str, then copy back to str // reallocate str and str2 as necessary // do not replace $ inside single/double/triple quotes - // var = pts at variable name, ended by NULL - // if $ is followed by '{', trailing '}' becomes NULL - // else $x becomes x followed by NULL + // var = pts at variable name, ended by nullptr + // if $ is followed by '{', trailing '}' becomes nullptr + // else $x becomes x followed by nullptr // beyond = points to text following variable int i,n,paren_count; @@ -593,7 +593,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) value = variable->retrieve(var); } - if (value == NULL) + if (value == nullptr) error->one(FLERR,fmt::format("Substitution for illegal " "variable {}",var)); @@ -950,7 +950,7 @@ void Input::include() error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -984,7 +984,7 @@ void Input::jump() else { if (infile && infile != stdin) fclose(infile); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -1023,12 +1023,12 @@ void Input::log() if (me == 0) { if (logfile) fclose(logfile); - if (strcmp(arg[0],"none") == 0) logfile = NULL; + if (strcmp(arg[0],"none") == 0) logfile = nullptr; else { if (appendflag) logfile = fopen(arg[0],"a"); else logfile = fopen(arg[0],"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", arg[0], utils::getsyserror())); @@ -1063,8 +1063,8 @@ void Input::partition() strcpy(copy,line); char *ptr = strtok(copy," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ptr += strlen(ptr) + 1; ptr += strspn(ptr," \t\n\r\f"); @@ -1094,7 +1094,7 @@ void Input::print() // parse optional args - FILE *fp = NULL; + FILE *fp = nullptr; int screenflag = 1; int universeflag = 0; @@ -1103,10 +1103,10 @@ void Input::print() if (strcmp(arg[iarg],"file") == 0 || strcmp(arg[iarg],"append") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); if (me == 0) { - if (fp != NULL) fclose(fp); + if (fp != nullptr) fclose(fp); if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open print file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -1237,9 +1237,9 @@ void Input::shell() char *ptr = strdup(arg[i]); rv = 0; #ifdef _WIN32 - if (ptr != NULL) rv = _putenv(ptr); + if (ptr != nullptr) rv = _putenv(ptr); #else - if (ptr != NULL) rv = putenv(ptr); + if (ptr != nullptr) rv = putenv(ptr); #endif rv = (rv < 0) ? errno : 0; MPI_Reduce(&rv,&err,1,MPI_INT,MPI_MAX,0,world); @@ -1291,7 +1291,7 @@ void Input::angle_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Angle_coeff command before simulation box is defined"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle_coeff command before angle_style is defined"); if (atom->avec->angles_allow == 0) error->all(FLERR,"Angle_coeff command when no angles allowed"); @@ -1332,7 +1332,7 @@ void Input::bond_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Bond_coeff command before simulation box is defined"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_coeff command before bond_style is defined"); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_coeff command when no bonds allowed"); @@ -1356,7 +1356,7 @@ void Input::bond_write() { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_write command when no bonds allowed"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_write command before bond_style is defined"); else force->bond->write_file(narg,arg); } @@ -1435,7 +1435,7 @@ void Input::dihedral_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Dihedral_coeff command before simulation box is defined"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Dihedral_coeff command before dihedral_style is defined"); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Dihedral_coeff command when no dihedrals allowed"); @@ -1512,7 +1512,7 @@ void Input::improper_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Improper_coeff command before simulation box is defined"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Improper_coeff command before improper_style is defined"); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Improper_coeff command when no impropers allowed"); @@ -1534,7 +1534,7 @@ void Input::improper_style() void Input::kspace_modify() { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"KSpace style has not yet been set"); force->kspace->modify_params(narg,arg); } @@ -1650,7 +1650,7 @@ void Input::package() modify->add_fix(fixcmd); } else if (strcmp(arg[0],"kokkos") == 0) { - if (lmp->kokkos == NULL || lmp->kokkos->kokkos_exists == 0) + if (lmp->kokkos == nullptr || lmp->kokkos->kokkos_exists == 0) error->all(FLERR, "Package kokkos command without KOKKOS package enabled"); lmp->kokkos->accelerator(narg-1,&arg[1]); @@ -1682,7 +1682,7 @@ void Input::pair_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Pair_coeff command before simulation box is defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command before pair_style is defined"); force->pair->coeff(narg,arg); } @@ -1691,7 +1691,7 @@ void Input::pair_coeff() void Input::pair_modify() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_modify command before pair_style is defined"); force->pair->modify_params(narg,arg); } @@ -1729,7 +1729,7 @@ void Input::pair_style() void Input::pair_write() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_write command before pair_style is defined"); force->pair->write_file(narg,arg); } diff --git a/src/integrate.cpp b/src/integrate.cpp index 1f50ff76c5..720e8ba276 100644 --- a/src/integrate.cpp +++ b/src/integrate.cpp @@ -25,8 +25,8 @@ using namespace LAMMPS_NS; Integrate::Integrate(LAMMPS *lmp, int /*narg*/, char **/*arg*/) : Pointers(lmp) { - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; external_force_clear = 0; } @@ -74,8 +74,8 @@ void Integrate::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/irregular.cpp b/src/irregular.cpp index fbb572fd88..c5ce94e40b 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -52,15 +52,15 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // migrate work vectors maxlocal = 0; - mproclist = NULL; - msizes = NULL; + mproclist = nullptr; + msizes = nullptr; // send buffers maxdbuf = 0; - dbuf = NULL; + dbuf = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; // universal work vectors @@ -70,7 +70,7 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // initialize buffers for migrate atoms, not used for datum comm // these can persist for multiple irregular operations - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; bufextra = BUFEXTRA; grow_send(maxsend,2); diff --git a/src/irregular.h b/src/irregular.h index 01fe40c46b..d601f1586f 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -30,7 +30,7 @@ class Irregular : protected Pointers { Irregular(class LAMMPS *); ~Irregular(); void migrate_atoms(int sortflag = 0, int preassign = 0, - int *procassign = NULL); + int *procassign = nullptr); int migrate_check(); int create_data(int, int *, int sortflag = 0); int create_data_grouped(int, int *, int sortflag = 0); diff --git a/src/kspace.cpp b/src/kspace.cpp index e51cc54c97..117ae5465f 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -86,8 +86,8 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp) splittol = 1.0e-6; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -188,7 +188,7 @@ void KSpace::compute_dummy(int eflag, int vflag) void KSpace::pair_check() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"KSpace solver requires a pair style"); if (ewaldflag && !force->pair->ewaldflag) @@ -610,5 +610,5 @@ void KSpace::modify_params(int narg, char **arg) void *KSpace::extract(const char *str) { if (strcmp(str,"scale") == 0) return (void *) &scale; - return NULL; + return nullptr; } diff --git a/src/lammps.cpp b/src/lammps.cpp index f6952354ba..1d655f6fc4 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -105,22 +105,22 @@ using namespace LAMMPS_NS; * \param communicator MPI communicator used by this LAMMPS instance */ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : - memory(NULL), error(NULL), universe(NULL), input(NULL), atom(NULL), - update(NULL), neighbor(NULL), comm(NULL), domain(NULL), force(NULL), - modify(NULL), group(NULL), output(NULL), timer(NULL), kokkos(NULL), - atomKK(NULL), memoryKK(NULL), python(NULL), citeme(NULL) + memory(nullptr), error(nullptr), universe(nullptr), input(nullptr), atom(nullptr), + update(nullptr), neighbor(nullptr), comm(nullptr), domain(nullptr), force(nullptr), + modify(nullptr), group(nullptr), output(nullptr), timer(nullptr), kokkos(nullptr), + atomKK(nullptr), memoryKK(nullptr), python(nullptr), citeme(nullptr) { memory = new Memory(this); error = new Error(this); universe = new Universe(this,communicator); clientserver = 0; - cslib = NULL; + cslib = nullptr; cscomm = 0; - screen = NULL; - logfile = NULL; - infile = NULL; + screen = nullptr; + logfile = nullptr; + infile = nullptr; initclock = MPI_Wtime(); @@ -170,19 +170,19 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : int citeflag = 1; int helpflag = 0; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 0; if (arg) exename = arg[0]; - else exename = NULL; - packargs = NULL; + else exename = nullptr; + packargs = nullptr; num_package = 0; - char *restartfile = NULL; + char *restartfile = nullptr; int wfirst,wlast; int kkfirst,kklast; int npack = 0; - int *pfirst = NULL; - int *plast = NULL; + int *pfirst = nullptr; + int *plast = nullptr; iarg = 1; while (iarg < narg) { @@ -348,7 +348,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : error->universe_all(FLERR,"Invalid command-line argument"); delete [] suffix; delete [] suffix2; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 1; // hybrid option to set fall-back for suffix2 if (strcmp(arg[iarg+1],"hybrid") == 0) { @@ -380,7 +380,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // if no partition command-line switch, universe is one world with all procs - if (universe->existflag == 0) universe->add_world(NULL); + if (universe->existflag == 0) universe->add_world(nullptr); // sum of procs in all worlds must equal total # of procs @@ -409,10 +409,10 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (screenflag == 0) universe->uscreen = stdout; else if (strcmp(arg[screenflag],"none") == 0) - universe->uscreen = NULL; + universe->uscreen = nullptr; else { universe->uscreen = fopen(arg[screenflag],"w"); - if (universe->uscreen == NULL) + if (universe->uscreen == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe screen " "file {}: {}",arg[screenflag], utils::getsyserror())); @@ -420,15 +420,15 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { if (helpflag == 0) { universe->ulogfile = fopen("log.lammps","w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_warn(FLERR,"Cannot open log.lammps for writing: " + utils::getsyserror()); } } else if (strcmp(arg[logflag],"none") == 0) - universe->ulogfile = NULL; + universe->ulogfile = nullptr; else { universe->ulogfile = fopen(arg[logflag],"w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe log " "file {}: {}",arg[logflag], utils::getsyserror())); @@ -437,8 +437,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me > 0) { if (screenflag == 0) universe->uscreen = stdout; - else universe->uscreen = NULL; - universe->ulogfile = NULL; + else universe->uscreen = nullptr; + universe->ulogfile = nullptr; } // make universe and single world the same, since no partition switch @@ -454,7 +454,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me == 0) { if (inflag == 0) infile = stdin; else infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -472,31 +472,31 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : MPI_Comm_split(universe->uworld,universe->iworld,0,&world); MPI_Comm_rank(world,&me); - screen = logfile = infile = NULL; + screen = logfile = infile = nullptr; if (me == 0) { std::string str; if (partscreenflag == 0) { if (screenflag == 0) { str = fmt::format("screen.{}",universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } else if (strcmp(arg[screenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[screenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", arg[screenflag],utils::getsyserror())); } } else if (strcmp(arg[partscreenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[partscreenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } @@ -505,30 +505,30 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { str = fmt::format("log.lammps.{}",universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } else if (strcmp(arg[logflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[logflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } } else if (strcmp(arg[partlogflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[partlogflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -590,7 +590,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // instantiation creates dummy Kokkos class if KOKKOS is not installed // add args between kkfirst and kklast to Kokkos instantiation - kokkos = NULL; + kokkos = nullptr; if (kokkosflag == 1) { kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]); if (!kokkos->kokkos_exists) @@ -600,7 +600,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // allocate CiteMe class if enabled if (citeflag) citeme = new CiteMe(this); - else citeme = NULL; + else citeme = nullptr; // allocate input class now that MPI is fully setup @@ -616,7 +616,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : packargs[i] = new char*[n+1]; for (int j=0; j < n; ++j) packargs[i][j] = strdup(arg[pfirst[i]+j]); - packargs[i][n] = NULL; + packargs[i][n] = nullptr; } memory->destroy(pfirst); memory->destroy(plast); @@ -668,14 +668,14 @@ LAMMPS::~LAMMPS() if (num_package) { for (int i = 0; i < num_package; i++) { - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) free(*ptr); delete[] packargs[i]; } delete[] packargs; } num_package = 0; - packargs = NULL; + packargs = nullptr; double totalclock = MPI_Wtime() - initclock; if ((me == 0) && (screen || logfile)) { @@ -690,14 +690,14 @@ LAMMPS::~LAMMPS() if (universe->nworlds == 1) { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } else { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); if (universe->ulogfile) fclose(universe->ulogfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } if (infile && infile != stdin) fclose(infile); @@ -733,7 +733,7 @@ LAMMPS::~LAMMPS() void LAMMPS::create() { - force = NULL; // Domain->Lattice checks if Force exists + force = nullptr; // Domain->Lattice checks if Force exists // Comm class must be created before Atom class // so that nthreads is defined when create_avec invokes grow() @@ -755,9 +755,9 @@ void LAMMPS::create() else atom = new Atom(this); if (kokkos) - atom->create_avec("atomic/kk",0,NULL,1); + atom->create_avec("atomic/kk",0,nullptr,1); else - atom->create_avec("atomic",0,NULL,1); + atom->create_avec("atomic",0,nullptr,1); group = new Group(this); force = new Force(this); // must be after group, to create temperature @@ -799,7 +799,7 @@ void LAMMPS::post_create() if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL")) error->all(FLERR,"Using suffix intel without USER-INTEL package installed"); if (strcmp(suffix,"kk") == 0 && - (kokkos == NULL || kokkos->kokkos_exists == 0)) + (kokkos == nullptr || kokkos->kokkos_exists == 0)) error->all(FLERR,"Using suffix kk without KOKKOS package enabled"); if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP")) error->all(FLERR,"Using suffix omp without USER-OMP package installed"); @@ -821,7 +821,7 @@ void LAMMPS::post_create() char str[256]; for (int i = 0; i < num_package; i++) { strcpy(str,"package"); - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) { + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) { if (strlen(str) + strlen(*ptr) + 2 > 256) error->all(FLERR,"Too many -pk arguments in command line"); strcat(str," "); @@ -861,41 +861,41 @@ void LAMMPS::init() void LAMMPS::destroy() { delete update; - update = NULL; + update = nullptr; delete neighbor; - neighbor = NULL; + neighbor = nullptr; delete force; - force = NULL; + force = nullptr; delete group; - group = NULL; + group = nullptr; delete output; - output = NULL; + output = nullptr; delete modify; // modify must come after output, force, update // since they delete fixes - modify = NULL; + modify = nullptr; delete comm; // comm must come after modify // since fix destructors may access comm - comm = NULL; + comm = nullptr; delete domain; // domain must come after modify // since fix destructors access domain - domain = NULL; + domain = nullptr; delete atom; // atom must come after modify, neighbor // since fixes delete callbacks in atom - atom = NULL; + atom = nullptr; delete timer; - timer = NULL; + timer = nullptr; delete python; - python = NULL; + python = nullptr; } /* ---------------------------------------------------------------------- @@ -1011,7 +1011,7 @@ void _noopt LAMMPS::init_pkg_lists() */ bool LAMMPS::is_installed_pkg(const char *pkg) { - for (int i=0; installed_packages[i] != NULL; ++i) + for (int i=0; installed_packages[i] != nullptr; ++i) if (strcmp(installed_packages[i],pkg) == 0) return true; return false; @@ -1053,7 +1053,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) check_for_match(pair,style,name); check_for_match(reader,style,name); check_for_match(region,style,name); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1063,7 +1063,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) void _noopt LAMMPS::help() { FILE *fp = screen; - const char *pager = NULL; + const char *pager = nullptr; // if output is "stdout", use a pipe to a pager for paged output. // this will avoid the most important help text to rush past the @@ -1072,7 +1072,7 @@ void _noopt LAMMPS::help() if (fp == stdout) { pager = getenv("PAGER"); - if (pager == NULL) pager = "more"; + if (pager == nullptr) pager = "more"; #if defined(_WIN32) fp = _popen(pager,"w"); #else @@ -1080,9 +1080,9 @@ void _noopt LAMMPS::help() #endif // reset to original state, if pipe command failed - if (fp == NULL) { + if (fp == nullptr) { fp = stdout; - pager = NULL; + pager = nullptr; } } @@ -1236,7 +1236,7 @@ void _noopt LAMMPS::help() // close pipe to pager, if active - if (pager != NULL) pclose(fp); + if (pager != nullptr) pclose(fp); } /* ---------------------------------------------------------------------- @@ -1309,7 +1309,7 @@ void LAMMPS::print_config(FILE *fp) sizeof(tagint)*8, sizeof(bigint)*8); fputs("\nInstalled packages:\n\n",fp); - for (int i = 0; NULL != (pkg = installed_packages[i]); ++i) { + for (int i = 0; nullptr != (pkg = installed_packages[i]); ++i) { ncword = strlen(pkg); if (ncline + ncword > 78) { ncline = 0; diff --git a/src/lattice.cpp b/src/lattice.cpp index 68f3e7abe1..625e243d64 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) { nbasis = 0; - basis = NULL; + basis = nullptr; // parse style arg @@ -164,7 +164,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) else if (strcmp(arg[iarg+1],"y") == 0) dim = 1; else if (strcmp(arg[iarg+1],"z") == 0) dim = 2; else error->all(FLERR,"Illegal lattice command"); - int *orient = NULL; + int *orient = nullptr; if (dim == 0) orient = orientx; else if (dim == 1) orient = orienty; else if (dim == 2) orient = orientz; diff --git a/src/library.cpp b/src/library.cpp index 0e0c4070ea..2e35457837 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -105,7 +105,7 @@ LAMMPS executable, and an MPI communicator for LAMMPS to run under. Since the list of arguments is **exactly** as when called from the command line, the first argument would be the name of the executable and thus is otherwise ignored. However ``argc`` may be set to 0 and then -``argv`` may be ``NULL``. If MPI is not yet initialized, ``MPI_Init()`` +``argv`` may be ``nullptr``. If MPI is not yet initialized, ``MPI_Init()`` will be called during creation of the LAMMPS class instance. If for some reason the creation or initialization of the LAMMPS instance @@ -117,7 +117,7 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. .. note:: @@ -133,12 +133,12 @@ fails a null pointer is returned. * \param argv list of command line argument strings * \param comm MPI communicator for this LAMMPS instance * \param ptr pointer to a void pointer variable which serves - * as a handle; may be ``NULL`` + * as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) { - LAMMPS *lmp = NULL; + LAMMPS *lmp = nullptr; lammps_mpi_init(); #ifdef LAMMPS_EXCEPTIONS @@ -149,7 +149,7 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) } catch(LAMMPSException & e) { fmt::print(stderr, "LAMMPS Exception: {}", e.message); - *ptr = (void *) NULL; + *ptr = nullptr; } #else lmp = new LAMMPS(argc, argv, comm); @@ -183,14 +183,14 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. \endverbatim * * \param argc number of command line arguments * \param argv list of command line argument strings * \param ptr pointer to a void pointer variable - * which serves as a handle; may be ``NULL`` + * which serves as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) @@ -275,7 +275,7 @@ void lammps_mpi_init() if (!flag) { // provide a dummy argc and argv for MPI_Init(). int argc = 1; - char *args[] = { (char *)"liblammps" , NULL }; + char *args[] = { (char *)"liblammps" , nullptr }; char **argv = args; MPI_Init(&argc,&argv); } @@ -375,19 +375,19 @@ string, however, will be treated as part of the command and will **not** start a second command. The function :cpp:func:`lammps_commands_string` processes a string with multiple command lines. -The function returns the name of the command on success or ``NULL`` when +The function returns the name of the command on success or ``nullptr`` when passing a string without a command. \endverbatim * * \param handle pointer to a previously created LAMMPS instance * \param cmd string with a single LAMMPS command - * \return string with parsed command name or ``NULL`` */ + * \return string with parsed command name or ``nullptr`` */ char *lammps_command(void *handle, const char *cmd) { LAMMPS *lmp = (LAMMPS *) handle; - char *result = NULL; + char *result = nullptr; BEGIN_CAPTURE { @@ -639,7 +639,7 @@ double lammps_get_thermo(void *handle, char *keyword) This function (re-)initializes the simulation box and boundary information and then assign the designated data to the locations in the pointers passed as arguments. Any argument (except the first) may be -a NULL pointer and then will not be assigned. +a nullptr pointer and then will not be assigned. \endverbatim * @@ -1071,7 +1071,7 @@ to be either an ``int`` or an ``int64_t``. This is selected at * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - requested property. NULL if name is not known. */ + requested property. nullptr if name is not known. */ void *lammps_extract_global(void *handle, char *name) { @@ -1134,7 +1134,7 @@ void *lammps_extract_global(void *handle, char *name) if (strcmp(name,"femtosecond") == 0) return (void *) &lmp->force->femtosecond; if (strcmp(name,"qelectron") == 0) return (void *) &lmp->force->qelectron; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1163,7 +1163,7 @@ of the :cpp:func:`Atom::extract() ` function. * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_atom(void *handle, char *name) { @@ -1213,13 +1213,13 @@ X(1),Y(1),Z(1),X(2),Y(2),Z(2),...,X(N),Y(N),Z(N). * * \param handle pointer to a previously created LAMMPS instance * \param n number of atoms, N, to be added to the system - * \param id pointer to N atom IDs; ``NULL`` will generate IDs + * \param id pointer to N atom IDs; ``nullptr`` will generate IDs * \param type pointer to N atom types (required) * \param x pointer to 3N doubles with x-,y-,z- positions of the new atoms (required) * \param v pointer to 3N doubles with x-,y-,z- velocities - of the new atoms (set to 0.0 if ``NULL``) - * \param image pointer to N imageint sets of image flags, or ``NULL`` + of the new atoms (set to 0.0 if ``nullptr``) + * \param image pointer to N imageint sets of image flags, or ``nullptr`` * \param bexpand if 1, atoms outside of shrink-wrap boundaries will still be created and not dropped and the box extended * \return number of atoms created on success; @@ -1267,7 +1267,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, xdata[0] = x[3*i]; xdata[1] = x[3*i+1]; xdata[2] = x[3*i+2]; - imageint * img = image ? image + i : NULL; + imageint * img = image ? image + i : nullptr; tagint tag = id ? id[i] : 0; // create atom only on MPI rank that would own it @@ -1288,7 +1288,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, // if no tags are given explicitly, create new and unique tags - if (id == NULL) atom->tag_extend(); + if (id == nullptr) atom->tag_extend(); // reset box info, if extended when adding atoms. @@ -1332,7 +1332,7 @@ dimensions of the respective data. Since computes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data -correctly. The function returns ``NULL`` if the compute ID is not found +correctly. The function returns ``nullptr`` if the compute ID is not found or the requested data is not available or current. The following table lists the available options. @@ -1420,7 +1420,7 @@ be used after other LAMMPS commands have been issued. * \param type constant indicating type of data (scalar, vector, or array) or size of rows or columns * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_compute(void *handle, char *id, int style, int type) { @@ -1429,18 +1429,18 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) BEGIN_CAPTURE { int icompute = lmp->modify->find_compute(id); - if (icompute < 0) return NULL; + if (icompute < 0) return nullptr; Compute *compute = lmp->modify->compute[icompute]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!compute->scalar_flag) return NULL; + if (!compute->scalar_flag) return nullptr; if (compute->invoked_scalar != lmp->update->ntimestep) compute->compute_scalar(); return (void *) &compute->scalar; } if ((type == LMP_TYPE_VECTOR) || (type == LMP_SIZE_VECTOR)) { - if (!compute->vector_flag) return NULL; + if (!compute->vector_flag) return nullptr; if (compute->invoked_vector != lmp->update->ntimestep) compute->compute_vector(); if (type == LMP_TYPE_VECTOR) @@ -1449,7 +1449,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) return (void *) &compute->size_vector; } if ((type == LMP_TYPE_ARRAY) || (type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!compute->array_flag) return NULL; + if (!compute->array_flag) return nullptr; if (compute->invoked_array != lmp->update->ntimestep) compute->compute_array(); if (type == LMP_TYPE_ARRAY) @@ -1462,7 +1462,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_ATOM) { - if (!compute->peratom_flag) return NULL; + if (!compute->peratom_flag) return nullptr; if (compute->invoked_peratom != lmp->update->ntimestep) compute->compute_peratom(); if (type == LMP_TYPE_VECTOR) return (void *) compute->vector_atom; @@ -1471,7 +1471,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_LOCAL) { - if (!compute->local_flag) return NULL; + if (!compute->local_flag) return nullptr; if (compute->invoked_local != lmp->update->ntimestep) compute->compute_local(); if (type == LMP_TYPE_SCALAR) return (void *) &compute->size_local_rows; /* for backward compatibility */ @@ -1483,7 +1483,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1500,7 +1500,7 @@ Since individual fixes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data correctly. The function -returns ``NULL`` if the fix ID is not found or the requested data is not +returns ``nullptr`` if the fix ID is not found or the requested data is not available. .. note:: @@ -1604,7 +1604,7 @@ been issued. * \param nrow row index (only used for global vectors and arrays) * \param ncol column index (only used for global arrays) * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_fix(void *handle, char *id, int style, int type, int nrow, int ncol) @@ -1614,34 +1614,34 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, BEGIN_CAPTURE { int ifix = lmp->modify->find_fix(id); - if (ifix < 0) return NULL; + if (ifix < 0) return nullptr; Fix *fix = lmp->modify->fix[ifix]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!fix->scalar_flag) return NULL; + if (!fix->scalar_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } if (type == LMP_TYPE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_vector(nrow); return (void *) dptr; } if (type == LMP_TYPE_ARRAY) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } if (type == LMP_SIZE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; return (void *) &fix->size_vector; } if ((type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; if (type == LMP_SIZE_ROWS) return (void *) &fix->size_array_rows; else @@ -1650,14 +1650,14 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } if (style == LMP_STYLE_ATOM) { - if (!fix->peratom_flag) return NULL; + if (!fix->peratom_flag) return nullptr; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_atom; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_atom; if (type == LMP_SIZE_COLS) return (void *) &fix->size_peratom_cols; } if (style == LMP_STYLE_LOCAL) { - if (!fix->local_flag) return NULL; + if (!fix->local_flag) return nullptr; if (type == LMP_TYPE_SCALAR) return (void *) &fix->size_local_rows; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_local; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_local; @@ -1667,7 +1667,7 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1681,9 +1681,9 @@ identified by its name. The variable must be either an *equal*\ -style compatible or an *atom*\ -style variable. Variables of style *internal* are compatible with *equal*\ -style variables and so are *python*\ -style variables, if they return a numeric value. The function returns -``NULL`` when a variable of the provided *name* is not found or of an +``nullptr`` when a variable of the provided *name* is not found or of an incompatible style. The *group* argument is only used for *atom*\ --style variables and ignored otherwise. If set to ``NULL`` when +-style variables and ignored otherwise. If set to ``nullptr`` when extracting data from and *atom*\ -style variable, the group is assumed to be "all". @@ -1697,7 +1697,7 @@ to be "all". .. code-block:: c - double *dptr = (double *) lammps_extract_variable(handle,name,NULL); + double *dptr = (double *) lammps_extract_variable(handle,name,nullptr); double value = *dptr; lammps_free((void *)dptr); @@ -1720,9 +1720,9 @@ values will not be updated, in case the variable is re-evaluated. * * \param handle pointer to a previously created LAMMPS instance * \param name name of the variable - * \param group group-ID for atom style variable or ``NULL`` + * \param group group-ID for atom style variable or ``nullptr`` * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_variable(void *handle, char *name, char *group) { @@ -1731,7 +1731,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) BEGIN_CAPTURE { int ivar = lmp->input->variable->find(name); - if (ivar < 0) return NULL; + if (ivar < 0) return nullptr; if (lmp->input->variable->equalstyle(ivar)) { double *dptr = (double *) malloc(sizeof(double)); @@ -1740,9 +1740,9 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } if (lmp->input->variable->atomstyle(ivar)) { - if (group == NULL) group = (char *)"all"; + if (group == nullptr) group = (char *)"all"; int igroup = lmp->group->find(group); - if (igroup < 0) return NULL; + if (igroup < 0) return nullptr; int nlocal = lmp->atom->nlocal; double *vector = (double *) malloc(nlocal*sizeof(double)); lmp->input->variable->compute_atom(ivar,igroup,vector,1,0); @@ -1751,7 +1751,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1845,7 +1845,7 @@ void lammps_gather_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -1855,8 +1855,8 @@ void lammps_gather_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -1894,8 +1894,8 @@ void lammps_gather_atoms(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -1985,7 +1985,7 @@ void lammps_gather_atoms_concat(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -1999,8 +1999,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2050,8 +2050,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2145,7 +2145,7 @@ void lammps_gather_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms_subset: " "unknown property name"); return; @@ -2156,8 +2156,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2203,8 +2203,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2296,7 +2296,7 @@ void lammps_scatter_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms: unknown property name"); return; @@ -2307,8 +2307,8 @@ void lammps_scatter_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2340,8 +2340,8 @@ void lammps_scatter_atoms(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2424,7 +2424,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms_subset: unknown property name"); return; @@ -2435,8 +2435,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2474,8 +2474,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2565,7 +2565,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2596,7 +2596,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2624,7 +2624,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2645,7 +2645,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather: unknown property name"); return; } @@ -2654,8 +2654,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) // use atom ID to insert each atom's values into copy // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type==0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); @@ -2695,8 +2695,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2786,7 +2786,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2818,7 +2818,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2846,7 +2846,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2869,7 +2869,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_concat: unknown property name"); return; } @@ -2883,8 +2883,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2934,8 +2934,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3031,7 +3031,7 @@ void lammps_gather_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3063,7 +3063,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3091,7 +3091,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3114,7 +3114,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_subset: " "unknown property name"); return; @@ -3125,8 +3125,8 @@ void lammps_gather_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -3172,8 +3172,8 @@ void lammps_gather_subset(void *ptr, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3273,7 +3273,7 @@ void lammps_scatter(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3298,7 +3298,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3326,7 +3326,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3346,7 +3346,7 @@ void lammps_scatter(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter: unknown property name"); return; } @@ -3356,8 +3356,8 @@ void lammps_scatter(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3389,8 +3389,8 @@ void lammps_scatter(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3475,7 +3475,7 @@ void lammps_scatter_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3500,7 +3500,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3528,7 +3528,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3551,7 +3551,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: " "unknown property name"); return; @@ -3562,8 +3562,8 @@ void lammps_scatter_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3601,8 +3601,8 @@ void lammps_scatter_subset(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3741,7 +3741,7 @@ included in the LAMMPS library in use. */ int lammps_config_package_count() { int i = 0; - while(LAMMPS::installed_packages[i] != NULL) { + while(LAMMPS::installed_packages[i] != nullptr) { ++i; } return i; @@ -3987,7 +3987,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, LAMMPS * lmp = (LAMMPS *) handle; Pair* pair = lmp->force->pair_match(style, exact, nsub); - if (pair != NULL) { + if (pair != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4013,7 +4013,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, */ int lammps_find_fix_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Fix* fix = NULL; + Fix* fix = nullptr; const int nfix = lmp->modify->nfix; // find fix with name @@ -4024,7 +4024,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { } } - if (fix != NULL) { + if (fix != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4050,7 +4050,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { */ int lammps_find_compute_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Compute* compute = NULL; + Compute* compute = nullptr; const int ncompute = lmp->modify->ncompute; // find compute with name @@ -4061,7 +4061,7 @@ int lammps_find_compute_neighlist(void* handle, char * id, int request) { } } - if (compute == NULL) { + if (compute == nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4108,14 +4108,14 @@ int lammps_neighlist_num_elements(void * handle, int idx) { invalid idx or element value * \param[out] numneigh number of neighbors of atom iatom or 0 * \param[out] neighbors pointer to array of neighbor atom local indices or - * NULL + * nullptr */ void lammps_neighlist_element_neighbors(void * handle, int idx, int element, int * iatom, int * numneigh, int ** neighbors) { LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; - *neighbors = NULL; + *neighbors = nullptr; if(idx < 0 || idx >= neighbor->nlist) { return; diff --git a/src/lmppython.cpp b/src/lmppython.cpp index 67bbca15b6..080a22cb60 100644 --- a/src/lmppython.cpp +++ b/src/lmppython.cpp @@ -26,7 +26,7 @@ Python::Python(LAMMPS *lmp) : Pointers(lmp) { // implementation of Python interface is only loaded on demand // and only if PYTHON package has been installed and compiled into binary - impl = NULL; + impl = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/memory.cpp b/src/memory.cpp index bbbc233bbf..f0d8976ad1 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -45,7 +45,7 @@ Memory::Memory(LAMMPS *lmp) : Pointers(lmp) {} void *Memory::smalloc(bigint nbytes, const char *name) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; #if defined(LAMMPS_MEMALIGN) void *ptr; @@ -54,13 +54,13 @@ void *Memory::smalloc(bigint nbytes, const char *name) ptr = scalable_aligned_malloc(nbytes, LAMMPS_MEMALIGN); #else int retval = posix_memalign(&ptr, LAMMPS_MEMALIGN, nbytes); - if (retval) ptr = NULL; + if (retval) ptr = nullptr; #endif #else void *ptr = malloc(nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to allocate {} bytes for array {}", nbytes,name)); return ptr; @@ -74,7 +74,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) { if (nbytes == 0) { destroy(ptr); - return NULL; + return nullptr; } #if defined(LMP_USE_TBB_ALLOCATOR) @@ -99,7 +99,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) #else ptr = realloc(ptr,nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to reallocate {} bytes for array {}", nbytes,name)); return ptr; @@ -111,7 +111,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) void Memory::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; #if defined(LMP_USE_TBB_ALLOCATOR) scalable_aligned_free(ptr); #else diff --git a/src/memory.h b/src/memory.h index 42c9bf6aba..1fc82c990a 100644 --- a/src/memory.h +++ b/src/memory.h @@ -50,7 +50,7 @@ class Memory : protected Pointers { template TYPE **create(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1d array @@ -59,7 +59,7 @@ class Memory : protected Pointers { template TYPE *grow(TYPE *&array, int n, const char *name) { - if (array == NULL) return create(array,n,name); + if (array == nullptr) return create(array,n,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n; array = (TYPE *) srealloc(array,nbytes,name); @@ -68,7 +68,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array @@ -77,7 +77,7 @@ class Memory : protected Pointers { template void destroy(TYPE *&array) { sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -96,7 +96,7 @@ class Memory : protected Pointers { template TYPE **create1d_offset(TYPE **& /*array*/, int /*nlo*/, int /*nhi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array with index offset @@ -106,7 +106,7 @@ class Memory : protected Pointers { void destroy1d_offset(TYPE *&array, int offset) { if (array) sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -131,7 +131,7 @@ class Memory : protected Pointers { template TYPE ***create(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array @@ -141,7 +141,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **&array, int n1, int n2, const char *name) { - if (array == NULL) return create(array,n1,n2,name); + if (array == nullptr) return create(array,n1,n2,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); @@ -158,7 +158,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array @@ -167,10 +167,10 @@ class Memory : protected Pointers { template void destroy(TYPE **&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ class Memory : protected Pointers { template TYPE ***create_ragged(TYPE ***& /*array*/, int /*n1*/, int * /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive @@ -217,7 +217,7 @@ class Memory : protected Pointers { template TYPE ***create2d_offset(TYPE ***& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, - const char *name) {fail(name); return NULL;} + const char *name) {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset @@ -226,10 +226,10 @@ class Memory : protected Pointers { template void destroy2d_offset(TYPE **&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ class Memory : protected Pointers { template TYPE ****create(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array @@ -272,7 +272,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) { - if (array == NULL) return create(array,n1,n2,n3,name); + if (array == nullptr) return create(array,n1,n2,n3,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); @@ -297,7 +297,7 @@ class Memory : protected Pointers { template TYPE ****grow(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 3d array @@ -306,11 +306,11 @@ class Memory : protected Pointers { template void destroy(TYPE ***&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -331,7 +331,7 @@ class Memory : protected Pointers { template TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with 1st index offset @@ -340,11 +340,11 @@ class Memory : protected Pointers { template void destroy3d_offset(TYPE ***&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[offset][0][0]); sfree(&array[offset][0]); sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -376,7 +376,7 @@ class Memory : protected Pointers { TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset @@ -386,11 +386,11 @@ class Memory : protected Pointers { void destroy3d_offset(TYPE ***&array, int n1_offset, int n2_offset, int n3_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[n1_offset][n2_offset][n3_offset]); sfree(&array[n1_offset][n2_offset]); sfree(&array[n1_offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -433,7 +433,7 @@ class Memory : protected Pointers { template TYPE *****create(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 4d array @@ -444,7 +444,7 @@ class Memory : protected Pointers { TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4, const char *name) { - if (array == NULL) return create(array, n1, n2, n3, n4, name); + if (array == nullptr) return create(array, n1, n2, n3, n4, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name); @@ -479,7 +479,7 @@ class Memory : protected Pointers { TYPE *****grow(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) { - fail(name); return NULL; + fail(name); return nullptr; } /* ---------------------------------------------------------------------- @@ -489,12 +489,12 @@ class Memory : protected Pointers { template void destroy(TYPE ****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -527,7 +527,7 @@ class Memory : protected Pointers { TYPE ****create4d_offset(TYPE *****& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4lo*/, int /*n4hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 4d array with indices 2,3, and 4 offset @@ -537,12 +537,12 @@ class Memory : protected Pointers { void destroy4d_offset(TYPE ****&array, int n2_offset, int n3_offset, int n4_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][n2_offset][n3_offset][n4_offset]); sfree(&array[0][n2_offset][n3_offset]); sfree(&array[0][n2_offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ class Memory : protected Pointers { template TYPE ******create(TYPE ******& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, int /*n5*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 5d array @@ -603,13 +603,13 @@ class Memory : protected Pointers { template void destroy(TYPE *****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0][0]); sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/min.cpp b/src/min.cpp index 6bcb4b4e2e..ea07820e53 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -71,17 +71,17 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) delaystep_start_flag = 1; max_vdotf_negatif = 2000; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nextra_global = 0; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; external_force_clear = 0; @@ -128,7 +128,7 @@ void Min::init() nextra_global = 0; delete [] fextra; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; memory->sfree(xextra_atom); @@ -137,10 +137,10 @@ void Min::init() memory->destroy(extra_nlen); memory->destroy(extra_max); memory->sfree(requestor); - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; // virial_style: // 1 if computed explicitly by pair->compute via sum over pair interactions @@ -760,8 +760,8 @@ void Min::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index 909f0b0689..54b1ee6361 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -81,11 +81,11 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) searchflag = 1; for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; - _fpPrint = NULL; + _fpPrint = nullptr; return; } @@ -97,10 +97,10 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) MinHFTN::~MinHFTN (void) { for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; return; @@ -118,14 +118,14 @@ void MinHFTN::init() error->all(FLERR,"Incorrect min_modify option"); for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; } for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; } return; @@ -1618,7 +1618,7 @@ void MinHFTN::open_hftn_print_file_(void) char szTmp[50]; sprintf (szTmp, "progress_MinHFTN_%d.txt", nMyRank); _fpPrint = fopen (szTmp, "w"); - if (_fpPrint == NULL) { + if (_fpPrint == nullptr) { printf ("*** MinHFTN cannot open file '%s'\n", szTmp); printf ("*** continuing...\n"); return; @@ -1655,7 +1655,7 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, const char sFormatR[] = "r %4d %5d %14.8f %11.5e %3s %9.3e %8.2e %10.3e %10.3e\n"; - if (_fpPrint == NULL) + if (_fpPrint == nullptr) return; char sStepType[4]; @@ -1701,6 +1701,6 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, void MinHFTN::close_hftn_print_file_(void) { - if (_fpPrint != NULL) fclose (_fpPrint); + if (_fpPrint != nullptr) fclose (_fpPrint); return; } diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 7226f61614..4ae8873129 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -54,8 +54,8 @@ using namespace LAMMPS_NS; MinLineSearch::MinLineSearch(LAMMPS *lmp) : Min(lmp) { searchflag = 1; - gextra = hextra = NULL; - x0extra_atom = gextra_atom = hextra_atom = NULL; + gextra = hextra = nullptr; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ @@ -81,12 +81,12 @@ void MinLineSearch::init() delete [] gextra; delete [] hextra; - gextra = hextra = NULL; + gextra = hextra = nullptr; delete [] x0extra_atom; delete [] gextra_atom; delete [] hextra_atom; - x0extra_atom = gextra_atom = hextra_atom = NULL; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index c88d52b623..a908cfc7af 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -54,34 +54,34 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) n_min_post_force = n_min_energy = 0; n_timeflag = -1; - fix = NULL; - fmask = NULL; - list_initial_integrate = list_post_integrate = NULL; - list_pre_exchange = list_pre_neighbor = list_post_neighbor = NULL; - list_pre_force = list_pre_reverse = list_post_force = NULL; - list_final_integrate = list_end_of_step = NULL; - list_thermo_energy = list_thermo_energy_atom = NULL; - list_initial_integrate_respa = list_post_integrate_respa = NULL; - list_pre_force_respa = list_post_force_respa = NULL; - list_final_integrate_respa = NULL; - list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = NULL; - list_min_pre_force = list_min_pre_reverse = list_min_post_force = NULL; - list_min_energy = NULL; - - end_of_step_every = NULL; - - list_timeflag = NULL; + fix = nullptr; + fmask = nullptr; + list_initial_integrate = list_post_integrate = nullptr; + list_pre_exchange = list_pre_neighbor = list_post_neighbor = nullptr; + list_pre_force = list_pre_reverse = list_post_force = nullptr; + list_final_integrate = list_end_of_step = nullptr; + list_thermo_energy = list_thermo_energy_atom = nullptr; + list_initial_integrate_respa = list_post_integrate_respa = nullptr; + list_pre_force_respa = list_post_force_respa = nullptr; + list_final_integrate_respa = nullptr; + list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = nullptr; + list_min_pre_force = list_min_pre_reverse = list_min_post_force = nullptr; + list_min_energy = nullptr; + + end_of_step_every = nullptr; + + list_timeflag = nullptr; nfix_restart_global = 0; - id_restart_global = style_restart_global = NULL; - state_restart_global = NULL; - used_restart_global = NULL; + id_restart_global = style_restart_global = nullptr; + state_restart_global = nullptr; + used_restart_global = nullptr; nfix_restart_peratom = 0; - id_restart_peratom = style_restart_peratom = NULL; - index_restart_peratom = used_restart_peratom = NULL; + id_restart_peratom = style_restart_peratom = nullptr; + index_restart_peratom = used_restart_peratom = nullptr; ncompute = maxcompute = 0; - compute = NULL; + compute = nullptr; create_factories(); } @@ -795,17 +795,17 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // but can't think of better way // too late if instantiate fix, then check flag set in fix constructor, // since some fixes access domain settings in their constructor - // NULL must be last entry in this list + // nullptr must be last entry in this list const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx", - "deprecated", "STORE/KIM", NULL}; + "deprecated", "STORE/KIM", nullptr}; if (domain->box_exist == 0) { int m; - for (m = 0; exceptions[m] != NULL; m++) + for (m = 0; exceptions[m] != nullptr; m++) if (strcmp(arg[2],exceptions[m]) == 0) break; - if (exceptions[m] == NULL) + if (exceptions[m] == nullptr) error->all(FLERR,"Fix command before simulation box is defined"); } @@ -821,7 +821,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // warn if new group != old group // delete old fix, but do not call update_callback(), // since will replace this fix and thus other fix locs will not change - // set ptr to NULL in case new fix scans list of fixes, + // set ptr to nullptr in case new fix scans list of fixes, // e.g. scan will occur in add_callback() if called by new fix // if fix ID does not exist: // set newflag = 1 so create new fix @@ -852,7 +852,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) if (fix[ifix]->igroup != igroup && comm->me == 0) error->warning(FLERR,"Replacing a fix, but new group != old group"); delete fix[ifix]; - fix[ifix] = NULL; + fix[ifix] = nullptr; } else { newflag = 1; @@ -866,7 +866,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // create the Fix // try first with suffix appended - fix[ifix] = NULL; + fix[ifix] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -879,7 +879,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) strcpy(fix[ifix]->style,estyle.c_str()); } } - if (fix[ifix] == NULL && lmp->suffix2) { + if (fix[ifix] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; @@ -891,12 +891,12 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) } } - if (fix[ifix] == NULL && fix_map->find(arg[2]) != fix_map->end()) { + if (fix[ifix] == nullptr && fix_map->find(arg[2]) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[arg[2]]; fix[ifix] = fix_creator(lmp,narg,arg); } - if (fix[ifix] == NULL) + if (fix[ifix] == nullptr) error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp)); // check if Fix is in restart_global list @@ -1105,7 +1105,7 @@ int Modify::check_rigid_group_overlap(int groupbit) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0)) ++n; @@ -1137,7 +1137,7 @@ int Modify::check_rigid_region_overlap(int groupbit, Region *reg) for (int ifix = 0; ifix < nfix; ifix++) { if (strncmp("rigid",fix[ifix]->style,5) == 0) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0) @@ -1167,7 +1167,7 @@ int Modify::check_rigid_list_overlap(int *select) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((body[i] >= 0) && select[i]) ++n; @@ -1206,7 +1206,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) // create the Compute // try first with suffix appended - compute[ncompute] = NULL; + compute[ncompute] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -1219,7 +1219,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) strcpy(compute[ncompute]->style,estyle.c_str()); } } - if (compute[ncompute] == NULL && lmp->suffix2) { + if (compute[ncompute] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (compute_map->find(estyle) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[estyle]; @@ -1231,13 +1231,13 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) } } - if (compute[ncompute] == NULL && + if (compute[ncompute] == nullptr && compute_map->find(arg[2]) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[arg[2]]; compute[ncompute] = compute_creator(lmp,narg,arg); } - if (compute[ncompute] == NULL) + if (compute[ncompute] == nullptr) error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp)); ncompute++; @@ -1428,7 +1428,7 @@ int Modify::read_restart(FILE *fp) // nfix_restart_global = # of restart entries with global state info int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_global,1,MPI_INT,0,world); // allocate space for each entry @@ -1445,22 +1445,22 @@ int Modify::read_restart(FILE *fp) int n; for (int i = 0; i < nfix_restart_global; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); state_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(state_restart_global[i],n,MPI_CHAR,0,world); used_restart_global[i] = 0; @@ -1470,7 +1470,7 @@ int Modify::read_restart(FILE *fp) int maxsize = 0; - if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_peratom,1,MPI_INT,0,world); // allocate space for each entry @@ -1487,19 +1487,19 @@ int Modify::read_restart(FILE *fp) // set index = which set of extra data this fix represents for (int i = 0; i < nfix_restart_peratom; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); maxsize += n; diff --git a/src/molecule.cpp b/src/molecule.cpp index 0d81f49a50..6957dbdc05 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -39,16 +39,16 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : - Pointers(lmp), id(NULL), x(NULL), type(NULL), molecule(NULL), q(NULL), radius(NULL), - rmass(NULL), num_bond(NULL), bond_type(NULL), bond_atom(NULL), - num_angle(NULL), angle_type(NULL), angle_atom1(NULL), angle_atom2(NULL), - angle_atom3(NULL), num_dihedral(NULL), dihedral_type(NULL), dihedral_atom1(NULL), - dihedral_atom2(NULL), dihedral_atom3(NULL), dihedral_atom4(NULL), num_improper(NULL), - improper_type(NULL), improper_atom1(NULL), improper_atom2(NULL), - improper_atom3(NULL), improper_atom4(NULL), nspecial(NULL), special(NULL), - shake_flag(NULL), shake_atom(NULL), shake_type(NULL), avec_body(NULL), ibodyparams(NULL), - dbodyparams(NULL), fragmentmask(NULL), - dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL), fp(NULL), count(NULL) + Pointers(lmp), id(nullptr), x(nullptr), type(nullptr), molecule(nullptr), q(nullptr), radius(nullptr), + rmass(nullptr), num_bond(nullptr), bond_type(nullptr), bond_atom(nullptr), + num_angle(nullptr), angle_type(nullptr), angle_atom1(nullptr), angle_atom2(nullptr), + angle_atom3(nullptr), num_dihedral(nullptr), dihedral_type(nullptr), dihedral_atom1(nullptr), + dihedral_atom2(nullptr), dihedral_atom3(nullptr), dihedral_atom4(nullptr), num_improper(nullptr), + improper_type(nullptr), improper_atom1(nullptr), improper_atom2(nullptr), + improper_atom3(nullptr), improper_atom4(nullptr), nspecial(nullptr), special(nullptr), + shake_flag(nullptr), shake_atom(nullptr), shake_type(nullptr), avec_body(nullptr), ibodyparams(nullptr), + dbodyparams(nullptr), fragmentmask(nullptr), + dx(nullptr), dxcom(nullptr), dxbody(nullptr), quat_external(nullptr), fp(nullptr), count(nullptr) { me = comm->me; @@ -406,7 +406,7 @@ void Molecule::read(int flag) if (me == 0) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of molecule file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of molecule file"); } // read header lines @@ -511,7 +511,7 @@ void Molecule::read(int flag) // count = vector for tallying bonds,angles,etc per atom if (flag == 0) memory->create(count,natoms,"molecule:count"); - else count = NULL; + else count = nullptr; // grab keyword and skip next line @@ -1703,41 +1703,41 @@ void Molecule::initialize() centerflag = massflag = comflag = inertiaflag = 0; tag_require = 0; - x = NULL; - type = NULL; - q = NULL; - radius = NULL; - rmass = NULL; + x = nullptr; + type = nullptr; + q = nullptr; + radius = nullptr; + rmass = nullptr; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; - ibodyparams = NULL; - dbodyparams = NULL; + ibodyparams = nullptr; + dbodyparams = nullptr; - dx = NULL; - dxcom = NULL; - dxbody = NULL; + dx = nullptr; + dxcom = nullptr; + dxbody = nullptr; } /* ---------------------------------------------------------------------- @@ -1901,7 +1901,7 @@ void Molecule::deallocate() void Molecule::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open molecule file {}: {}", file, utils::getsyserror())); } @@ -1914,7 +1914,7 @@ void Molecule::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1937,11 +1937,11 @@ void Molecule::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return diff --git a/src/my_page.cpp b/src/my_page.cpp index 95dd56fecd..2416c7e76b 100644 --- a/src/my_page.cpp +++ b/src/my_page.cpp @@ -113,7 +113,7 @@ template T *MyPage::get(int n) { if (n > maxchunk) { errorflag = 1; - return NULL; + return nullptr; } ndatum += n; nchunk++; @@ -129,7 +129,7 @@ T *MyPage::get(int n) { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = n; diff --git a/src/my_page.h b/src/my_page.h index 4beb397ae2..0e4375ed7f 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -53,7 +53,7 @@ class MyPage { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = 0; diff --git a/src/nbin.cpp b/src/nbin.cpp index 1092311f6a..d3211cd629 100644 --- a/src/nbin.cpp +++ b/src/nbin.cpp @@ -27,9 +27,9 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp) { last_bin = -1; mbins = maxbin = maxatom = 0; - binhead = NULL; - bins = NULL; - atom2bin = NULL; + binhead = nullptr; + bins = nullptr; + atom2bin = nullptr; neighbor->last_setup_bins = -1; diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index c01f8ca595..fae1a2941f 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -33,9 +33,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) maxatom = 0; inum = gnum = 0; - ilist = NULL; - numneigh = NULL; - firstneigh = NULL; + ilist = nullptr; + numneigh = nullptr; + firstneigh = nullptr; // defaults, but may be reset by post_constructor() @@ -51,31 +51,31 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // ptrs - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; - listcopy = NULL; - listskip = NULL; - listfull = NULL; + listcopy = nullptr; + listskip = nullptr; + listfull = nullptr; - fix_bond = NULL; + fix_bond = nullptr; - ipage = NULL; + ipage = nullptr; // extra rRESPA lists inum_inner = gnum_inner = 0; - ilist_inner = NULL; - numneigh_inner = NULL; - firstneigh_inner = NULL; + ilist_inner = nullptr; + numneigh_inner = nullptr; + firstneigh_inner = nullptr; inum_middle = gnum_middle = 0; - ilist_middle = NULL; - numneigh_middle = NULL; - firstneigh_middle = NULL; + ilist_middle = nullptr; + numneigh_middle = nullptr; + firstneigh_middle = nullptr; - ipage_inner = NULL; - ipage_middle = NULL; + ipage_inner = nullptr; + ipage_middle = nullptr; // Kokkos package @@ -85,9 +85,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // USER-DPD package - np = NULL; + np = nullptr; - requestor = NULL; + requestor = nullptr; requestor_type = NeighList::NONE; } diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 006ff5e87b..f4c7e7e0bf 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -71,12 +71,12 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) // skip info, default is no skipping skip = 0; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; // only set when command = 1; - command_style = NULL; + command_style = nullptr; // info set by Neighbor class when morphing original requests @@ -217,8 +217,8 @@ void NeighRequest::copy_request(NeighRequest *other, int skipflag) cut = other->cut; cutoff = other->cutoff; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; if (!skipflag) return; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 66ab92496a..26e7d6b74b 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -76,7 +76,7 @@ static const char cite_neigh_multi[] = /* ---------------------------------------------------------------------- */ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp), -pairclass(NULL), pairnames(NULL), pairmasks(NULL) +pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -95,62 +95,62 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) ago = -1; cutneighmax = 0.0; - cutneighsq = NULL; - cutneighghostsq = NULL; - cuttype = NULL; - cuttypesq = NULL; - fixchecklist = NULL; + cutneighsq = nullptr; + cutneighghostsq = nullptr; + cuttype = nullptr; + cuttypesq = nullptr; + fixchecklist = nullptr; // pairwise neighbor lists and associated data structs nlist = 0; - lists = NULL; + lists = nullptr; nbin = 0; - neigh_bin = NULL; + neigh_bin = nullptr; nstencil = 0; - neigh_stencil = NULL; + neigh_stencil = nullptr; - neigh_pair = NULL; + neigh_pair = nullptr; nstencil_perpetual = 0; - slist = NULL; + slist = nullptr; npair_perpetual = 0; - plist = NULL; + plist = nullptr; nrequest = maxrequest = 0; - requests = NULL; + requests = nullptr; old_nrequest = 0; - old_requests = NULL; + old_requests = nullptr; old_style = style; old_triclinic = 0; old_pgsize = pgsize; old_oneatom = oneatom; - binclass = NULL; - binnames = NULL; - binmasks = NULL; - stencilclass = NULL; - stencilnames = NULL; - stencilmasks = NULL; + binclass = nullptr; + binnames = nullptr; + binmasks = nullptr; + stencilclass = nullptr; + stencilnames = nullptr; + stencilmasks = nullptr; // topology lists bondwhich = anglewhich = dihedralwhich = improperwhich = NONE; - neigh_bond = NULL; - neigh_angle = NULL; - neigh_dihedral = NULL; - neigh_improper = NULL; + neigh_bond = nullptr; + neigh_angle = nullptr; + neigh_dihedral = nullptr; + neigh_improper = nullptr; // coords at last neighboring maxhold = 0; - xhold = NULL; + xhold = nullptr; lastcall = -1; last_setup_bins = -1; @@ -159,14 +159,14 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) includegroup = 0; nex_type = maxex_type = 0; - ex1_type = ex2_type = NULL; - ex_type = NULL; + ex1_type = ex2_type = nullptr; + ex_type = nullptr; nex_group = maxex_group = 0; - ex1_group = ex2_group = ex1_bit = ex2_bit = NULL; + ex1_group = ex2_group = ex1_bit = ex2_bit = nullptr; nex_mol = maxex_mol = 0; - ex_mol_group = ex_mol_bit = ex_mol_intra = NULL; + ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr; // Kokkos setting @@ -270,7 +270,7 @@ void Neighbor::init() // set neighbor cutoffs (force cutoff + skin) // trigger determines when atoms migrate and neighbor lists are rebuilt // needs to be non-zero for migration distance check - // even if pair = NULL and no neighbor lists are used + // even if pair = nullptr and no neighbor lists are used // cutneigh = force cutoff + skin if cutforce > 0, else cutneigh = 0 // cutneighghost = pair cutghost if it requests it, else same as cutneigh @@ -281,7 +281,7 @@ void Neighbor::init() boxcheck = 1; n = atom->ntypes; - if (cutneighsq == NULL) { + if (cutneighsq == nullptr) { if (lmp->kokkos) init_cutneighsq_kokkos(n); else memory->create(cutneighsq,n+1,n+1,"neigh:cutneighsq"); memory->create(cutneighghostsq,n+1,n+1,"neigh:cutneighghostsq"); @@ -338,7 +338,7 @@ void Neighbor::init() if (output->restart_flag) restart_check = 1; delete [] fixchecklist; - fixchecklist = NULL; + fixchecklist = nullptr; fixchecklist = new int[modify->nfix]; fix_check = 0; @@ -378,7 +378,7 @@ void Neighbor::init() // We cannot remove special neighbors with kspace or kspace-like pair styles // as the exclusion needs to remove the full coulomb and not the damped interaction. // Special treatment is required for hybrid pair styles since Force::pair_match() - // will only return a non-NULL pointer if there is only one substyle of the kind. + // will only return a non-nullptr pointer if there is only one substyle of the kind. if (force->kspace) { special_flag[1] = special_flag[2] = special_flag[3] = 2; @@ -410,7 +410,7 @@ void Neighbor::init() if (dist_check == 0) { memory->destroy(xhold); maxhold = 0; - xhold = NULL; + xhold = nullptr; } // first time allocation @@ -515,7 +515,7 @@ void Neighbor::init() for (int i = 0; i < nrequest; i++) { delete requests[i]; - requests[i] = NULL; + requests[i] = nullptr; } nrequest = 0; @@ -809,7 +809,7 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_stencil[nstencil]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_stencil[nstencil]->nb == NULL) + if (neigh_stencil[nstencil]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor stencil"); } @@ -823,7 +823,7 @@ int Neighbor::init_pair() requests[i]->index_pair = -1; flag = lists[i]->pair_method; if (flag == 0) { - neigh_pair[i] = NULL; + neigh_pair[i] = nullptr; continue; } @@ -834,12 +834,12 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_pair[i]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_pair[i]->nb == NULL) + if (neigh_pair[i]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor pair"); } if (lists[i]->stencil_method > 0) { neigh_pair[i]->ns = neigh_stencil[requests[i]->index_stencil]; - if (neigh_pair[i]->ns == NULL) + if (neigh_pair[i]->ns == nullptr) error->all(FLERR,"Could not assign stencil method to neighbor pair"); } @@ -905,11 +905,11 @@ int Neighbor::init_pair() done = 1; for (i = 0; i < npair_perpetual; i++) { for (k = 0; k < 3; k++) { - ptr = NULL; + ptr = nullptr; if (k == 0) ptr = lists[plist[i]]->listcopy; if (k == 1) ptr = lists[plist[i]]->listskip; if (k == 2) ptr = lists[plist[i]]->listfull; - if (ptr == NULL) continue; + if (ptr == nullptr) continue; for (m = 0; m < nrequest; m++) if (ptr == lists[m]) break; for (j = 0; j < npair_perpetual; j++) @@ -1575,17 +1575,17 @@ void Neighbor::requests_new2old() /* ---------------------------------------------------------------------- find and return request made by classptr - if not found or classpt = NULL, return NULL + if not found or classpt = nullptr, return nullptr ------------------------------------------------------------------------- */ NeighRequest *Neighbor::find_request(void *classptr) { - if (classptr == NULL) return NULL; + if (classptr == nullptr) return nullptr; for (int i = 0; i < nrequest; i++) if (requests[i]->requestor == classptr) return requests[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -2138,7 +2138,7 @@ void Neighbor::build_one(class NeighList *mylist, int preflag) { // check if list structure is initialized - if (mylist == NULL) + if (mylist == nullptr) error->all(FLERR,"Trying to build an occasional neighbor list " "before initialization completed"); @@ -2283,7 +2283,7 @@ void Neighbor::modify_params(int narg, char **arg) includegroup = group->find(arg[iarg+1]); if (includegroup < 0) error->all(FLERR,"Invalid group ID in neigh_modify command"); - if (includegroup && (atom->firstgroupname == NULL || + if (includegroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR, "Neigh_modify include group != atom_modify first group"); diff --git a/src/npair.cpp b/src/npair.cpp index b63135fad6..698ff28067 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -27,10 +27,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NPair::NPair(LAMMPS *lmp) - : Pointers(lmp), nb(NULL), ns(NULL), bins(NULL), stencil(NULL) + : Pointers(lmp), nb(nullptr), ns(nullptr), bins(nullptr), stencil(nullptr) { last_build = -1; - mycutneighsq = NULL; + mycutneighsq = nullptr; molecular = atom->molecular; copymode = 0; execution_space = Host; diff --git a/src/nstencil.cpp b/src/nstencil.cpp index 431906e898..aae6c9b1d2 100644 --- a/src/nstencil.cpp +++ b/src/nstencil.cpp @@ -59,11 +59,11 @@ NStencil::NStencil(LAMMPS *lmp) : Pointers(lmp) xyzflag = 0; maxstencil = maxstencil_multi = 0; - stencil = NULL; - stencilxyz = NULL; - nstencil_multi = NULL; - stencil_multi = NULL; - distsq_multi = NULL; + stencil = nullptr; + stencilxyz = nullptr; + nstencil_multi = nullptr; + stencil_multi = nullptr; + distsq_multi = nullptr; dimension = domain->dimension; } @@ -179,8 +179,8 @@ void NStencil::create_setup() distsq_multi = new double*[n+1]; for (i = 1; i <= n; i++) { nstencil_multi[i] = 0; - stencil_multi[i] = NULL; - distsq_multi[i] = NULL; + stencil_multi[i] = nullptr; + distsq_multi[i] = nullptr; } } if (smax > maxstencil_multi) { diff --git a/src/ntopo.cpp b/src/ntopo.cpp index d4ddcc7fc0..02a86e33c0 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -33,7 +33,7 @@ NTopo::NTopo(LAMMPS *lmp) : Pointers(lmp) nbondlist = nanglelist = ndihedrallist = nimproperlist = 0; maxbond = maxangle = maxdihedral = maximproper = 0; - bondlist = anglelist = dihedrallist = improperlist = NULL; + bondlist = anglelist = dihedrallist = improperlist = nullptr; cluster_check = neighbor->cluster_check; } diff --git a/src/output.cpp b/src/output.cpp index 6c90198de4..13261396db 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -56,23 +56,23 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) delete [] newarg; thermo_every = 0; - var_thermo = NULL; + var_thermo = nullptr; ndump = 0; max_dump = 0; - every_dump = NULL; - next_dump = NULL; - last_dump = NULL; - var_dump = NULL; - ivar_dump = NULL; - dump = NULL; + every_dump = nullptr; + next_dump = nullptr; + last_dump = nullptr; + var_dump = nullptr; + ivar_dump = nullptr; + dump = nullptr; restart_flag = restart_flag_single = restart_flag_double = 0; restart_every_single = restart_every_double = 0; last_restart = -1; - restart1 = restart2a = restart2b = NULL; - var_restart_single = var_restart_double = NULL; - restart = NULL; + restart1 = restart2a = restart2b = nullptr; + var_restart_single = var_restart_double = nullptr; + restart = nullptr; dump_map = new DumpCreatorMap(); @@ -560,7 +560,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = 0; last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ivar_dump[ndump] = -1; // create the Dump @@ -573,7 +573,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = utils::inumeric(FLERR,arg[3],false,lmp); if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command"); last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ndump++; } @@ -641,7 +641,7 @@ void Output::delete_dump(char *id) int Output::find_dump(const char *id) { - if (id == NULL) return -1; + if (id == nullptr) return -1; int idump; for (idump = 0; idump < ndump; idump++) if (strcmp(id,dump[idump]->id) == 0) break; @@ -661,7 +661,7 @@ void Output::set_thermo(int narg, char **arg) // variable spaced thermo outputs to constant spaced ones. delete [] var_thermo; - var_thermo = NULL; + var_thermo = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -692,10 +692,10 @@ void Output::create_thermo(int narg, char **arg) error->warning(FLERR,"New thermo_style command, " "previous thermo_modify settings will be lost"); - // set thermo = NULL in case new Thermo throws an error + // set thermo = nullptr in case new Thermo throws an error delete thermo; - thermo = NULL; + thermo = nullptr; thermo = new Thermo(lmp,narg,arg); } @@ -721,14 +721,14 @@ void Output::create_restart(int narg, char **arg) last_restart = -1; delete restart; - restart = NULL; + restart = nullptr; delete [] restart1; delete [] restart2a; delete [] restart2b; - restart1 = restart2a = restart2b = NULL; + restart1 = restart2a = restart2b = nullptr; delete [] var_restart_single; delete [] var_restart_double; - var_restart_single = var_restart_double = NULL; + var_restart_single = var_restart_double = nullptr; return; } @@ -754,7 +754,7 @@ void Output::create_restart(int narg, char **arg) delete [] restart1; restart1 = new char[n]; strcpy(restart1,arg[1]); - if (strchr(restart1,'*') == NULL) strcat(restart1,".*"); + if (strchr(restart1,'*') == nullptr) strcat(restart1,".*"); } if (nfile == 2) { diff --git a/src/output.h b/src/output.h index 06be7b244a..6a64e67c93 100644 --- a/src/output.h +++ b/src/output.h @@ -29,7 +29,7 @@ class Output : protected Pointers { bigint next_thermo; // next timestep for thermo output int thermo_every; // output freq for thermo, 0 if first/last only bigint last_thermo; // last timestep thermo was output - char *var_thermo; // variable name for thermo freq, NULL if every + char *var_thermo; // variable name for thermo freq, nullptr if every int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations diff --git a/src/pair.cpp b/src/pair.cpp index d869bbe8d8..60a5c0d8bf 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -67,12 +67,12 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) unit_convert_flag = utils::NOCONVERT; nextra = 0; - pvector = NULL; + pvector = nullptr; single_extra = 0; - svector = NULL; + svector = nullptr; - setflag = NULL; - cutsq = NULL; + setflag = nullptr; + cutsq = nullptr; ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0; reinitflag = 1; @@ -91,19 +91,19 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) ndisptablebits = 12; tabinner = sqrt(2.0); tabinner_disp = sqrt(2.0); - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; allocated = 0; suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; num_tally_compute = 0; - list_tally_compute = NULL; + list_tally_compute = nullptr; nondefault_history_transfer = 0; beyond_contact = 0; @@ -123,7 +123,7 @@ Pair::~Pair() { num_tally_compute = 0; memory->sfree((void *) list_tally_compute); - list_tally_compute = NULL; + list_tally_compute = nullptr; if (copymode) return; @@ -331,7 +331,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) double r,grij,expm2,derfc,egamma,fgamma,rsw; double qqrd2e = force->qqrd2e; - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); double g_ewald = force->kspace->g_ewald; @@ -359,8 +359,8 @@ void Pair::init_tables(double cut_coul, double *cut_respa) memory->create(dctable,ntable,"pair:dctable"); memory->create(detable,ntable,"pair:detable"); - if (cut_respa == NULL) { - vtable = ptable = dvtable = dptable = NULL; + if (cut_respa == nullptr) { + vtable = ptable = dvtable = dptable = nullptr; } else { memory->create(vtable,ntable,"pair:vtable"); memory->create(ptable,ntable,"pair:ptable"); @@ -391,7 +391,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { rtable[i] = rsq_lookup.f; ctable[i] = qqrd2e/r; if (msmflag) { @@ -488,7 +488,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { c_tmp = qqrd2e/r; if (msmflag) { f_tmp = qqrd2e/r * fgamma; @@ -1664,7 +1664,7 @@ void Pair::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -1672,7 +1672,7 @@ void Pair::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by pair_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open pair_write file {}: {}", table_file, utils::getsyserror())); fprintf(fp,"# Pair potential %s for atom types %d %d: i,r,energy,force\n", diff --git a/src/pair.h b/src/pair.h index 00f433233e..ace233539f 100644 --- a/src/pair.h +++ b/src/pair.h @@ -197,7 +197,7 @@ class Pair : protected Pointers { // specific child-class methods for certain Pair styles - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void swap_eam(double *, double **) {} virtual void reset_dt() {} virtual void min_xf_pointers(int, double **, double **) {} diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 87aa0bab5f..777c7e4c48 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -281,16 +281,16 @@ void PairBeck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&AA[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&BB[i][j],1,MPI_DOUBLE,0,world); @@ -320,8 +320,8 @@ void PairBeck::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 5b0d3a6562..fee494fd9c 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -330,16 +330,16 @@ void PairBorn::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -370,10 +370,10 @@ void PairBorn::write_restart_settings(FILE *fp) void PairBorn::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -433,5 +433,5 @@ void *PairBorn::extract(const char *str, int &dim) if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; if (strcmp(str,"d") == 0) return (void *) d; - return NULL; + return nullptr; } diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index e4617b5c4b..abe3d1e071 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -361,16 +361,16 @@ void PairBornCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -402,11 +402,11 @@ void PairBornCoulDSF::write_restart_settings(FILE *fp) void PairBornCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 30fe8fcde9..a873ec6c62 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -360,16 +360,16 @@ void PairBornCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairBornCoulWolf::write_restart_settings(FILE *fp) void PairBornCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 1abdbcc68b..6de115a0e5 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -309,14 +309,14 @@ void PairBuck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -345,10 +345,10 @@ void PairBuck::write_restart_settings(FILE *fp) void PairBuck::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -405,5 +405,5 @@ void *PairBuck::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 9fac17aede..9cc90ebc81 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -364,15 +364,15 @@ void PairBuckCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -403,11 +403,11 @@ void PairBuckCoulCut::write_restart_settings(FILE *fp) void PairBuckCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 67c471a5e3..5aa281190e 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -247,10 +247,10 @@ void PairCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -274,9 +274,9 @@ void PairCoulCut::write_restart_settings(FILE *fp) void PairCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -307,5 +307,5 @@ void *PairCoulCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"cut_coul") == 0) return (void *) &cut; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index 2093718245..31838fbee5 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -146,10 +146,10 @@ void PairCoulDebye::write_restart_settings(FILE *fp) void PairCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index ee124c7f59..94106405b0 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -254,7 +254,7 @@ void PairCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -278,10 +278,10 @@ void PairCoulDSF::write_restart_settings(FILE *fp) void PairCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -327,5 +327,5 @@ void *PairCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index e538275b3c..6ff958483b 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -51,11 +51,11 @@ PairCoulStreitz::PairCoulStreitz(LAMMPS *lmp) : Pair(lmp) nmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -143,7 +143,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -152,7 +152,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -215,7 +215,7 @@ void PairCoulStreitz::init_style() // insure use of KSpace long-range solver when ewald specified, set g_ewald if (ewaldflag) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -799,5 +799,5 @@ void *PairCoulStreitz::extract(const char *str, int &dim) if (kspacetype == 1) return (void *) &g_wolf; if (kspacetype == 2) return (void *) &g_ewald; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index e3079dcaf6..994e74fc90 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -250,7 +250,7 @@ void PairCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -274,10 +274,10 @@ void PairCoulWolf::write_restart_settings(FILE *fp) void PairCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index d0d9b98fc9..d92f4b7cca 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; PairDPD::PairDPD(LAMMPS *lmp) : Pair(lmp) { writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -314,13 +314,13 @@ void PairDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairDPD::write_restart_settings(FILE *fp) void PairDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index dd0e144953..4b9c186dab 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -232,12 +232,12 @@ void PairDPDTstat::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -265,11 +265,11 @@ void PairDPDTstat::write_restart_settings(FILE *fp) void PairDPDTstat::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&t_start,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&t_start,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&t_start,1,MPI_DOUBLE,0,world); MPI_Bcast(&t_stop,1,MPI_DOUBLE,0,world); diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 6732296764..39c8caa732 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -280,13 +280,13 @@ void PairGauss::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&b[i][j],1,MPI_DOUBLE,0,world); @@ -313,9 +313,9 @@ void PairGauss::write_restart_settings(FILE *fp) void PairGauss::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairGauss::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; - return NULL; + return nullptr; } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 0b1882f12b..7f7f795b80 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), - styles(NULL), keywords(NULL), multiple(NULL), nmap(NULL), - map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL) + styles(nullptr), keywords(nullptr), multiple(nullptr), nmap(nullptr), + map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr) { nstyles = 0; @@ -116,7 +116,7 @@ void PairHybrid::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; @@ -324,7 +324,7 @@ void PairHybrid::settings(int narg, char **arg) styles[nstyles] = force->new_pair(arg[iarg],1,dummy); force->store_style(keywords[nstyles],arg[iarg],0); - special_lj[nstyles] = special_coul[nstyles] = NULL; + special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; // determine list of arguments for pair style settings @@ -706,10 +706,10 @@ void PairHybrid::write_restart(FILE *fp) fwrite(keywords[m],sizeof(char),n,fp); styles[m]->write_restart_settings(fp); // write out per style special settings, if present - n = (special_lj[m] == NULL) ? 0 : 1; + n = (special_lj[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_lj[m],sizeof(double),4,fp); - n = (special_coul[m] == NULL) ? 0 : 1; + n = (special_coul[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_coul[m],sizeof(double),4,fp); } @@ -722,7 +722,7 @@ void PairHybrid::write_restart(FILE *fp) void PairHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); // allocate list of sub-styles @@ -745,32 +745,32 @@ void PairHybrid::read_restart(FILE *fp) // each sub-style is created via new_pair() // each reads its settings, but no coeff info - if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,nullptr,error); MPI_Bcast(compute_tally,nstyles,MPI_INT,0,world); int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_pair(keywords[m],1,dummy); styles[m]->read_restart_settings(fp); // read back per style special settings, if present - special_lj[m] = special_coul[m] = NULL; - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + special_lj[m] = special_coul[m] = nullptr; + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_lj[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_lj[m],4,MPI_DOUBLE,0,world); } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_coul[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_coul[m],4,MPI_DOUBLE,0,world); } } @@ -813,8 +813,8 @@ double PairHybrid::single(int i, int j, int itype, int jtype, if (styles[map[itype][jtype][m]]->single_enable == 0) error->one(FLERR,"Pair hybrid sub-style does not support single call"); - if ((special_lj[map[itype][jtype][m]] != NULL) || - (special_coul[map[itype][jtype][m]] != NULL)) + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) error->one(FLERR,"Pair hybrid single calls do not support" " per sub-style special bond values"); @@ -1006,13 +1006,13 @@ void PairHybrid::restore_special(double *saved) /* ---------------------------------------------------------------------- extract a ptr to a particular quantity stored by pair pass request thru to sub-styles - return first non-NULL result except for cut_coul request - for cut_coul, insure all non-NULL results are equal since required by Kspace + return first non-nullptr result except for cut_coul request + for cut_coul, insure all non-nullptr results are equal since required by Kspace ------------------------------------------------------------------------- */ void *PairHybrid::extract(const char *str, int &dim) { - void *cutptr = NULL; + void *cutptr = nullptr; void *ptr; double cutvalue = 0.0; int couldim = -1; @@ -1037,7 +1037,7 @@ void *PairHybrid::extract(const char *str, int &dim) } if (strcmp(str,"cut_coul") == 0) return cutptr; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 34c4cfe418..8d352e9f2e 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -140,7 +140,7 @@ void PairHybridOverlay::copy_svector(int itype, int jtype) if (m == map[itype][jtype][k]) { this_style = styles[m]; } else { - this_style = NULL; + this_style = nullptr; } } for (int l = 0; l < styles[m]->single_extra; ++l) { diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index a4ba3b8585..444538b253 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -41,7 +41,7 @@ PairLJ96Cut::PairLJ96Cut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -508,7 +508,7 @@ void PairLJ96Cut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -607,13 +607,13 @@ void PairLJ96Cut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -642,10 +642,10 @@ void PairLJ96Cut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index b6c91cafe2..f5f8038bef 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -279,14 +279,14 @@ void PairLJCubic::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -313,7 +313,7 @@ void PairLJCubic::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index bd42801f3b..f9b5a25523 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -502,7 +502,7 @@ void PairLJCut::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -601,13 +601,13 @@ void PairLJCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -636,10 +636,10 @@ void PairLJCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -693,5 +693,5 @@ void *PairLJCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 669d48c860..38f4316d29 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -354,14 +354,14 @@ void PairLJCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -391,11 +391,11 @@ void PairLJCutCoulCut::write_restart_settings(FILE *fp) void PairLJCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -466,5 +466,5 @@ void *PairLJCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index 3ddb898c8f..ed09e98062 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -171,11 +171,11 @@ void PairLJCutCoulDebye::write_restart_settings(FILE *fp) void PairLJCutCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 952a140039..f2c48b2229 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -377,13 +377,13 @@ void PairLJCutCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJCutCoulDSF::write_restart_settings(FILE *fp) void PairLJCutCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -477,5 +477,5 @@ void *PairLJCutCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index 749cc9e6a9..e6b00b9a56 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -370,13 +370,13 @@ void PairLJCutCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -407,12 +407,12 @@ void PairLJCutCoulWolf::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 3f711e2a15..c68c2298e5 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -325,14 +325,14 @@ void PairLJExpand::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -361,10 +361,10 @@ void PairLJExpand::write_restart_settings(FILE *fp) void PairLJExpand::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -423,5 +423,5 @@ void *PairLJExpand::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 0818c60f31..05f30bcdd5 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -339,14 +339,14 @@ void PairLJGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -376,10 +376,10 @@ void PairLJGromacs::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index 005bc44061..481e657236 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -379,12 +379,12 @@ void PairLJGromacsCoulGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJGromacsCoulGromacs::write_restart_settings(FILE *fp) void PairLJGromacsCoulGromacs::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index a53d703b8b..7afc667358 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -353,14 +353,14 @@ void PairLJSmooth::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -390,10 +390,10 @@ void PairLJSmooth::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 3697208d42..78a538f131 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -286,13 +286,13 @@ void PairLJSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -319,8 +319,8 @@ void PairLJSmoothLinear::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index 7447e143f7..5030ffc2af 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -40,7 +40,7 @@ using namespace MathConst; PairMIECut::PairMIECut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -517,7 +517,7 @@ void PairMIECut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -628,15 +628,15 @@ void PairMIECut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -667,10 +667,10 @@ void PairMIECut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -706,5 +706,5 @@ void *PairMIECut::extract(const char *str, int &dim) if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamR") == 0) return (void *) gamR; if (strcmp(str,"gamA") == 0) return (void *) gamA; - return NULL; + return nullptr; } diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index efcc1aa811..b55fc7a858 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -266,14 +266,14 @@ void PairMorse::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -301,9 +301,9 @@ void PairMorse::write_restart_settings(FILE *fp) void PairMorse::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -357,5 +357,5 @@ void *PairMorse::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index f3dd139b69..b6a3151987 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -245,12 +245,12 @@ void PairSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&prefactor[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -275,8 +275,8 @@ void PairSoft::write_restart_settings(FILE *fp) void PairSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -326,5 +326,5 @@ void *PairSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) prefactor; - return NULL; + return nullptr; } diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 1711465ffa..c0fad544d7 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -43,7 +43,7 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTable::PairTable(LAMMPS *lmp) : Pair(lmp) { ntables = 0; - tables = NULL; + tables = nullptr; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); } @@ -246,7 +246,7 @@ void PairTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -821,15 +821,15 @@ void PairTable::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -951,13 +951,13 @@ void PairTable::write_restart_settings(FILE *fp) void PairTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -1029,7 +1029,7 @@ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, void *PairTable::extract(const char *str, int &dim) { - if (strcmp(str,"cut_coul") != 0) return NULL; + if (strcmp(str,"cut_coul") != 0) return nullptr; if (ntables == 0) error->all(FLERR,"All pair coeffs are not set"); // only check for cutoff consistency if claiming to be KSpace compatible @@ -1042,5 +1042,5 @@ void *PairTable::extract(const char *str, int &dim) "Pair table cutoffs must all be equal to use with KSpace"); dim = 0; return &tables[0].cut; - } else return NULL; + } else return nullptr; } diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index 50cc87cf96..e1e378155a 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -278,14 +278,14 @@ void PairUFM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairUFM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -365,5 +365,5 @@ void *PairUFM::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index 6429492346..6118e5f36b 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -253,12 +253,12 @@ void PairYukawa::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -285,10 +285,10 @@ void PairYukawa::write_restart_settings(FILE *fp) void PairYukawa::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 68c63c9806..7b028de65a 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -285,10 +285,10 @@ void PairZBL::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][i],1,MPI_INT,0,world); if (setflag[i][i]) { - if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&z[i],1,MPI_DOUBLE,0,world); } } @@ -319,11 +319,11 @@ void PairZBL::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 976bb1ba33..a45fef67a5 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -178,11 +178,11 @@ void PairZero::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -207,8 +207,8 @@ void PairZero::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&coeffflag,1,MPI_INT,0,world); diff --git a/src/procmap.cpp b/src/procmap.cpp index f80af9330e..b85b0abd01 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -49,7 +49,7 @@ void ProcMap::onelevel_grid(int nprocs, int *user_procgrid, int *procgrid, // factors = list of all possible 3 factors of processor count - int npossible = factor(nprocs,NULL); + int npossible = factor(nprocs,nullptr); memory->create(factors,npossible,3,"procmap:factors"); npossible = factor(nprocs,factors); @@ -93,7 +93,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // nfactors = list of all possible 3 factors of node count // constrain by 2d - int nnpossible = factor(nprocs/ncores,NULL); + int nnpossible = factor(nprocs/ncores,nullptr); memory->create(nfactors,nnpossible,3,"procmap:nfactors"); nnpossible = factor(nprocs/ncores,nfactors); @@ -102,7 +102,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // cfactors = list of all possible 3 factors of core count // constrain by 2d - int ncpossible = factor(ncores,NULL); + int ncpossible = factor(ncores,nullptr); memory->create(cfactors,ncpossible,3,"procmap:cfactors"); ncpossible = factor(ncores,cfactors); @@ -205,7 +205,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, // initial factorization within NUMA node int **numafactors; - int numapossible = factor(procs_per_numa,NULL); + int numapossible = factor(procs_per_numa,nullptr); memory->create(numafactors,numapossible,3,"procmap:numafactors"); numapossible = factor(procs_per_numa,numafactors); @@ -230,7 +230,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, int node_count = nprocs / procs_per_numa; int **nodefactors; - int nodepossible = factor(node_count,NULL); + int nodepossible = factor(node_count,nullptr); memory->create(nodefactors,nodepossible,3,"procmap:nodefactors"); nodepossible = factor(node_count,nodefactors); @@ -281,11 +281,11 @@ void ProcMap::custom_grid(char *cfile, int nprocs, MPI_Comm_rank(world,&me); char line[MAXLINE]; - FILE *fp = NULL; + FILE *fp = nullptr; if (me == 0) { fp = fopen(cfile,"r"); - if (fp == NULL) error->one(FLERR,"Cannot open custom file"); + if (fp == nullptr) error->one(FLERR,"Cannot open custom file"); // skip header = blank and comment lines @@ -662,7 +662,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) FILE *fp; if (me == 0) { fp = fopen(file,"w"); - if (fp == NULL) error->one(FLERR,"Cannot open processors output file"); + if (fp == nullptr) error->one(FLERR,"Cannot open processors output file"); fprintf(fp,"LAMMPS mapping of processors to 3d grid\n"); fprintf(fp,"partition = %d\n",universe->iworld+1); fprintf(fp,"Px Py Pz = %d %d %d\n",procgrid[0],procgrid[1],procgrid[2]); @@ -722,7 +722,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) /* ---------------------------------------------------------------------- generate all possible 3-integer factorizations of N - store them in factors if non-NULL + store them in factors if non-nullptr return # of factorizations ------------------------------------------------------------------------- */ diff --git a/src/random_mars.cpp b/src/random_mars.cpp index 29314525a5..3f5bd7a62f 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -27,7 +27,7 @@ enum{ADD,SUBTRACT}; /* ---------------------------------------------------------------------- */ RanMars::RanMars(LAMMPS *lmp, int seed) : Pointers(lmp), - u(NULL) + u(nullptr) { int ij,kl,i,j,k,l,ii,jj,m; double s,t; diff --git a/src/rcb.cpp b/src/rcb.cpp index 03c99560b3..36e1a5474e 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -39,19 +39,19 @@ RCB::RCB(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); ndot = maxdot = 0; - dots = NULL; + dots = nullptr; nlist = maxlist = 0; - dotlist = dotmark = dotmark_select = NULL; + dotlist = dotmark = dotmark_select = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; maxrecv = maxsend = 0; - recvproc = recvindex = sendproc = sendindex = NULL; + recvproc = recvindex = sendproc = sendindex = nullptr; - tree = NULL; - irregular = NULL; + tree = nullptr; + irregular = nullptr; // create MPI data and function types for box and median AllReduce ops @@ -95,7 +95,7 @@ RCB::~RCB() NEW version: each RCB cut is tested in all dimensions dimeension that produces 2 boxes with largest min size is selected this is to prevent very narrow boxes from being produced - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -573,10 +573,10 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner @@ -632,7 +632,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, /* ---------------------------------------------------------------------- perform RCB balancing of N particles at coords X in bounding box LO/HI OLD version: each RCB cut is made in longest dimension of sub-box - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -1065,10 +1065,10 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner diff --git a/src/read_data.cpp b/src/read_data.cpp index 2a6801b3a5..231871c47a 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -62,7 +62,7 @@ enum{NONE,APPEND,VALUE,MERGE}; const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/kk", "/coul/cut","/coul/long","/coul/msm", "/coul/dsf","/coul/debye","/coul/charmm", - NULL}; + nullptr}; /* ---------------------------------------------------------------------- */ @@ -74,8 +74,8 @@ ReadData::ReadData(LAMMPS *lmp) : Pointers(lmp) style = new char[MAXLINE]; buffer = new char[CHUNK*MAXLINE]; narg = maxarg = 0; - arg = NULL; - fp = NULL; + arg = nullptr; + fp = nullptr; // customize for new sections // pointers to atom styles that store bonus info @@ -132,9 +132,9 @@ void ReadData::command(int narg, char **arg) groupbit = 0; nfix = 0; - fix_index = NULL; - fix_header = NULL; - fix_section = NULL; + fix_index = nullptr; + fix_header = nullptr; + fix_section = nullptr; int iarg = 1; while (iarg < narg) { @@ -277,7 +277,7 @@ void ReadData::command(int narg, char **arg) fix_index[nfix] = modify->find_fix(arg[iarg+1]); if (fix_index[nfix] < 0) error->all(FLERR,"Fix ID for read_data does not exist"); - if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = NULL; + if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = nullptr; else { int n = strlen(arg[iarg+2]) + 1; fix_header[nfix] = new char[n]; @@ -334,12 +334,12 @@ void ReadData::command(int narg, char **arg) // set up pointer to hold original styles while we replace them with "zero" - Pair *saved_pair = NULL; - Bond *saved_bond = NULL; - Angle *saved_angle = NULL; - Dihedral *saved_dihedral = NULL; - Improper *saved_improper = NULL; - KSpace *saved_kspace = NULL; + Pair *saved_pair = nullptr; + Bond *saved_bond = nullptr; + Angle *saved_angle = nullptr; + Dihedral *saved_dihedral = nullptr; + Improper *saved_improper = nullptr; + KSpace *saved_kspace = nullptr; if (coeffflag == 0) { char *coeffs[2]; @@ -347,33 +347,33 @@ void ReadData::command(int narg, char **arg) coeffs[1] = (char *) "nocoeff"; saved_pair = force->pair; - force->pair = NULL; + force->pair = nullptr; force->create_pair("zero",0); if (force->pair) force->pair->settings(2,coeffs); coeffs[0] = coeffs[1]; saved_bond = force->bond; - force->bond = NULL; + force->bond = nullptr; force->create_bond("zero",0); if (force->bond) force->bond->settings(1,coeffs); saved_angle = force->angle; - force->angle = NULL; + force->angle = nullptr; force->create_angle("zero",0); if (force->angle) force->angle->settings(1,coeffs); saved_dihedral = force->dihedral; - force->dihedral = NULL; + force->dihedral = nullptr; force->create_dihedral("zero",0); if (force->dihedral) force->dihedral->settings(1,coeffs); saved_improper = force->improper; - force->improper = NULL; + force->improper = nullptr; force->create_improper("zero",0); if (force->improper) force->improper->settings(1,coeffs); saved_kspace = force->kspace; - force->kspace = NULL; + force->kspace = nullptr; } // ----------------------------------------------------------------- @@ -414,7 +414,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (firstpass) utils::logmesg(lmp,"Reading data file ...\n"); open(arg[0]); - } else fp = NULL; + } else fp = nullptr; // read header info @@ -578,7 +578,7 @@ void ReadData::command(int narg, char **arg) if (firstpass) mass(); else skip_lines(ntypes); } else if (strcmp(keyword,"Pair Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before Pair Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -587,7 +587,7 @@ void ReadData::command(int narg, char **arg) paircoeffs(); } else skip_lines(ntypes); } else if (strcmp(keyword,"PairIJ Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before PairIJ Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -598,7 +598,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Bond Coeffs") == 0) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Invalid data file section: Bond Coeffs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must define bond_style before Bond Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->bond_style)) @@ -609,7 +609,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Angle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: Angle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before Angle Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->angle_style)) @@ -620,7 +620,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Dihedral Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: Dihedral Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Must define dihedral_style before Dihedral Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->dihedral_style)) @@ -631,7 +631,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Improper Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: Improper Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Must define improper_style before Improper Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->improper_style)) @@ -643,14 +643,14 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondBond Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondBond Coeffs"); if (firstpass) anglecoeffs(1); else skip_lines(nangletypes); } else if (strcmp(keyword,"BondAngle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondAngle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondAngle Coeffs"); if (firstpass) anglecoeffs(2); else skip_lines(nangletypes); @@ -659,7 +659,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: MiddleBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "MiddleBondTorsion Coeffs"); @@ -668,7 +668,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"EndBondTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: EndBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before EndBondTorsion Coeffs"); if (firstpass) dihedralcoeffs(2); @@ -676,7 +676,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: AngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before AngleTorsion Coeffs"); if (firstpass) dihedralcoeffs(3); @@ -685,7 +685,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: AngleAngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "AngleAngleTorsion Coeffs"); @@ -694,7 +694,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond13 Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: BondBond13 Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before BondBond13 Coeffs"); if (firstpass) dihedralcoeffs(5); @@ -703,7 +703,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleAngle Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: AngleAngle Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR, "Must define improper_style before AngleAngle Coeffs"); if (firstpass) impropercoeffs(1); @@ -725,7 +725,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } // done if this was 2nd pass @@ -929,7 +929,7 @@ void ReadData::header(int firstpass) if (me == 0) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } while (1) { @@ -937,7 +937,7 @@ void ReadData::header(int firstpass) // read a line and bcast length if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1289,7 +1289,7 @@ void ReadData::bonds(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1363,7 +1363,7 @@ void ReadData::angles(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1437,7 +1437,7 @@ void ReadData::dihedrals(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1511,7 +1511,7 @@ void ReadData::impropers(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1641,7 +1641,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) while (nchunk < nmax && nline <= CHUNK-MAXBODY) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); rv = sscanf(&buffer[m],"%d %d %d",&tmp,&ninteger,&ndouble); if (rv != 3) error->one(FLERR,"Incorrect format in Bodies section of data file"); @@ -1655,7 +1655,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ninteger) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1669,7 +1669,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ndouble) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1743,7 +1743,7 @@ void ReadData::paircoeffs() for (int i = 0; i < ntypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,1,2,toffset); + parse_coeffs(buf,nullptr,1,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1770,7 +1770,7 @@ void ReadData::pairIJcoeffs() for (j = i; j < ntypes; j++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,2,toffset); + parse_coeffs(buf,nullptr,0,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1795,7 +1795,7 @@ void ReadData::bondcoeffs() for (int i = 0; i < nbondtypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,1,boffset); + parse_coeffs(buf,nullptr,0,1,boffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in BondCoeffs section"); force->bond->coeff(narg,arg); @@ -1820,7 +1820,7 @@ void ReadData::anglecoeffs(int which) for (int i = 0; i < nangletypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,aoffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,aoffset); else if (which == 1) parse_coeffs(buf,"bb",0,1,aoffset); else if (which == 2) parse_coeffs(buf,"ba",0,1,aoffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in AngleCoeffs section"); @@ -1846,7 +1846,7 @@ void ReadData::dihedralcoeffs(int which) for (int i = 0; i < ndihedraltypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,doffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,doffset); else if (which == 1) parse_coeffs(buf,"mbt",0,1,doffset); else if (which == 2) parse_coeffs(buf,"ebt",0,1,doffset); else if (which == 3) parse_coeffs(buf,"at",0,1,doffset); @@ -1876,7 +1876,7 @@ void ReadData::impropercoeffs(int which) for (int i = 0; i < nimpropertypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,ioffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,ioffset); else if (which == 1) parse_coeffs(buf,"aa",0,1,ioffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in ImproperCoeffs section"); force->improper->coeff(narg,arg); @@ -1945,7 +1945,7 @@ void ReadData::open(char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -1970,15 +1970,15 @@ void ReadData::parse_keyword(int first) if (me == 0) { if (!first) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } while (eof == 0 && done == 0) { int blank = strspn(line," \t\n\r"); if ((blank == (int)strlen(line)) || (line[blank] == '#')) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } else done = 1; } - if (fgets(buffer,MAXLINE,fp) == NULL) { + if (fgets(buffer,MAXLINE,fp) == nullptr) { eof = 1; buffer[0] = '\0'; } @@ -2031,16 +2031,16 @@ void ReadData::skip_lines(bigint n) { if (me) return; if (n <= 0) return; - char *eof = NULL; + char *eof = nullptr; for (bigint i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } /* ---------------------------------------------------------------------- parse a line of coeffs into words, storing them in narg,arg trim anything from '#' onward word strings remain in line, are not copied - if addstr != NULL, add addstr as extra arg for class2 angle/dihedral/improper + if addstr != nullptr, add addstr as extra arg for class2 angle/dihedral/improper if 2nd word starts with letter, then is hybrid style, add addstr after it else add addstr before 2nd word if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2" @@ -2065,7 +2065,7 @@ void ReadData::parse_coeffs(char *line, const char *addstr, arg[narg++] = word; if (addstr && narg == 2 && islower(word[0])) arg[narg++] = (char *) addstr; if (dupflag && narg == 1) arg[narg++] = word; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } // to avoid segfaults on empty lines @@ -2094,12 +2094,12 @@ int ReadData::style_match(const char *one, const char *two) { int i,delta,len,len1,len2; - if ((one == NULL) || (two == NULL)) return 1; + if ((one == nullptr) || (two == nullptr)) return 1; len1 = strlen(one); len2 = strlen(two); - for (i = 0; suffixes[i] != NULL; i++) { + for (i = 0; suffixes[i] != nullptr; i++) { len = strlen(suffixes[i]); if ((delta = len1 - len) > 0) if (strcmp(one+delta,suffixes[i]) == 0) len1 = delta; diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 10218fe617..2fd14b547a 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -55,22 +55,22 @@ ReadDump::ReadDump(LAMMPS *lmp) : Pointers(lmp) triclinic = domain->triclinic; nfile = 0; - files = NULL; + files = nullptr; nnew = maxnew = 0; nfield = 0; - fieldtype = NULL; - fieldlabel = NULL; - fields = NULL; - buf = NULL; + fieldtype = nullptr; + fieldlabel = nullptr; + fields = nullptr; + buf = nullptr; int n = strlen("native") + 1; readerstyle = new char[n]; strcpy(readerstyle,"native"); nreader = 0; - readers = NULL; - nsnapatoms = NULL; + readers = nullptr; + nsnapatoms = nullptr; clustercomm = MPI_COMM_NULL; filereader = 0; parallel = 0; @@ -111,9 +111,9 @@ void ReadDump::command(int narg, char **arg) int nremain = narg - 2; if (nremain) nremain = fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = fields_and_keywords(0,NULL); + else nremain = fields_and_keywords(0,nullptr); if (nremain) setup_reader(nremain,&arg[narg-nremain]); - else setup_reader(0,NULL); + else setup_reader(0,nullptr); // find the snapshot and read/bcast/process header info @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid NULL ptr + newmaxnew = MAX(newmaxnew,1); // avoid nullptr ptr memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); @@ -1207,7 +1207,7 @@ int ReadDump::fields_and_keywords(int narg, char **arg) purgeflag = 0; trimflag = 0; addflag = NOADD; - for (int i = 0; i < nfield; i++) fieldlabel[i] = NULL; + for (int i = 0; i < nfield; i++) fieldlabel[i] = nullptr; scaleflag = 0; wrapflag = 1; diff --git a/src/read_restart.cpp b/src/read_restart.cpp index dcab9f834c..81a6862236 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -108,7 +108,7 @@ void ReadRestart::command(int narg, char **arg) hfile.replace(hfile.find("%"),1,"base"); } fp = fopen(hfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", hfile, utils::getsyserror())); } @@ -166,7 +166,7 @@ void ReadRestart::command(int narg, char **arg) if (multiproc && me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // read per-proc info @@ -174,7 +174,7 @@ void ReadRestart::command(int narg, char **arg) AtomVec *avec = atom->avec; int maxbuf = 0; - double *buf = NULL; + double *buf = nullptr; int m,flag; // MPI-IO input from single file @@ -255,7 +255,7 @@ void ReadRestart::command(int narg, char **arg) if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -270,34 +270,34 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",iproc)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); int procsperfile; - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); for (int i = 0; i < procsperfile; i++) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); m = 0; while (m < n) m += avec->unpack_restart(&buf[m]); } fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -334,7 +334,7 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); } @@ -342,10 +342,10 @@ void ReadRestart::command(int narg, char **arg) int flag,procsperfile; if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&procsperfile,1,MPI_INT,0,clustercomm); @@ -354,17 +354,17 @@ void ReadRestart::command(int narg, char **arg) for (int i = 0; i < procsperfile; i++) { if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); if (i % nclusterprocs) { iproc = me + (i % nclusterprocs); @@ -391,9 +391,9 @@ void ReadRestart::command(int narg, char **arg) } } - if (filereader && fp != NULL) { + if (filereader && fp != nullptr) { fclose(fp); - fp = NULL; + fp = nullptr; } MPI_Comm_free(&clustercomm); } @@ -570,11 +570,11 @@ void ReadRestart::file_search(char *inpfile, char *outfile) struct dirent *ep; DIR *dp = opendir(dirname); - if (dp == NULL) + if (dp == nullptr) error->one(FLERR,"Cannot open dir to search for restart file"); while ((ep = readdir(dp))) { if (strstr(ep->d_name,begin) != ep->d_name) continue; - if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue; + if ((ptr = strstr(&ep->d_name[nbegin],end)) == nullptr) continue; if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); *ptr = '\0'; if ((int)strlen(&ep->d_name[nbegin]) < n) { @@ -1034,7 +1034,7 @@ void ReadRestart::file_layout() memory->create(nproc_chunk_number,nprocs, "write_restart:nproc_chunk_number"); - utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,NULL,error); + utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,nullptr,error); if ((nprocs != nprocs_file) && !(atom->nextra_store)) { // nprocs differ, but atom sizes are fixed length, yeah! @@ -1232,7 +1232,7 @@ double ReadRestart::read_double() } /* ---------------------------------------------------------------------- - read a char string (including NULL) and bcast it + read a char string (including nullptr) and bcast it str is allocated here, ptr is returned, caller must deallocate ------------------------------------------------------------------------- */ @@ -1241,7 +1241,7 @@ char *ReadRestart::read_string() int n = read_int(); if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart"); char *value = new char[n]; - if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error); MPI_Bcast(value,n,MPI_CHAR,0,world); return value; } @@ -1253,7 +1253,7 @@ char *ReadRestart::read_string() void ReadRestart::read_int_vec(int n, int *vec) { if (n < 0) error->all(FLERR,"Illegal size integer vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_INT,0,world); } @@ -1264,6 +1264,6 @@ void ReadRestart::read_int_vec(int n, int *vec) void ReadRestart::read_double_vec(int n, double *vec) { if (n < 0) error->all(FLERR,"Illegal size double vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_DOUBLE,0,world); } diff --git a/src/reader.cpp b/src/reader.cpp index 8230fa3ed3..218fd75dfa 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; Reader::Reader(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -35,7 +35,7 @@ Reader::Reader(LAMMPS *lmp) : Pointers(lmp) void Reader::open_file(const char *file) { - if (fp != NULL) close_file(); + if (fp != nullptr) close_file(); compressed = 0; const char *suffix = file + strlen(file) - 3; @@ -55,7 +55,7 @@ void Reader::open_file(const char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -67,10 +67,10 @@ void Reader::open_file(const char *file) void Reader::close_file() { - if (fp == NULL) return; + if (fp == nullptr) return; if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/reader_native.cpp b/src/reader_native.cpp index e0f0d7792b..11241047a1 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -34,7 +34,7 @@ enum{UNSET,NOSCALE_NOWRAP,NOSCALE_WRAP,SCALE_NOWRAP,SCALE_WRAP}; ReaderNative::ReaderNative(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ ReaderNative::~ReaderNative() int ReaderNative::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // skip over unit and time information, if present. @@ -110,7 +110,7 @@ void ReaderNative::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flags = scaleflag+wrapflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 @@ -315,7 +315,7 @@ void ReaderNative::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); // tokenize the line std::vector words = Tokenizer(line).as_vector(); @@ -351,8 +351,8 @@ int ReaderNative::find_label(const std::string & label, const std::mapone(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index 8a2f7a3989..82fe756c2e 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,X,Y,Z}; ReaderXYZ::ReaderXYZ(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; nstep = 0; } @@ -52,7 +52,7 @@ ReaderXYZ::~ReaderXYZ() int ReaderXYZ::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // first line has to have the number of atoms // truncate the string to the first whitespace, @@ -109,7 +109,7 @@ void ReaderXYZ::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ @@ -174,7 +174,7 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); ++nid; rv = sscanf(line,"%*s%lg%lg%lg", &myx, &myy, &myz); @@ -216,8 +216,8 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) void ReaderXYZ::read_lines(int n) { - char *eof = NULL; + char *eof = nullptr; if (n <= 0) return; for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/region.cpp b/src/region.cpp index 15b6fee272..c7c2627885 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), contact(NULL), list(NULL), - xstr(NULL), ystr(NULL), zstr(NULL), tstr(NULL) + id(nullptr), style(nullptr), contact(nullptr), list(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr), tstr(nullptr) { int n = strlen(arg[0]) + 1; id = new char[n]; @@ -42,13 +42,13 @@ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : strcpy(style,arg[1]); varshape = 0; - xstr = ystr = zstr = tstr = NULL; + xstr = ystr = zstr = tstr = nullptr; dx = dy = dz = 0.0; size_restart = 5; reset_vel(); copymode = 0; - list = NULL; + list = nullptr; nregion = 1; } diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index f7676a3d74..2d40052e06 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -30,7 +30,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), c1str(NULL), c2str(NULL), rstr(NULL) + Region(lmp, narg, arg), c1str(nullptr), c2str(nullptr), rstr(nullptr) { options(narg-8,&arg[8]); diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index a61e2556b0..35c6c502ab 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), idsub(NULL) + Region(lmp, narg, arg), idsub(nullptr) { nregion = 0; diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index 4256af4213..5282095c87 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -28,7 +28,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL) + Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr) { options(narg-6,&arg[6]); diff --git a/src/region_union.cpp b/src/region_union.cpp index 677f1022f9..3ee0765f0b 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), - idsub(NULL) + idsub(nullptr) { nregion = 0; if (narg < 5) error->all(FLERR,"Illegal region command"); diff --git a/src/replicate.cpp b/src/replicate.cpp index 374d7113b2..471af6934e 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -154,7 +154,7 @@ void Replicate::command(int narg, char **arg) // also set atomKK for Kokkos version of Atom class Atom *old = atom; - atomKK = NULL; + atomKK = nullptr; if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp); else atom = new Atom(lmp); diff --git a/src/rerun.cpp b/src/rerun.cpp index 51c0f6fdb2..00cd1d4080 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -120,9 +120,9 @@ void Rerun::command(int narg, char **arg) rd->store_files(nfile,arg); if (nremain) nremain = rd->fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = rd->fields_and_keywords(0,NULL); + else nremain = rd->fields_and_keywords(0,nullptr); if (nremain) rd->setup_reader(nremain,&arg[narg-nremain]); - else rd->setup_reader(0,NULL); + else rd->setup_reader(0,nullptr); // perform the pseudo run // invoke lmp->init() only once diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index ad2caad656..10337fd18f 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -33,8 +33,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ResetMolIDs::ResetMolIDs(LAMMPS *lmp) : Pointers(lmp) { - cfa = NULL; - cca = NULL; + cfa = nullptr; + cca = nullptr; // default settings diff --git a/src/respa.cpp b/src/respa.cpp index c970c63a19..ecc6cc58f3 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -46,8 +46,8 @@ using namespace LAMMPS_NS; Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg), - step(NULL), loop(NULL), hybrid_level(NULL), hybrid_compute(NULL), - newton(NULL), fix_respa(NULL) + step(nullptr), loop(nullptr), hybrid_level(nullptr), hybrid_compute(nullptr), + newton(nullptr), fix_respa(nullptr) { nhybrid_styles = 0; if (narg < 1) error->all(FLERR,"Illegal run_style respa command"); diff --git a/src/run.cpp b/src/run.cpp index 166955d6ac..f5b571844f 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -91,7 +91,7 @@ void Run::command(int narg, char **arg) // all remaining args are commands // first,last = arg index of first/last commands - // set ncommands = 0 if single command and it is NULL + // set ncommands = 0 if single command and it is nullptr } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); @@ -140,7 +140,7 @@ void Run::command(int narg, char **arg) // if nevery, make copies of arg strings that are commands // required because re-parsing commands via input->one() will wipe out args - char **commands = NULL; + char **commands = nullptr; if (nevery && ncommands > 0) { commands = new char*[ncommands]; ncommands = 0; diff --git a/src/set.cpp b/src/set.cpp index 3b2cd44ad0..f66de96e98 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -74,7 +74,7 @@ void Set::command(int narg, char **arg) int n = strlen(arg[1]) + 1; id = new char[n]; strcpy(id,arg[1]); - select = NULL; + select = nullptr; selection(atom->nlocal); // loop over keyword/value pairs @@ -689,7 +689,7 @@ void Set::set(int keyword) { // evaluate atom-style variable(s) if necessary - vec1 = vec2 = vec3 = vec4 = NULL; + vec1 = vec2 = vec3 = vec4 = nullptr; if (varflag) { int nlocal = atom->nlocal; @@ -907,7 +907,7 @@ void Set::set(int keyword) // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { - double *quat = NULL; + double *quat = nullptr; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) diff --git a/src/special.cpp b/src/special.cpp index eb74f534f7..9661fa5ad8 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -34,7 +34,7 @@ Special::Special(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - onetwo = onethree = onefour = NULL; + onetwo = onethree = onefour = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/thermo.cpp b/src/thermo.cpp index 787b0cdda8..485974cc81 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -147,9 +147,9 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // ptrs, flags, IDs for compute objects thermo may use or create - temperature = NULL; - pressure = NULL; - pe = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; index_temp = index_press_scalar = index_press_vector = index_pe = -1; @@ -179,10 +179,10 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) sprintf(format_bigint_one_def,"%%8%s",&bigint_format[1]); sprintf(format_bigint_multi_def,"%%14%s",&bigint_format[1]); - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; } /* ---------------------------------------------------------------------- */ @@ -563,13 +563,13 @@ void Thermo::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; for (int i = 0; i < nfield_initial+1; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } iarg += 2; continue; @@ -593,7 +593,7 @@ void Thermo::modify_params(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Thermo_modify int format does not contain d character"); char str[8]; @@ -632,14 +632,14 @@ void Thermo::allocate() int n = nfield_initial + 1; keyword = new char*[n]; - for (int i = 0; i < n; i++) keyword[i] = NULL; + for (int i = 0; i < n; i++) keyword[i] = nullptr; vfunc = new FnPtr[n]; vtype = new int[n]; format = new char*[n]; for (int i = 0; i < n; i++) format[i] = new char[32]; format_column_user = new char*[n]; - for (int i = 0; i < n; i++) format_column_user[i] = NULL; + for (int i = 0; i < n; i++) format_column_user[i] = nullptr; field2index = new int[n]; argindex1 = new int[n]; @@ -893,7 +893,7 @@ void Thermo::parse_fields(char *str) // argindex1,argindex2 = int inside each bracket pair, 0 if no bracket char *ptr = strchr(id,'['); - if (ptr == NULL) argindex1[nfield] = argindex2[nfield] = 0; + if (ptr == nullptr) argindex1[nfield] = argindex2[nfield] = 0; else { *ptr = '\0'; argindex1[nfield] = diff --git a/src/universe.cpp b/src/universe.cpp index cd079a45c0..ecdd5aa04d 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -40,12 +40,12 @@ Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp) MPI_Comm_size(uworld,&nprocs); uscreen = stdout; - ulogfile = NULL; + ulogfile = nullptr; existflag = 0; nworlds = 0; - procs_per_world = NULL; - root_proc = NULL; + procs_per_world = nullptr; + root_proc = nullptr; memory->create(uni2orig,nprocs,"universe:uni2orig"); for (int i = 0; i < nprocs; i++) uni2orig[i] = i; @@ -95,7 +95,7 @@ void Universe::reorder(char *style, char *arg) if (me == 0) { FILE *fp = fopen(arg,"r"); - if (fp == NULL) + if (fp == nullptr) error->universe_one(FLERR,fmt::format("Cannot open -reorder " "file {}: {}",arg, utils::getsyserror())); @@ -156,7 +156,7 @@ void Universe::reorder(char *style, char *arg) /* ---------------------------------------------------------------------- add 1 or more worlds to universe - str == NULL -> add 1 world with all procs in universe + str == nullptr -> add 1 world with all procs in universe str = NxM -> add N worlds, each with M procs str = P -> add 1 world with P procs ------------------------------------------------------------------------- */ @@ -169,7 +169,7 @@ void Universe::add_world(char *str) n = 1; nper = 0; - if (str != NULL) { + if (str != nullptr) { // check for valid partition argument @@ -184,7 +184,7 @@ void Universe::add_world(char *str) else valid = false; if (valid) { - if ((ptr = strchr(str,'x')) != NULL) { + if ((ptr = strchr(str,'x')) != nullptr) { // 'x' may not be the first or last character diff --git a/src/update.cpp b/src/update.cpp index 399584473c..00e396c6aa 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -48,13 +48,13 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) eflag_global = vflag_global = -1; - unit_style = NULL; + unit_style = nullptr; set_units("lj"); - integrate_style = NULL; - integrate = NULL; - minimize_style = NULL; - minimize = NULL; + integrate_style = nullptr; + integrate = nullptr; + minimize_style = nullptr; + minimize = nullptr; integrate_map = new IntegrateCreatorMap(); diff --git a/src/utils.cpp b/src/utils.cpp index f63deac0dc..e985f9e6e5 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -152,7 +152,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename, Error *error) { char *rv = fgets(s,size,fp); - if (rv == NULL) { // something went wrong + if (rv == nullptr) { // something went wrong char buf[MAXPATHLENBUF]; std::string errmsg; @@ -171,7 +171,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, errmsg += "'"; if (error) error->one(srcname,srcline,errmsg); - if (s) *s = '\0'; // truncate string to empty in case error is NULL + if (s) *s = '\0'; // truncate string to empty in case error is nullptr } return; } @@ -377,19 +377,19 @@ void utils::bounds(const char *file, int line, const std::string &str, nlo = nhi = -1; if (found == std::string::npos) { // contains no '*' - nlo = nhi = strtol(str.c_str(),NULL,10); + nlo = nhi = strtol(str.c_str(),nullptr,10); } else if (str.size() == 1) { // is only '*' nlo = nmin; nhi = nmax; } else if (found == 0) { // is '*j' nlo = nmin; - nhi = strtol(str.substr(1).c_str(),NULL,10); + nhi = strtol(str.substr(1).c_str(),nullptr,10); } else if (str.size() == found+1) { // is 'i*' - nlo = strtol(str.c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); nhi = nmax; } else { // is 'i*j' - nlo = strtol(str.c_str(),NULL,10); - nhi = strtol(str.substr(found+1).c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); + nhi = strtol(str.substr(found+1).c_str(),nullptr,10); } if (error) { @@ -422,7 +422,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; char *ptr1,*ptr2,*str; - ptr1 = NULL; + ptr1 = nullptr; for (iarg = 0; iarg < narg; iarg++) { ptr1 = strchr(arg[iarg],'*'); if (ptr1) break; @@ -1000,10 +1000,10 @@ double utils::timespec2seconds(const std::string ×pec) int utils::date2num(const std::string &date) { std::size_t found = date.find_first_not_of("0123456789 "); - int num = strtol(date.substr(0,found).c_str(),NULL,10); + int num = strtol(date.substr(0,found).c_str(),nullptr,10); auto month = date.substr(found); found = month.find_first_of("0123456789 "); - num += strtol(month.substr(found).c_str(),NULL,10)*10000; + num += strtol(month.substr(found).c_str(),nullptr,10)*10000; if (num < 1000000) num += 20000000; if (strmatch(month,"^Jan")) num += 100; diff --git a/src/utils.h b/src/utils.h index 06aef4654f..cf8952b8a6 100644 --- a/src/utils.h +++ b/src/utils.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { * \param s buffer for storing the result of fgets() * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfgets(const char *srcname, int srcline, char *s, int size, @@ -75,7 +75,7 @@ namespace LAMMPS_NS { * \param size size of data elements read by fread() * \param num number of data elements read by fread() * \param fp file pointer used by fread() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfread(const char *srcname, int srcline, void *s, size_t size, @@ -354,7 +354,7 @@ namespace LAMMPS_NS { * If the potential file has a ``UNITS`` tag in the first line, the * tag's value is compared to the current unit style setting. * The behavior of the function then depends on the value of the - * *auto_convert* parameter. If it is ``NULL``, then the unit values + * *auto_convert* parameter. If it is ``nullptr``, then the unit values * must match or else the open will fail with an error. Otherwise * the bitmask that *auto_convert* points to is used check for * compatibility with possible automatic conversions by the calling @@ -363,8 +363,8 @@ namespace LAMMPS_NS { * * \param name file- or pathname of the potential file * \param lmp pointer to top-level LAMMPS class instance - * \param auto_convert pointer to unit conversion bitmask or NULL - * \return FILE pointer of the opened potential file or NULL*/ + * \param auto_convert pointer to unit conversion bitmask or nullptr + * \return FILE pointer of the opened potential file or nullptr*/ FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert); diff --git a/src/variable.cpp b/src/variable.cpp index 8d4416dfa7..5ceed4dd33 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -86,20 +86,20 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); nvar = maxvar = 0; - names = NULL; - style = NULL; - num = NULL; - which = NULL; - pad = NULL; - reader = NULL; - data = NULL; - dvalue = NULL; - vecs = NULL; + names = nullptr; + style = nullptr; + num = nullptr; + which = nullptr; + pad = nullptr; + reader = nullptr; + data = nullptr; + dvalue = nullptr; + vecs = nullptr; - eval_in_progress = NULL; + eval_in_progress = nullptr; - randomequal = NULL; - randomatom = NULL; + randomequal = nullptr; + randomatom = nullptr; // customize by assigning a precedence level @@ -207,7 +207,7 @@ void Variable::set(int narg, char **arg) num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; // WORLD // num = listed args, which = partition this proc is in, data = copied args @@ -251,7 +251,7 @@ void Variable::set(int narg, char **arg) style[nvar] = ULOOP; num[nvar] = utils::inumeric(FLERR,arg[2],false,lmp); data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; if (narg == 4) { char digits[12]; sprintf(digits,"%d",num[nvar]); @@ -265,12 +265,12 @@ void Variable::set(int narg, char **arg) if (universe->me == 0) { FILE *fp = fopen("tmp.lammps.variable","w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open temporary file for world counter: " + utils::getsyserror()); fprintf(fp,"%d\n",universe->nworlds); fclose(fp); - fp = NULL; + fp = nullptr; } for (int jvar = 0; jvar < nvar; jvar++) @@ -355,7 +355,7 @@ void Variable::set(int narg, char **arg) // ATOMFILE for numbers // which = 1st value - // data = NULL + // data = nullptr } else if (strcmp(arg[1],"atomfile") == 0) { if (narg != 3) error->all(FLERR,"Illegal variable command"); @@ -366,7 +366,7 @@ void Variable::set(int narg, char **arg) which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; reader[nvar] = new VarReader(lmp,arg[0],arg[2],ATOMFILE); int flag = reader[nvar]->read_peratom(); if (flag) error->all(FLERR,"Atomfile variable could not read values"); @@ -706,7 +706,7 @@ int Variable::next(int narg, char **arg) char buf[64]; for (int loopmax = 0; loopmax < 100; ++loopmax) { fp = fopen("tmp.lammps.variable.lock","r"); - if (fp == NULL) goto uloop_again; + if (fp == nullptr) goto uloop_again; buf[0] = buf[1] = '\0'; fread(buf,1,64,fp); @@ -731,7 +731,7 @@ int Variable::next(int narg, char **arg) fprintf(fp,"%d\n",nextindex+1); //printf("WRITE %d %d\n",universe->me,nextindex+1); fclose(fp); - fp = NULL; + fp = nullptr; rename("tmp.lammps.variable.lock","tmp.lammps.variable"); if (universe->uscreen) fprintf(universe->uscreen, @@ -840,15 +840,15 @@ int Variable::vectorstyle(int ivar) check if variable with name is PYTHON and matches funcname called by Python class before it invokes a Python function return data storage so Python function can return a value for this variable - return NULL if not a match + return nullptr if not a match ------------------------------------------------------------------------- */ char *Variable::pythonstyle(char *name, char *funcname) { int ivar = find(name); - if (ivar < 0) return NULL; - if (style[ivar] != PYTHON) return NULL; - if (strcmp(data[ivar][0],funcname) != 0) return NULL; + if (ivar < 0) return nullptr; + if (style[ivar] != PYTHON) return nullptr; + if (strcmp(data[ivar][0],funcname) != 0) return nullptr; return data[ivar][1]; } @@ -873,23 +873,23 @@ int Variable::internalstyle(int ivar) if GETENV, query environment and put result in str if PYTHON, evaluate Python function, it will put result in str if INTERNAL, convert dvalue and put result in str - if ATOM or ATOMFILE or VECTOR, return NULL - return NULL if no variable with name, or which value is bad, + if ATOM or ATOMFILE or VECTOR, return nullptr + return nullptr if no variable with name, or which value is bad, caller must respond ------------------------------------------------------------------------- */ char *Variable::retrieve(const char *name) { int ivar = find(name); - if (ivar < 0) return NULL; - if (which[ivar] >= num[ivar]) return NULL; + if (ivar < 0) return nullptr; + if (which[ivar] >= num[ivar]) return nullptr; if (eval_in_progress[ivar]) print_var_error(FLERR,"Variable has a circular dependency",ivar); eval_in_progress[ivar] = 1; - char *str = NULL; + char *str = nullptr; if (style[ivar] == INDEX || style[ivar] == WORLD || style[ivar] == UNIVERSE || style[ivar] == STRING || style[ivar] == SCALARFILE) { @@ -908,19 +908,19 @@ char *Variable::retrieve(const char *name) strcpy(data[ivar][0],result); str = data[ivar][0]; } else if (style[ivar] == EQUAL) { - double answer = evaluate(data[ivar][0],NULL,ivar); + double answer = evaluate(data[ivar][0],nullptr,ivar); sprintf(data[ivar][1],"%.15g",answer); str = data[ivar][1]; } else if (style[ivar] == FORMAT) { int jvar = find(data[ivar][0]); - if (jvar == -1) return NULL; - if (!equalstyle(jvar)) return NULL; + if (jvar == -1) return nullptr; + if (!equalstyle(jvar)) return nullptr; double answer = compute_equal(jvar); sprintf(data[ivar][2],data[ivar][1],answer); str = data[ivar][2]; } else if (style[ivar] == GETENV) { const char *result = getenv(data[ivar][0]); - if (result == NULL) result = (const char *) ""; + if (result == nullptr) result = (const char *) ""; int n = strlen(result) + 1; if (n > VALUELENGTH) { delete [] data[ivar][1]; @@ -943,7 +943,7 @@ char *Variable::retrieve(const char *name) sprintf(data[ivar][0],"%.15g",dvalue[ivar]); str = data[ivar][0]; } else if (style[ivar] == ATOM || style[ivar] == ATOMFILE || - style[ivar] == VECTOR) return NULL; + style[ivar] == VECTOR) return nullptr; eval_in_progress[ivar] = 0; @@ -965,7 +965,7 @@ double Variable::compute_equal(int ivar) eval_in_progress[ivar] = 1; double value = 0.0; - if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL,ivar); + if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],nullptr,ivar); else if (style[ivar] == INTERNAL) value = dvalue[ivar]; else if (style[ivar] == PYTHON) { int ifunc = python->find(data[ivar][0]); @@ -987,7 +987,7 @@ double Variable::compute_equal(int ivar) double Variable::compute_equal(char *str) { - return evaluate(str,NULL,-1); + return evaluate(str,nullptr,-1); } /* ---------------------------------------------------------------------- @@ -1000,7 +1000,7 @@ double Variable::compute_equal(char *str) void Variable::compute_atom(int ivar, int igroup, double *result, int stride, int sumflag) { - Tree *tree = NULL; + Tree *tree = nullptr; double *vstore; if (eval_in_progress[ivar]) @@ -1014,7 +1014,7 @@ void Variable::compute_atom(int ivar, int igroup, collapse_tree(tree); } else vstore = reader[ivar]->fixstore->vstore; - if (result == NULL) { + if (result == nullptr) { if (style[ivar] == ATOM) free_tree(tree); eval_in_progress[ivar] = 0; return; @@ -1073,7 +1073,7 @@ void Variable::compute_atom(int ivar, int igroup, int Variable::compute_vector(int ivar, double **result) { - Tree *tree = NULL; + Tree *tree = nullptr; if (vecs[ivar].currentstep == update->ntimestep) { *result = vecs[ivar].values; return vecs[ivar].n; @@ -1166,7 +1166,7 @@ void Variable::grow() reader = (VarReader **) memory->srealloc(reader,maxvar*sizeof(VarReader *),"var:reader"); - for (int i = old; i < maxvar; i++) reader[i] = NULL; + for (int i = old; i < maxvar; i++) reader[i] = nullptr; data = (char ***) memory->srealloc(data,maxvar*sizeof(char **),"var:data"); memory->grow(dvalue,maxvar,"var:dvalue"); @@ -1175,7 +1175,7 @@ void Variable::grow() for (int i = old; i < maxvar; i++) { vecs[i].nmax = 0; vecs[i].currentstep = -1; - vecs[i].values = NULL; + vecs[i].values = nullptr; } memory->grow(eval_in_progress,maxvar,"var:eval_in_progress"); @@ -1214,9 +1214,9 @@ void Variable::copy(int narg, char **from, char **to) compute = c_ID, c_ID[i], c_ID[i][j] fix = f_ID, f_ID[i], f_ID[i][j] variable = v_name, v_name[i] - equal-style variables passes in tree = NULL: + equal-style variables passes in tree = nullptr: evaluate the formula, return result as a double - atom-style and vector-style variables pass in tree = non-NULL: + atom-style and vector-style variables pass in tree = non-nullptr: parse the formula but do not evaluate it create a parse tree and return it ------------------------------------------------------------------------- */ @@ -1261,10 +1261,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) // evaluate contents and push on stack if (tree) { - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(contents,&newtree,ivar); treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = evaluate(contents,NULL,ivar); + } else argstack[nargstack++] = evaluate(contents,nullptr,ivar); delete [] contents; @@ -1297,7 +1297,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(number); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->extra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(number); @@ -1389,7 +1389,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1418,7 +1418,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1450,7 +1450,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1459,7 +1459,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->vector_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1483,7 +1483,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_vector; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1491,7 +1491,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->array_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1515,7 +1515,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_array_rows; newtree->nstride = compute->size_array_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1533,7 +1533,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= INVOKED_PERATOM; } - peratom2global(1,NULL,compute->vector_atom,1,index1, + peratom2global(1,nullptr,compute->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // c_ID[i][j] = scalar from per-atom array @@ -1554,11 +1554,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } if (compute->array_atom) - peratom2global(1,NULL,&compute->array_atom[0][index2-1], + peratom2global(1,nullptr,&compute->array_atom[0][index2-1], compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1567,7 +1567,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1587,7 +1587,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = compute->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1596,7 +1596,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1619,10 +1619,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (compute->array_atom) newtree->array = &compute->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = compute->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1686,7 +1686,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1708,7 +1708,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1733,7 +1733,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1745,7 +1745,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed at " "compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1767,7 +1767,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1778,7 +1778,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1800,7 +1800,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1814,7 +1814,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - peratom2global(1,NULL,fix->vector_atom,1,index1, + peratom2global(1,nullptr,fix->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // f_ID[i][j] = scalar from per-atom array @@ -1831,11 +1831,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) "at a compatible time",ivar); if (fix->array_atom) - peratom2global(1,NULL,&fix->array_atom[0][index2-1], + peratom2global(1,nullptr,&fix->array_atom[0][index2-1], fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1844,7 +1844,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && fix->peratom_flag && fix->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (update->whichflag > 0 && @@ -1857,7 +1857,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = fix->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1866,7 +1866,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && fix->peratom_flag && fix->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (index1 > fix->size_peratom_cols) @@ -1882,10 +1882,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (fix->array_atom) newtree->array = &fix->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = fix->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1929,7 +1929,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1941,14 +1941,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) style[ivar] != ATOMFILE && style[ivar] != VECTOR) { char *var = retrieve(word+2); - if (var == NULL) + if (var == nullptr) print_var_error(FLERR,"Invalid variable evaluation in " "variable formula",ivar); if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(var); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(var); @@ -1958,14 +1958,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOM) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atom-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Atom-style variable in " "vector-style variable formula",ivar); - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(data[ivar][0],&newtree,ivar); treestack[ntreestack++] = newtree; @@ -1973,7 +1973,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1985,7 +1985,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = reader[ivar]->fixstore->vstore; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1994,7 +1994,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == VECTOR) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Vector-style variable in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -2010,7 +2010,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -2023,7 +2023,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) double *result; memory->create(result,atom->nlocal,"variable:result"); compute_atom(ivar,0,result,1,0); - peratom2global(1,NULL,result,1,index, + peratom2global(1,nullptr,result,1,index, tree,treestack,ntreestack,argstack,nargstack); memory->destroy(result); @@ -2031,7 +2031,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket && style[ivar] == ATOMFILE) { - peratom2global(1,NULL,reader[ivar]->fixstore->vstore,1,index, + peratom2global(1,nullptr,reader[ivar]->fixstore->vstore,1,index, tree,treestack,ntreestack,argstack,nargstack); // v_name[N] = scalar from vector-style variable @@ -2050,7 +2050,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = vec[m-1]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = vec[m-1]; @@ -2098,7 +2098,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) tagint id = int_between_brackets(ptr,1); i = ptr-str+1; - peratom2global(0,word,NULL,0,id, + peratom2global(0,word,nullptr,0,id, tree,treestack,ntreestack,argstack,nargstack); // ---------------- @@ -2122,7 +2122,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2144,7 +2144,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2224,7 +2224,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->type = opprevious; if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; - newtree->second = NULL; + newtree->second = nullptr; newtree->nextra = 0; } else { newtree->second = treestack[--ntreestack]; @@ -2627,7 +2627,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->type == RANDOM) { collapse_tree(tree->first); collapse_tree(tree->second); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -2641,7 +2641,7 @@ double Variable::collapse_tree(Tree *tree) double sigma = collapse_tree(tree->second); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3021,7 +3021,7 @@ double Variable::eval_tree(Tree *tree, int i) if (tree->type == RANDOM) { double lower = eval_tree(tree->first,i); double upper = eval_tree(tree->second,i); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3034,7 +3034,7 @@ double Variable::eval_tree(Tree *tree, int i) double sigma = eval_tree(tree->second,i); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3344,7 +3344,7 @@ tagint Variable::int_between_brackets(char *&ptr, int varallow) error->all(FLERR,"Invalid variable name in variable formula"); char *var = retrieve(id); - if (var == NULL) + if (var == nullptr) error->all(FLERR,"Invalid variable evaluation in variable formula"); index = static_cast (atof(var)); @@ -3399,15 +3399,15 @@ int Variable::math_function(char *word, char *contents, Tree **tree, char *args[MAXFUNCARG]; int narg = parse_args(contents,args); - Tree *newtree = NULL; + Tree *newtree = nullptr; double value1,value2; double values[MAXFUNCARG-2]; if (tree) { newtree = new Tree(); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; - Tree *argtree = NULL; + Tree *argtree = nullptr; evaluate(args[0],&argtree,ivar); newtree->first = argtree; if (narg > 1) { @@ -3425,12 +3425,12 @@ int Variable::math_function(char *word, char *contents, Tree **tree, treestack[ntreestack++] = newtree; } else { - value1 = evaluate(args[0],NULL,ivar); + value1 = evaluate(args[0],nullptr,ivar); if (narg > 1) { - value2 = evaluate(args[1],NULL,ivar); + value2 = evaluate(args[1],nullptr,ivar); if (narg > 2) { for (int i = 2; i < narg; i++) - values[i-2] = evaluate(args[i],NULL,ivar); + values[i-2] = evaluate(args[i],nullptr,ivar); } } } @@ -3530,7 +3530,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = RANDOM; else { - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -3545,7 +3545,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, else { if (value2 < 0.0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -4029,7 +4029,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4107,8 +4107,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, if (narg != 1) print_var_error(FLERR,"Invalid special function in variable formula",ivar); - Compute *compute = NULL; - Fix *fix = NULL; + Compute *compute = nullptr; + Fix *fix = nullptr; int ivar = -1; int index,nvec,nstride; char *ptr1,*ptr2; @@ -4239,7 +4239,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, double *vec; if (index) { if (compute->array) vec = &compute->array[0][index-1]; - else vec = NULL; + else vec = nullptr; } else vec = compute->vector; int j = 0; @@ -4320,7 +4320,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4328,7 +4328,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // mask special functions } else if (strcmp(word,"gmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Gmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4341,12 +4341,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = GMASK; newtree->ivalue1 = group->bitmask[igroup]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"rmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Rmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4358,12 +4358,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = RMASK; newtree->ivalue1 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"grmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Grmask function in equal-style " "variable formula",ivar); if (narg != 2) @@ -4379,7 +4379,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->type = GRMASK; newtree->ivalue1 = group->bitmask[igroup]; newtree->ivalue2 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4409,7 +4409,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4419,7 +4419,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // set selfalloc = 1 so result will be deleted by free_tree() after eval } else if (style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile variable in " "equal-style variable formula",ivar); @@ -4435,7 +4435,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->array = result; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4456,7 +4456,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4475,7 +4475,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4494,7 +4494,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4579,7 +4579,7 @@ void Variable::peratom2global(int flag, char *word, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4622,14 +4622,14 @@ int Variable::is_atom_vector(char *word) void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntreestack) { - if (tree == NULL) + if (tree == nullptr) error->all(FLERR,"Atom vector in equal-style variable formula"); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; newtree->nstride = 3; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4756,7 +4756,7 @@ int Variable::parse_args(char *str, char **args) /* ---------------------------------------------------------------------- find next comma in str skip commas inside one or more nested parenthesis - only return ptr to comma at level 0, else NULL if not found + only return ptr to comma at level 0, else nullptr if not found ------------------------------------------------------------------------- */ char *Variable::find_next_comma(char *str) @@ -4767,7 +4767,7 @@ char *Variable::find_next_comma(char *str) else if (')' == *p) level--; else if (',' == *p && !level) return p; } - return NULL; + return nullptr; } @@ -5069,11 +5069,11 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : { me = comm->me; style = flag; - fp = NULL; + fp = nullptr; if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file variable file {}: {}", file, utils::getsyserror())); } @@ -5082,9 +5082,9 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : // allocate a new fix STORE, so they persist // id = variable-ID + VARIABLE_STORE, fix group = all - fixstore = NULL; - id_fix = NULL; - buffer = NULL; + fixstore = nullptr; + id_fix = nullptr; + buffer = nullptr; if (style == ATOMFILE) { if (atom->map_style == 0) @@ -5109,7 +5109,7 @@ VarReader::~VarReader() { if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // check modify in case all fixes have already been deleted @@ -5137,12 +5137,12 @@ int VarReader::read_scalar(char *str) if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } @@ -5180,12 +5180,12 @@ int VarReader::read_peratom() char str[MAXLINE]; if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } diff --git a/src/variable.h b/src/variable.h index efffacc7bb..58548bc276 100644 --- a/src/variable.h +++ b/src/variable.h @@ -93,9 +93,9 @@ class Variable : protected Pointers { Tree **extra; // ptrs further down tree for nextra args Tree() : - array(NULL), iarray(NULL), barray(NULL), + array(nullptr), iarray(nullptr), barray(nullptr), selfalloc(0), ivalue1(0), ivalue2(0), nextra(0), - first(NULL), second(NULL), extra(NULL) {} + first(nullptr), second(nullptr), extra(nullptr) {} }; int compute_python(int); diff --git a/src/velocity.cpp b/src/velocity.cpp index eafa98cb7c..db396fb7e3 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -82,7 +82,7 @@ void Velocity::command(int narg, char **arg) // set defaults - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -147,7 +147,7 @@ void Velocity::init_external(const char *extgroup) if (igroup == -1) error->all(FLERR,"Could not find velocity group ID"); groupbit = group->bitmask[igroup]; - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -179,18 +179,18 @@ void Velocity::create(double t_desired, int seed) } } - // if temperature = NULL or bias_flag set, + // if temperature = nullptr or bias_flag set, // create a new ComputeTemp with the velocity group int tcreate_flag = 0; - Compute *temperature_nobias = NULL; + Compute *temperature_nobias = nullptr; - if (temperature == NULL || bias_flag) { + if (temperature == nullptr || bias_flag) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; arg[2] = (char *) "temp"; - if (temperature == NULL) { + if (temperature == nullptr) { temperature = new ComputeTemp(lmp,3,arg); tcreate_flag = 1; } else temperature_nobias = new ComputeTemp(lmp,3,arg); @@ -245,7 +245,7 @@ void Velocity::create(double t_desired, int seed) int m; double vx,vy,vz,factor; - RanPark *random = NULL; + RanPark *random = nullptr; if (loop_flag == ALL) { @@ -368,7 +368,7 @@ void Velocity::create(double t_desired, int seed) // no-bias compute calculates temp only for new thermal velocities double t; - if ((bias_flag == 0) || (temperature_nobias == NULL)) + if ((bias_flag == 0) || (temperature_nobias == nullptr)) t = temperature->compute_scalar(); else t = temperature_nobias->compute_scalar(); rescale(t,t_desired); @@ -417,7 +417,7 @@ void Velocity::set(int /*narg*/, char **arg) // parse 3 args xstyle = ystyle = zstyle = CONSTANT; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -501,7 +501,7 @@ void Velocity::set(int /*narg*/, char **arg) // allocate vfield array if necessary - double **vfield = NULL; + double **vfield = nullptr; if (varflag == ATOM) memory->create(vfield,atom->nlocal,3,"velocity:vfield"); // set velocities via constants @@ -531,17 +531,17 @@ void Velocity::set(int /*narg*/, char **arg) if (xstyle == EQUAL) vx = input->variable->compute_equal(xvar); else if (xstyle == ATOM) { if (vfield) input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0); - else input->variable->compute_atom(xvar,igroup,NULL,3,0); + else input->variable->compute_atom(xvar,igroup,nullptr,3,0); } if (ystyle == EQUAL) vy = input->variable->compute_equal(yvar); else if (ystyle == ATOM) { if (vfield) input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0); - else input->variable->compute_atom(yvar,igroup,NULL,3,0); + else input->variable->compute_atom(yvar,igroup,nullptr,3,0); } if (zstyle == EQUAL) vz = input->variable->compute_equal(zvar); else if (zstyle == ATOM) { if (vfield) input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0); - else input->variable->compute_atom(zvar,igroup,NULL,3,0); + else input->variable->compute_atom(zvar,igroup,nullptr,3,0); } for (int i = 0; i < nlocal; i++) @@ -580,10 +580,10 @@ void Velocity::scale(int /*narg*/, char **arg) { double t_desired = utils::numeric(FLERR,arg[0],false,lmp); - // if temperature = NULL, create a new ComputeTemp with the velocity group + // if temperature = nullptr, create a new ComputeTemp with the velocity group int tflag = 0; - if (temperature == NULL) { + if (temperature == nullptr) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; @@ -901,7 +901,7 @@ void Velocity::options(int narg, char **arg) // error check - if (bias_flag && temperature == NULL) + if (bias_flag && temperature == nullptr) error->all(FLERR,"Cannot use velocity bias command without temp keyword"); if (bias_flag && temperature->tempbias == 0) error->all(FLERR,"Velocity temperature ID does calculate a velocity bias"); diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 121a2ed1fd..3e247f19ce 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -56,7 +56,7 @@ void WriteCoeff::command(int narg, char **arg) char str[256], coeff[256]; FILE *one = fopen(file,"wb+"); - if (one == NULL) + if (one == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file, utils::getsyserror())); @@ -90,7 +90,7 @@ void WriteCoeff::command(int narg, char **arg) rewind(one); FILE *two = fopen(file+4,"w"); - if (two == NULL) + if (two == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file+4, utils::getsyserror())); @@ -99,15 +99,15 @@ void WriteCoeff::command(int narg, char **arg) while(1) { int coeff_mode = REGULAR_MODE; - if (fgets(str,256,one) == NULL) break; + if (fgets(str,256,one) == nullptr) break; // some coeffs need special treatment - if (strstr(str,"class2") != NULL) { - if (strstr(str,"angle_style") != NULL) + if (strstr(str,"class2") != nullptr) { + if (strstr(str,"angle_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"dihedral_style") != NULL) + else if (strstr(str,"dihedral_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"improper_style") != NULL) + else if (strstr(str,"improper_style") != nullptr) coeff_mode = CLASS2_MODE; } diff --git a/src/write_data.cpp b/src/write_data.cpp index 53d277b723..6f22547b80 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -153,21 +153,21 @@ void WriteData::write(const std::string &file) // may be different than atom->nbonds,nangles, etc. if broken/turned-off if (atom->molecular == 1 && (atom->nbonds || atom->nbondtypes)) { - nbonds_local = atom->avec->pack_bond(NULL); + nbonds_local = atom->avec->pack_bond(nullptr); MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->nangles || atom->nangletypes)) { - nangles_local = atom->avec->pack_angle(NULL); + nangles_local = atom->avec->pack_angle(nullptr); MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->ndihedrals || atom->ndihedraltypes)) { - ndihedrals_local = atom->avec->pack_dihedral(NULL); + ndihedrals_local = atom->avec->pack_dihedral(nullptr); MPI_Allreduce(&ndihedrals_local,&ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->nimpropers || atom->nimpropertypes)) { - nimpropers_local = atom->avec->pack_improper(NULL); + nimpropers_local = atom->avec->pack_improper(nullptr); MPI_Allreduce(&nimpropers_local,&nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); } @@ -175,7 +175,7 @@ void WriteData::write(const std::string &file) if (me == 0) { fp = fopen(file.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open data file {}: {}", file, utils::getsyserror())); } @@ -665,7 +665,7 @@ void WriteData::bonus(int flag) // communication buffer for all my Bonus info // maxvalues = largest buffer needed by any proc - int nvalues = atom->avec->pack_data_bonus(NULL,flag); + int nvalues = atom->avec->pack_data_bonus(nullptr,flag); int maxvalues; MPI_Allreduce(&nvalues,&maxvalues,1,MPI_INT,MPI_MAX,world); diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 56839a2f5e..fd359ec2ba 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -45,7 +45,7 @@ void WriteDump::command(int narg, char **arg) // create the Dump instance // create dump command line with extra required args - Dump *dump = NULL; + Dump *dump = nullptr; char **dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 256d7a377e..01ad917e86 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -49,7 +49,7 @@ WriteRestart::WriteRestart(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); multiproc = 0; noinit = 0; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -231,7 +231,7 @@ void WriteRestart::write(std::string file) if (multiproc) base.replace(base.find("%"),1,"base"); fp = fopen(base.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", base, utils::getsyserror())); } @@ -286,7 +286,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } std::string multiname = file; @@ -294,7 +294,7 @@ void WriteRestart::write(std::string file) if (filewriter) { fp = fopen(multiname.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", multiname, utils::getsyserror())); write_int(PROCSPERFILE,nclusterprocs); @@ -363,7 +363,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } mpiio->openForWrite(file.c_str()); mpiio->write(headerOffset,send_size,buf); @@ -393,7 +393,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } else { MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE); @@ -661,7 +661,7 @@ void WriteRestart::write_double(int flag, double value) } /* ---------------------------------------------------------------------- - write a flag and a char string (including NULL) into restart file + write a flag and a char string (including nullptr) into restart file ------------------------------------------------------------------------- */ void WriteRestart::write_string(int flag, const char *value) -- GitLab From 13be8085e5948669cd8c250c846744028bfa4bc2 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 08:53:44 -0600 Subject: [PATCH 02/21] T2345: Replace instances of NULL with nullptr Per guidance from Axel, revert lib/kokkos and lib/colvars to remove nullptr changes. --- lib/colvars/colvar.cpp | 20 +++---- lib/colvars/colvaratoms.cpp | 8 +-- lib/colvars/colvarbias.cpp | 26 ++++---- lib/colvars/colvarbias.h | 4 +- lib/colvars/colvarbias_abf.cpp | 42 ++++++------- lib/colvars/colvarbias_histogram.cpp | 4 +- lib/colvars/colvarbias_meta.cpp | 46 +++++++------- lib/colvars/colvarcomp.cpp | 8 +-- lib/colvars/colvarcomp_coordnums.cpp | 38 ++++++------ lib/colvars/colvarcomp_distances.cpp | 2 +- lib/colvars/colvardeps.cpp | 2 +- lib/colvars/colvargrid.cpp | 14 ++--- lib/colvars/colvarmodule.cpp | 60 +++++++++---------- lib/colvars/colvarmodule.h | 6 +- lib/colvars/colvarparams.cpp | 6 +- lib/colvars/colvarparse.cpp | 10 ++-- lib/colvars/colvarparse.h | 8 +-- lib/colvars/colvarproxy.cpp | 16 ++--- lib/colvars/colvarproxy.h | 2 +- lib/colvars/colvarscript.cpp | 20 +++---- lib/colvars/colvarscript.h | 2 +- lib/colvars/colvartypes.h | 4 +- lib/colvars/lepton/include/lepton/Operation.h | 12 ++-- lib/colvars/lepton/src/CompiledExpression.cpp | 8 +-- lib/colvars/lepton/src/ExpressionTreeNode.cpp | 8 +-- lib/colvars/lepton/src/ParsedExpression.cpp | 2 +- lib/kokkos/cmake/compile_tests/pthread.cpp | 6 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 2 +- lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp | 2 +- .../core/src/impl/Kokkos_SharedAlloc.cpp | 2 +- lib/kokkos/core/unit_test/TestCTestDevice.cpp | 2 +- 31 files changed, 196 insertions(+), 196 deletions(-) diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index 61e83f44ab..1002dc35d8 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -22,7 +22,7 @@ colvar::colvar() { - runave_os = nullptr; + runave_os = NULL; prev_timestep = -1L; after_restart = false; @@ -62,7 +62,7 @@ int colvar::init(std::string const &conf) get_keyval(conf, "name", this->name, (std::string("colvar")+cvm::to_str(cv->variables()->size()))); - if ((cvm::colvar_by_name(this->name) != nullptr) && + if ((cvm::colvar_by_name(this->name) != NULL) && (cvm::colvar_by_name(this->name) != this)) { cvm::error("Error: this colvar cannot have the same name, \""+this->name+ "\", as another colvar.\n", @@ -744,7 +744,7 @@ template int colvar::init_components_type(std::string c : ".\n")); cvm::increase_depth(); cvc *cvcp = new def_class_name(def_conf); - if (cvcp != nullptr) { + if (cvcp != NULL) { cvcs.push_back(cvcp); cvcp->check_keywords(def_conf, def_config_key); cvcp->config_key = def_config_key; @@ -994,7 +994,7 @@ int colvar::parse_analysis(std::string const &conf) acf_type = acf_vel; enable(f_cv_fdiff_velocity); colvar *cv2 = cvm::colvar_by_name(acf_colvar_name); - if (cv2 == nullptr) { + if (cv2 == NULL) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -1215,14 +1215,14 @@ colvar::~colvar() for (std::vector::iterator cei = value_evaluators.begin(); cei != value_evaluators.end(); ++cei) { - if (*cei != nullptr) delete (*cei); + if (*cei != NULL) delete (*cei); } value_evaluators.clear(); for (std::vector::iterator gei = gradient_evaluators.begin(); gei != gradient_evaluators.end(); ++gei) { - if (*gei != nullptr) delete (*gei); + if (*gei != NULL) delete (*gei); } gradient_evaluators.clear(); #endif @@ -1972,7 +1972,7 @@ void const *colvar::get_cvc_param_ptr(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return nullptr; + return NULL; } @@ -1983,7 +1983,7 @@ colvarvalue const *colvar::get_cvc_param_grad(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param_grad() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return nullptr; + return NULL; } @@ -2422,7 +2422,7 @@ int colvar::calc_acf() // the pointer to each vector is changed at every step colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name); - if (cfcv == nullptr) { + if (cfcv == NULL) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -2660,7 +2660,7 @@ int colvar::calc_runave() if ((*x_history_p).size() >= runave_length-1) { - if (runave_os == nullptr) { + if (runave_os == NULL) { if (runave_outfile.size() == 0) { runave_outfile = std::string(cvm::output_prefix()+"."+ this->name+".runave.traj"); diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index 2796f3d28b..180fc69a85 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -105,7 +105,7 @@ cvm::atom_group::~atom_group() if (fitting_group) { delete fitting_group; - fitting_group = nullptr; + fitting_group = NULL; } cvm::main()->unregister_named_atom_group(this); @@ -217,7 +217,7 @@ int cvm::atom_group::init() b_center = false; b_rotate = false; b_user_defined_fit = false; - fitting_group = nullptr; + fitting_group = NULL; noforce = false; @@ -368,7 +368,7 @@ int cvm::atom_group::parse(std::string const &group_conf) // Optional group name will let other groups reuse atom definition if (get_keyval(group_conf, "name", name)) { - if ((cvm::atom_group_by_name(this->name) != nullptr) && + if ((cvm::atom_group_by_name(this->name) != NULL) && (cvm::atom_group_by_name(this->name) != this)) { cvm::error("Error: this atom group cannot have the same name, \""+this->name+ "\", as another atom group.\n", @@ -395,7 +395,7 @@ int cvm::atom_group::parse(std::string const &group_conf) std::string atoms_of = ""; if (get_keyval(group_conf, "atomsOfGroup", atoms_of)) { atom_group * ag = atom_group_by_name(atoms_of); - if (ag == nullptr) { + if (ag == NULL) { cvm::error("Error: cannot find atom group with name " + atoms_of + ".\n"); return COLVARS_ERROR; } diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index cdbc13699b..09bcca01b5 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -47,7 +47,7 @@ int colvarbias::init(std::string const &conf) { colvarbias *bias_with_name = cvm::bias_by_name(this->name); - if (bias_with_name != nullptr) { + if (bias_with_name != NULL) { if ((bias_with_name->rank != this->rank) || (bias_with_name->bias_type != this->bias_type)) { cvm::error("Error: this bias cannot have the same name, \""+this->name+ @@ -295,8 +295,8 @@ int colvarbias::update() colvar_values[i] = colvars[i]->value(); } - error_code |= calc_energy(nullptr); - error_code |= calc_forces(nullptr); + error_code |= calc_energy(NULL); + error_code |= calc_forces(NULL); return error_code; } @@ -547,8 +547,8 @@ colvarbias_ti::colvarbias_ti(char const *key) : colvarbias(key) { provide(f_cvb_calc_ti_samples); - ti_avg_forces = nullptr; - ti_count = nullptr; + ti_avg_forces = NULL; + ti_count = NULL; } @@ -560,13 +560,13 @@ colvarbias_ti::~colvarbias_ti() int colvarbias_ti::clear_state_data() { - if (ti_avg_forces != nullptr) { + if (ti_avg_forces != NULL) { delete ti_avg_forces; - ti_avg_forces = nullptr; + ti_avg_forces = NULL; } - if (ti_count != nullptr) { + if (ti_count != NULL) { delete ti_count; - ti_count = nullptr; + ti_count = NULL; } return COLVARS_OK; } @@ -622,7 +622,7 @@ int colvarbias_ti::init(std::string const &conf) int colvarbias_ti::init_grids() { if (is_enabled(f_cvb_calc_ti_samples)) { - if (ti_avg_forces == nullptr) { + if (ti_avg_forces == NULL) { ti_bin.resize(num_variables()); ti_system_forces.resize(num_variables()); for (size_t icv = 0; icv < num_variables(); icv++) { @@ -643,7 +643,7 @@ int colvarbias_ti::init_grids() int colvarbias_ti::update() { - return update_system_forces(nullptr); + return update_system_forces(NULL); } @@ -679,7 +679,7 @@ int colvarbias_ti::update_system_forces(std::vector const ti_system_forces[i] = variables(i)->total_force(); } else { ti_system_forces[i] = variables(i)->total_force() - - ((subtract_forces != nullptr) ? + ((subtract_forces != NULL) ? (*subtract_forces)[i] : previous_colvar_forces[i]); } } @@ -759,7 +759,7 @@ int colvarbias_ti::write_output_files() std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name; - std::ostream *os = nullptr; + std::ostream *os = NULL; if (is_enabled(f_cvb_write_ti_samples)) { std::string const ti_count_file_name(ti_output_prefix+".ti.count"); diff --git a/lib/colvars/colvarbias.h b/lib/colvars/colvarbias.h index 20c346f81c..5179c42853 100644 --- a/lib/colvars/colvarbias.h +++ b/lib/colvars/colvarbias.h @@ -58,12 +58,12 @@ public: virtual int update(); /// Compute the energy of the bias - /// Uses the vector of colvar values provided if not nullptr, and the values + /// Uses the vector of colvar values provided if not NULL, and the values /// currently cached in the bias instance otherwise virtual int calc_energy(std::vector const *values); /// Compute the forces due to the bias - /// Uses the vector of colvar values provided if not nullptr, and the values + /// Uses the vector of colvar values provided if not NULL, and the values /// currently cached in the bias instance otherwise virtual int calc_forces(std::vector const *values); diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index 9926579a8d..5382a828f7 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -18,16 +18,16 @@ colvarbias_abf::colvarbias_abf(char const *key) b_UI_estimator(false), b_CZAR_estimator(false), pabf_freq(0), - system_force(nullptr), - gradients(nullptr), - samples(nullptr), - pmf(nullptr), - z_gradients(nullptr), - z_samples(nullptr), - czar_gradients(nullptr), - czar_pmf(nullptr), - last_gradients(nullptr), - last_samples(nullptr) + system_force(NULL), + gradients(NULL), + samples(NULL), + pmf(NULL), + z_gradients(NULL), + z_samples(NULL), + czar_gradients(NULL), + czar_pmf(NULL), + last_gradients(NULL), + last_samples(NULL) { } @@ -261,37 +261,37 @@ colvarbias_abf::~colvarbias_abf() { if (samples) { delete samples; - samples = nullptr; + samples = NULL; } if (gradients) { delete gradients; - gradients = nullptr; + gradients = NULL; } if (pmf) { delete pmf; - pmf = nullptr; + pmf = NULL; } if (z_samples) { delete z_samples; - z_samples = nullptr; + z_samples = NULL; } if (z_gradients) { delete z_gradients; - z_gradients = nullptr; + z_gradients = NULL; } if (czar_gradients) { delete czar_gradients; - czar_gradients = nullptr; + czar_gradients = NULL; } if (czar_pmf) { delete czar_pmf; - czar_pmf = nullptr; + czar_pmf = NULL; } // shared ABF @@ -299,17 +299,17 @@ colvarbias_abf::~colvarbias_abf() // but now we can call shared externally if (last_samples) { delete last_samples; - last_samples = nullptr; + last_samples = NULL; } if (last_gradients) { delete last_gradients; - last_gradients = nullptr; + last_gradients = NULL; } if (system_force) { delete [] system_force; - system_force = nullptr; + system_force = NULL; } } @@ -488,7 +488,7 @@ int colvarbias_abf::update() } /// Add the bias energy for 1D ABF - bias_energy = calc_energy(nullptr); + bias_energy = calc_energy(NULL); return COLVARS_OK; } diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 44862ba256..92985b0f61 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -15,7 +15,7 @@ colvarbias_histogram::colvarbias_histogram(char const *key) : colvarbias(key), - grid(nullptr), out_name("") + grid(NULL), out_name("") { provide(f_cvb_bypass_ext_lagrangian); // Allow histograms of actual cv for extended-Lagrangian } @@ -105,7 +105,7 @@ colvarbias_histogram::~colvarbias_histogram() { if (grid) { delete grid; - grid = nullptr; + grid = NULL; } } diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 03c1886a8f..05f293d872 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key) : colvarbias(key), colvarbias_ti(key) { new_hills_begin = hills.end(); - hills_traj_os = nullptr; + hills_traj_os = NULL; hill_width = 0.0; @@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key) use_grids = true; grids_freq = 0; rebin_grids = false; - hills_energy = nullptr; - hills_energy_gradients = nullptr; + hills_energy = NULL; + hills_energy_gradients = NULL; dump_fes = true; keep_hills = false; @@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf) get_keyval(conf, "keepHills", keep_hills, keep_hills); get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save); - if (hills_energy == nullptr) { + if (hills_energy == NULL) { hills_energy = new colvar_grid_scalar(colvars); hills_energy_gradients = new colvar_grid_gradient(colvars); } @@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf) int colvarbias_meta::init_ebmeta_params(std::string const &conf) { // for ebmeta - target_dist = nullptr; + target_dist = NULL; get_keyval(conf, "ebMeta", ebmeta, false); if(ebmeta){ if (use_grids && expand_grids) { @@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta() if (hills_traj_os) { proxy->close_output_stream(hills_traj_file_name()); - hills_traj_os = nullptr; + hills_traj_os = NULL; } if (target_dist) { delete target_dist; - target_dist = nullptr; + target_dist = NULL; } } @@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data() { if (hills_energy) { delete hills_energy; - hills_energy = nullptr; + hills_energy = NULL; } if (hills_energy_gradients) { delete hills_energy_gradients; - hills_energy_gradients = nullptr; + hills_energy_gradients = NULL; } hills.clear(); @@ -451,8 +451,8 @@ int colvarbias_meta::update() error_code |= replica_share(); } - error_code |= calc_energy(nullptr); - error_code |= calc_forces(nullptr); + error_code |= calc_energy(NULL); + error_code |= calc_forces(NULL); return error_code; } @@ -593,7 +593,7 @@ int colvarbias_meta::update_bias() std::vector curr_bin = hills_energy->get_colvars_index(); hills_energy_sum_here = hills_energy->value(curr_bin); } else { - calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr); + calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL); } hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann())); } @@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first, std::vector colvar_forces_scalar(num_variables()); std::vector he_ix = he->new_index(); - std::vector hg_ix = (hg != nullptr) ? hg->new_index() : std::vector (0); + std::vector hg_ix = (hg != NULL) ? hg->new_index() : std::vector (0); cvm::real hills_energy_here = 0.0; std::vector hills_forces_here(num_variables(), 0.0); size_t count = 0; size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1))); - if (hg != nullptr) { + if (hg != NULL) { // loop over the points of the grid for ( ; @@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) hills_energy_gradients = new colvar_grid_gradient(colvars); } - colvar_grid_scalar *hills_energy_backup = nullptr; - colvar_grid_gradient *hills_energy_gradients_backup = nullptr; + colvar_grid_scalar *hills_energy_backup = NULL; + colvar_grid_gradient *hills_energy_gradients_backup = NULL; if (has_data) { if (cvm::debug()) @@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_pos = is.tellg(); std::string key; if (!(is >> key)) { - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == nullptr) + if (hills_energy_backup == NULL) cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_gradients_pos = is.tellg(); if (!(is >> key)) { - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_gradients_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == nullptr) + if (hills_energy_backup == NULL) cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n"); - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { // now that we have successfully updated the grids, delete the // backup copies if (cvm::debug()) @@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output() // TODO: one may want to specify the path manually for intricated filesystems? char *pwd = new char[3001]; - if (GETCWD(pwd, 3000) == nullptr) + if (GETCWD(pwd, 3000) == NULL) cvm::fatal_error("Error: cannot get the path of the current working directory.\n"); replica_list_file = (std::string(pwd)+std::string(PATHSEP)+ @@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file() { int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; - if (proxy->get_output_stream(replica_hills_file) != nullptr) { + if (proxy->get_output_stream(replica_hills_file) != NULL) { error_code |= proxy->close_output_stream(replica_hills_file); } error_code |= proxy->remove_file(replica_hills_file); diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index d45d85111a..05d1195d58 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -135,7 +135,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf, char const *group_key, bool optional) { - cvm::atom_group *group = nullptr; + cvm::atom_group *group = NULL; std::string group_conf; if (key_lookup(conf, group_key, &group_conf)) { @@ -298,7 +298,7 @@ colvar::cvc::~cvc() free_children_deps(); remove_all_children(); for (size_t i = 0; i < atom_groups.size(); i++) { - if (atom_groups[i] != nullptr) delete atom_groups[i]; + if (atom_groups[i] != NULL) delete atom_groups[i]; } } @@ -344,7 +344,7 @@ colvarvalue const *colvar::cvc::get_param_grad(std::string const ¶m_name) { colvarvalue const *ptr = reinterpret_cast(get_param_grad_ptr(param_name)); - return ptr != nullptr ? ptr : nullptr; + return ptr != NULL ? ptr : NULL; } @@ -553,7 +553,7 @@ void colvar::cvc::debug_gradients() } } - if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != nullptr)) { + if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) { cvm::atom_group *ref_group = group->fitting_group; group->read_positions(); group->calc_required_properties(); diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index f36d055528..f0fbabfc4f 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -91,7 +91,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0, colvar::coordnum::coordnum(std::string const &conf) - : cvc(conf), b_anisotropic(false), pairlist(nullptr) + : cvc(conf), b_anisotropic(false), pairlist(NULL) { function_type = "coordnum"; @@ -102,7 +102,7 @@ colvar::coordnum::coordnum(std::string const &conf) group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); - if (group1 == nullptr || group2 == nullptr) { + if (group1 == NULL || group2 == NULL) { cvm::error("Error: failed to initialize atom groups.\n", INPUT_ERROR); return; @@ -183,7 +183,7 @@ colvar::coordnum::coordnum(std::string const &conf) colvar::coordnum::~coordnum() { - if (pairlist != nullptr) { + if (pairlist != NULL) { delete [] pairlist; } } @@ -218,11 +218,11 @@ template void colvar::coordnum::main_loop(bool **pairlist_elem) template int colvar::coordnum::compute_coordnum() { - bool const use_pairlist = (pairlist != nullptr); - bool const rebuild_pairlist = (pairlist != nullptr) && + bool const use_pairlist = (pairlist != NULL); + bool const rebuild_pairlist = (pairlist != NULL) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : nullptr; + bool *pairlist_elem = use_pairlist ? pairlist : NULL; if (b_anisotropic) { @@ -239,7 +239,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags | ef_anisotropic; - main_loop(nullptr); + main_loop(NULL); } } else { @@ -257,7 +257,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags; - main_loop(nullptr); + main_loop(NULL); } } @@ -367,7 +367,7 @@ void colvar::h_bond::calc_value() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - nullptr, 0.0); + NULL, 0.0); } @@ -378,7 +378,7 @@ void colvar::h_bond::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - nullptr, 0.0); + NULL, 0.0); } @@ -393,7 +393,7 @@ simple_scalar_dist_functions(h_bond) colvar::selfcoordnum::selfcoordnum(std::string const &conf) - : cvc(conf), pairlist(nullptr) + : cvc(conf), pairlist(NULL) { function_type = "selfcoordnum"; x.type(colvarvalue::type_scalar); @@ -438,7 +438,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf) colvar::selfcoordnum::~selfcoordnum() { - if (pairlist != nullptr) { + if (pairlist != NULL) { delete [] pairlist; } } @@ -448,11 +448,11 @@ template int colvar::selfcoordnum::compute_selfcoordnum() { cvm::rvector const r0_vec(0.0); // TODO enable the flag? - bool const use_pairlist = (pairlist != nullptr); - bool const rebuild_pairlist = (pairlist != nullptr) && + bool const use_pairlist = (pairlist != NULL); + bool const rebuild_pairlist = (pairlist != NULL) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : nullptr; + bool *pairlist_elem = use_pairlist ? pairlist : NULL; size_t i = 0, j = 0; size_t const n = group1->size(); @@ -601,13 +601,13 @@ void colvar::groupcoordnum::calc_value() x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } else { int const flags = coordnum::ef_null; x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } } @@ -624,13 +624,13 @@ void colvar::groupcoordnum::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } else { int const flags = coordnum::ef_gradients; coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } group1->set_weighted_gradient(group1_com_atom.grad); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index 88a5088aaf..c3c1ee55d5 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -964,7 +964,7 @@ colvar::rmsd::rmsd(std::string const &conf) } bool b_Jacobian_derivative = true; - if (atoms->fitting_group != nullptr && b_Jacobian_derivative) { + if (atoms->fitting_group != NULL && b_Jacobian_derivative) { cvm::log("The option \"fittingGroup\" (alternative group for fitting) was enabled: " "Jacobian derivatives of the RMSD will not be calculated.\n"); b_Jacobian_derivative = false; diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index f647211f6e..f83458b51c 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -33,7 +33,7 @@ colvardeps::~colvardeps() { // Do not delete features if it's a static object // may change in the future though // for (i=0; i &colvars, {} colvar_grid_scalar::colvar_grid_scalar() - : colvar_grid(), samples(nullptr) + : colvar_grid(), samples(NULL) {} colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g) - : colvar_grid(g), samples(nullptr) + : colvar_grid(g), samples(NULL) { } colvar_grid_scalar::colvar_grid_scalar(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, 1), samples(nullptr) + : colvar_grid(nx_i, 0.0, 1), samples(NULL) { } colvar_grid_scalar::colvar_grid_scalar(std::vector &colvars, bool margin) - : colvar_grid(colvars, 0.0, 1, margin), samples(nullptr) + : colvar_grid(colvars, 0.0, 1, margin), samples(NULL) { } @@ -122,15 +122,15 @@ cvm::real colvar_grid_scalar::entropy() const colvar_grid_gradient::colvar_grid_gradient() - : colvar_grid(), samples(nullptr) + : colvar_grid(), samples(NULL) {} colvar_grid_gradient::colvar_grid_gradient(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, nx_i.size()), samples(nullptr) + : colvar_grid(nx_i, 0.0, nx_i.size()), samples(NULL) {} colvar_grid_gradient::colvar_grid_gradient(std::vector &colvars) - : colvar_grid(colvars, 0.0, colvars.size()), samples(nullptr) + : colvar_grid(colvars, 0.0, colvars.size()), samples(NULL) {} void colvar_grid_gradient::write_1D_integral(std::ostream &os) diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 48a38a6076..1d5f75bbca 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -30,11 +30,11 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) depth_s = 0; log_level_ = 10; - cv_traj_os = nullptr; + cv_traj_os = NULL; xyz_reader_use_count = 0; - if (proxy == nullptr) { + if (proxy == NULL) { proxy = proxy_in; // Pointer to the proxy object parse = new colvarparse(); // Parsing object for global options version_int = proxy->get_version_from_string(COLVARS_VERSION); @@ -573,7 +573,7 @@ colvarbias * colvarmodule::bias_by_name(std::string const &name) return (*bi); } } - return nullptr; + return NULL; } @@ -587,7 +587,7 @@ colvar *colvarmodule::colvar_by_name(std::string const &name) return (*cvi); } } - return nullptr; + return NULL; } @@ -601,7 +601,7 @@ cvm::atom_group *colvarmodule::atom_group_by_name(std::string const &name) return (*agi); } } - return nullptr; + return NULL; } @@ -631,7 +631,7 @@ int colvarmodule::change_configuration(std::string const &bias_name, cvm::increase_depth(); colvarbias *b; b = bias_by_name(bias_name); - if (b == nullptr) { + if (b == NULL) { cvm::error("Error: bias not found: " + bias_name); return COLVARS_ERROR; } @@ -647,7 +647,7 @@ std::string colvarmodule::read_colvar(std::string const &name) colvar *c; std::stringstream ss; c = colvar_by_name(name); - if (c == nullptr) { + if (c == NULL) { cvm::error("Error: colvar not found: " + name); return std::string(); } @@ -663,7 +663,7 @@ cvm::real colvarmodule::energy_difference(std::string const &bias_name, colvarbias *b; cvm::real energy_diff = 0.; b = bias_by_name(bias_name); - if (b == nullptr) { + if (b == NULL) { cvm::error("Error: bias not found: " + bias_name); return 0.; } @@ -678,7 +678,7 @@ int colvarmodule::bias_current_bin(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->current_bin(); } else { cvm::error("Error: bias not found.\n"); @@ -695,7 +695,7 @@ int colvarmodule::bias_bin_num(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->bin_num(); } else { cvm::error("Error: bias not found.\n"); @@ -712,7 +712,7 @@ int colvarmodule::bias_bin_count(std::string const &bias_name, size_t bin_index) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->bin_count(bin_index); } else { cvm::error("Error: bias not found.\n"); @@ -729,7 +729,7 @@ int colvarmodule::bias_share(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { b->replica_share(); ret = COLVARS_OK; } else { @@ -1037,7 +1037,7 @@ int colvarmodule::write_restart_file(std::string const &out_name) int colvarmodule::write_traj_files() { - if (cv_traj_os == nullptr) { + if (cv_traj_os == NULL) { if (open_traj_file(cv_traj_name) != COLVARS_OK) { return cvm::get_error(); } else { @@ -1057,7 +1057,7 @@ int colvarmodule::write_traj_files() write_traj(*cv_traj_os); } - if (restart_out_freq && (cv_traj_os != nullptr)) { + if (restart_out_freq && (cv_traj_os != NULL)) { // flush the trajectory file if we are at the restart frequency if ( (cvm::step_relative() > 0) && ((cvm::step_absolute() % restart_out_freq) == 0) ) { @@ -1151,8 +1151,8 @@ colvarmodule::~colvarmodule() atom_group::delete_features(); delete parse; - parse = nullptr; - proxy = nullptr; + parse = NULL; + proxy = NULL; } } @@ -1184,7 +1184,7 @@ int colvarmodule::reset() proxy->reset(); - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { // Do not close traj file here, as we might not be done with it yet. proxy->flush_output_stream(cv_traj_os); } @@ -1395,7 +1395,7 @@ std::istream & colvarmodule::read_objects_state(std::istream &is) if (static_cast(is.tellg()) == pos) { // This block has not been read by any object: discard it and move on // to the next one - is >> colvarparse::read_block(word, nullptr); + is >> colvarparse::read_block(word, NULL); } if (!is) break; @@ -1456,7 +1456,7 @@ int colvarmodule::write_output_files() } cvm::decrease_depth(); - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { // do not close, there may be another run command proxy->flush_output_stream(cv_traj_os); } @@ -1575,7 +1575,7 @@ std::ostream & colvarmodule::write_restart(std::ostream &os) int colvarmodule::open_traj_file(std::string const &file_name) { - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { return COLVARS_OK; } @@ -1591,7 +1591,7 @@ int colvarmodule::open_traj_file(std::string const &file_name) cv_traj_os = (cvm::proxy)->output_stream(file_name); } - if (cv_traj_os == nullptr) { + if (cv_traj_os == NULL) { cvm::error("Error: cannot write to file \""+file_name+"\".\n", FILE_ERROR); } @@ -1602,9 +1602,9 @@ int colvarmodule::open_traj_file(std::string const &file_name) int colvarmodule::close_traj_file() { - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { proxy->close_output_stream(cv_traj_name); - cv_traj_os = nullptr; + cv_traj_os = NULL; } return cvm::get_error(); } @@ -1672,7 +1672,7 @@ void cvm::log(std::string const &message, int min_log_level) { if (cvm::log_level() < min_log_level) return; // allow logging when the module is not fully initialized - size_t const d = (cvm::main() != nullptr) ? depth() : 0; + size_t const d = (cvm::main() != NULL) ? depth() : 0; if (d > 0) { proxy->log((std::string(2*d, ' '))+message); } else { @@ -1780,7 +1780,7 @@ int cvm::read_index_file(char const *filename) } if (index_of_group < 0) { index_group_names.push_back(group_name); - index_groups.push_back(nullptr); + index_groups.push_back(NULL); index_of_group = index_groups.size()-1; } } else { @@ -1799,7 +1799,7 @@ int cvm::read_index_file(char const *filename) pos = is.tellg(); } - if (old_index_group != nullptr) { + if (old_index_group != NULL) { bool equal = false; if (new_index_group->size() == old_index_group->size()) { if (std::equal(new_index_group->begin(), new_index_group->end(), @@ -1810,13 +1810,13 @@ int cvm::read_index_file(char const *filename) if (! equal) { new_index_group->clear(); delete new_index_group; - new_index_group = nullptr; + new_index_group = NULL; return cvm::error("Error: the index group \""+group_name+ "\" was redefined.\n", INPUT_ERROR); } else { old_index_group->clear(); delete old_index_group; - old_index_group = nullptr; + old_index_group = NULL; } } @@ -1850,7 +1850,7 @@ int colvarmodule::reset_index_groups() size_t i = 0; for ( ; i < index_groups.size(); i++) { delete index_groups[i]; - index_groups[i] = nullptr; + index_groups[i] = NULL; } index_group_names.clear(); index_groups.clear(); @@ -2179,7 +2179,7 @@ std::string cvm::wrap_string(std::string const &s, size_t nchars) // shared pointer to the proxy object -colvarproxy *colvarmodule::proxy = nullptr; +colvarproxy *colvarmodule::proxy = NULL; // static runtime data cvm::real colvarmodule::debug_gradients_step_size = 1.0e-07; diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index e06f05aca0..9346e8e1d6 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -459,13 +459,13 @@ public: /// Backup a file before writing it static int backup_file(char const *filename); - /// Look up a bias by name; returns nullptr if not found + /// Look up a bias by name; returns NULL if not found static colvarbias * bias_by_name(std::string const &name); - /// Look up a colvar by name; returns nullptr if not found + /// Look up a colvar by name; returns NULL if not found static colvar * colvar_by_name(std::string const &name); - /// Look up a named atom group by name; returns nullptr if not found + /// Look up a named atom group by name; returns NULL if not found static atom_group * atom_group_by_name(std::string const &name); /// Load new configuration for the given bias - diff --git a/lib/colvars/colvarparams.cpp b/lib/colvars/colvarparams.cpp index ea45c01104..e957a1841d 100644 --- a/lib/colvars/colvarparams.cpp +++ b/lib/colvars/colvarparams.cpp @@ -76,7 +76,7 @@ void const *colvarparams::get_param_ptr(std::string const ¶m_name) return param_map[param_name]; } cvm::error("Error: parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return nullptr; + return NULL; } @@ -87,7 +87,7 @@ void const *colvarparams::get_param_grad_ptr(std::string const ¶m_name) } cvm::error("Error: gradient of parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return nullptr; + return NULL; } @@ -95,7 +95,7 @@ cvm::real colvarparams::get_param(std::string const ¶m_name) { cvm::real const *ptr = reinterpret_cast(get_param_ptr(param_name)); - return ptr != nullptr ? *ptr : 0.0; + return ptr != NULL ? *ptr : 0.0; } diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index e61ebf355f..a09d6be9ef 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -674,12 +674,12 @@ bool colvarparse::key_lookup(std::string const &conf, std::string const conf_lower(to_lower_cppstr(conf)); // by default, there is no value, unless we found one - if (data != nullptr) { + if (data != NULL) { data->clear(); } // start from the first occurrence of key - size_t pos = conf_lower.find(key, (save_pos != nullptr) ? *save_pos : 0); + size_t pos = conf_lower.find(key, (save_pos != NULL) ? *save_pos : 0); // iterate over all instances of the substring until it finds it as isolated keyword while (true) { @@ -727,7 +727,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != nullptr) { + if (save_pos != NULL) { // save the pointer for a future call (when iterating over multiple // valid instances of the same keyword) *save_pos = pos + key.size(); @@ -820,7 +820,7 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != nullptr) { + if (data != NULL) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) { @@ -834,7 +834,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != nullptr) *save_pos = line_end; + if (save_pos != NULL) *save_pos = line_end; return true; } diff --git a/lib/colvars/colvarparse.h b/lib/colvars/colvarparse.h index fc1362b2b1..b7d42fdffa 100644 --- a/lib/colvars/colvarparse.h +++ b/lib/colvars/colvarparse.h @@ -275,12 +275,12 @@ public: /// The keyword that identifies the block std::string const key; - /// Where to keep the data (may be nullptr) + /// Where to keep the data (may be NULL) std::string * const data; public: - read_block(std::string const &key_in, std::string *data_in = nullptr); + read_block(std::string const &key_in, std::string *data_in = NULL); ~read_block(); @@ -300,8 +300,8 @@ public: /// within "conf", useful when doing multiple calls bool key_lookup(std::string const &conf, char const *key, - std::string *data = nullptr, - size_t *save_pos = nullptr); + std::string *data = NULL, + size_t *save_pos = NULL); /// \brief Reads a configuration line, adds it to config_string, and returns /// the stream \param is Input stream \param line String that will hold the diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 7eb0b22cb5..63ae07a57c 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -296,7 +296,7 @@ void colvarproxy_atom_groups::clear_atom_group(int index) colvarproxy_smp::colvarproxy_smp() { b_smp_active = true; // May be disabled by user option - omp_lock_state = nullptr; + omp_lock_state = NULL; #if defined(_OPENMP) if (smp_thread_id() == 0) { omp_lock_state = reinterpret_cast(new omp_lock_t); @@ -459,7 +459,7 @@ int colvarproxy_smp::smp_unlock() colvarproxy_script::colvarproxy_script() { - script = nullptr; + script = NULL; } @@ -507,7 +507,7 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name colvarproxy_tcl::colvarproxy_tcl() { - tcl_interp_ = nullptr; + tcl_interp_ = NULL; } @@ -528,7 +528,7 @@ char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj) #if defined(COLVARS_TCL) return Tcl_GetString(reinterpret_cast(obj)); #else - return nullptr; + return NULL; #endif } @@ -666,7 +666,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, } std::ostream *os = get_output_stream(output_name); - if (os != nullptr) return os; + if (os != NULL) return os; if (!(mode & (std::ios_base::app | std::ios_base::ate))) { backup_file(output_name); @@ -675,7 +675,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, if (!osf->is_open()) { cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n", FILE_ERROR); - return nullptr; + return NULL; } output_stream_names.push_back(output_name); output_files.push_back(osf); @@ -692,7 +692,7 @@ std::ostream *colvarproxy_io::get_output_stream(std::string const &output_name) return *osi; } } - return nullptr; + return NULL; } @@ -794,7 +794,7 @@ int colvarproxy_io::rename_file(char const *filename, char const *newfilename) colvarproxy::colvarproxy() { - colvars = nullptr; + colvars = NULL; b_simulation_running = true; b_delete_requested = false; } diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index a46589a526..ba91afb40e 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -607,7 +607,7 @@ public: std::ios_base::openmode mode = std::ios_base::out); - /// Returns a reference to output_name if it exists, nullptr otherwise + /// Returns a reference to output_name if it exists, NULL otherwise virtual std::ostream *get_output_stream(std::string const &output_name); /// \brief Flushes the given output channel diff --git a/lib/colvars/colvarscript.cpp b/lib/colvars/colvarscript.cpp index a8b5d6ab2f..10b276c89e 100644 --- a/lib/colvars/colvarscript.cpp +++ b/lib/colvars/colvarscript.cpp @@ -97,7 +97,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvar *cv = cvm::colvar_by_name(name); - if (cv == nullptr) { + if (cv == NULL) { result = "Colvar not found: " + name; return COLVARSCRIPT_ERROR; } @@ -111,7 +111,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvarbias *b = cvm::bias_by_name(name); - if (b == nullptr) { + if (b == NULL) { result = "Bias not found: " + name; return COLVARSCRIPT_ERROR; } @@ -186,7 +186,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) /// Parse config from string if (cmd == "config") { - return exec_command(cv_config, nullptr, objc, objv); + return exec_command(cv_config, NULL, objc, objv); } /// Load an input state file @@ -247,7 +247,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } else if (objc == 3) { // Failure of this function does not trigger an error, but // returns nonzero, to let scripts detect available frames - int error = proxy->set_frame(strtol(obj_to_str(objv[2]), nullptr, 10)); + int error = proxy->set_frame(strtol(obj_to_str(objv[2]), NULL, 10)); result = cvm::to_str(error == COLVARS_OK ? 0 : -1); return COLVARS_OK; } else { @@ -258,7 +258,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) if (cmd == "addenergy") { if (objc == 3) { - colvars->total_bias_energy += strtod(obj_to_str(objv[2]), nullptr); + colvars->total_bias_energy += strtod(obj_to_str(objv[2]), NULL); return COLVARS_OK; } else { result = "Wrong arguments to command \"addenergy\"\n" + help_string(); @@ -267,7 +267,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } if (cmd == "help") { - return exec_command(cv_help, nullptr, objc, objv); + return exec_command(cv_help, NULL, objc, objv); } result = "Syntax error\n" + help_string(); @@ -320,7 +320,7 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[]) // colvar destructor is tasked with the cleanup delete cv; // TODO this could be done by the destructors - if (colvars->cv_traj_os != nullptr) { + if (colvars->cv_traj_os != NULL) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -513,7 +513,7 @@ int colvarscript::proc_bias(colvarbias *b, int objc, unsigned char *const objv[] // the bias destructor takes care of the cleanup at cvm level delete b; // TODO this could be done by the destructors - if (colvars->cv_traj_os != nullptr) { + if (colvars->cv_traj_os != NULL) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -564,7 +564,7 @@ int colvarscript::proc_features(colvardeps *obj, if ((subcmd == "get") || (subcmd == "set")) { std::vector const &features = obj->features(); std::string const req_feature(obj_to_str(objv[3])); - colvardeps::feature *f = nullptr; + colvardeps::feature *f = NULL; int fid = 0; for (fid = 0; fid < int(features.size()); fid++) { if (features[fid]->description == @@ -574,7 +574,7 @@ int colvarscript::proc_features(colvardeps *obj, } } - if (f == nullptr) { + if (f == NULL) { result = "Error: feature \""+req_feature+"\" does not exist.\n"; return COLVARSCRIPT_ERROR; diff --git a/lib/colvars/colvarscript.h b/lib/colvars/colvarscript.h index 04679b37ad..69d52cbb51 100644 --- a/lib/colvars/colvarscript.h +++ b/lib/colvars/colvarscript.h @@ -278,7 +278,7 @@ extern "C" { 1, 1, { "E (float) - Amount of energy to add" }, cvm::main()->total_bias_energy += - strtod(script->obj_to_str(objv[2]), nullptr); + strtod(script->obj_to_str(objv[2]), NULL); return COLVARS_OK; ) diff --git a/lib/colvars/colvartypes.h b/lib/colvars/colvartypes.h index 55401576b1..e5f12154e6 100644 --- a/lib/colvars/colvartypes.h +++ b/lib/colvars/colvartypes.h @@ -59,7 +59,7 @@ public: if (data.size() > 0) { return &(data[0]); } else { - return nullptr; + return NULL; } } @@ -520,7 +520,7 @@ public: if (rows.size() > 0) { return &(pointers[0]); } else { - return nullptr; + return NULL; } } diff --git a/lib/colvars/lepton/include/lepton/Operation.h b/lib/colvars/lepton/include/lepton/Operation.h index 68474137f1..1ddde0b8c0 100644 --- a/lib/colvars/lepton/include/lepton/Operation.h +++ b/lib/colvars/lepton/include/lepton/Operation.h @@ -186,7 +186,7 @@ public: } bool operator!=(const Operation& op) const { const Constant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -217,7 +217,7 @@ public: ExpressionTreeNode differentiate(const std::vector& children, const std::vector& childDerivs, const std::string& variable) const; bool operator!=(const Operation& op) const { const Variable* o = dynamic_cast(&op); - return (o == nullptr || o->name != name); + return (o == NULL || o->name != name); } private: std::string name; @@ -264,7 +264,7 @@ public: } bool operator!=(const Operation& op) const { const Custom* o = dynamic_cast(&op); - return (o == nullptr || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); + return (o == NULL || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); } private: std::string name; @@ -955,7 +955,7 @@ public: } bool operator!=(const Operation& op) const { const AddConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -988,7 +988,7 @@ public: } bool operator!=(const Operation& op) const { const MultiplyConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -1042,7 +1042,7 @@ public: } bool operator!=(const Operation& op) const { const PowerConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } bool isInfixOperator() const { return true; diff --git a/lib/colvars/lepton/src/CompiledExpression.cpp b/lib/colvars/lepton/src/CompiledExpression.cpp index 6abcad2de2..1ad348b47d 100644 --- a/lib/colvars/lepton/src/CompiledExpression.cpp +++ b/lib/colvars/lepton/src/CompiledExpression.cpp @@ -40,10 +40,10 @@ using namespace std; using namespace asmjit; #endif -CompiledExpression::CompiledExpression() : jitCode(nullptr) { +CompiledExpression::CompiledExpression() : jitCode(NULL) { } -CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(nullptr) { +CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(NULL) { ParsedExpression expr = expression.optimize(); // Just in case it wasn't already optimized. vector > temps; compileExpression(expr.getRootNode(), temps); @@ -59,11 +59,11 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit CompiledExpression::~CompiledExpression() { for (int i = 0; i < (int) operation.size(); i++) - if (operation[i] != nullptr) + if (operation[i] != NULL) delete operation[i]; } -CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(nullptr) { +CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(NULL) { *this = expression; } diff --git a/lib/colvars/lepton/src/ExpressionTreeNode.cpp b/lib/colvars/lepton/src/ExpressionTreeNode.cpp index 09c5352d20..8519878262 100644 --- a/lib/colvars/lepton/src/ExpressionTreeNode.cpp +++ b/lib/colvars/lepton/src/ExpressionTreeNode.cpp @@ -59,14 +59,14 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati throw Exception("wrong number of arguments to function: "+operation->getName()); } -ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == nullptr ? nullptr : node.operation->clone()), children(node.getChildren()) { +ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) { } -ExpressionTreeNode::ExpressionTreeNode() : operation(nullptr) { +ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) { } ExpressionTreeNode::~ExpressionTreeNode() { - if (operation != nullptr) + if (operation != NULL) delete operation; } @@ -91,7 +91,7 @@ bool ExpressionTreeNode::operator==(const ExpressionTreeNode& node) const { } ExpressionTreeNode& ExpressionTreeNode::operator=(const ExpressionTreeNode& node) { - if (operation != nullptr) + if (operation != NULL) delete operation; operation = node.getOperation().clone(); children = node.getChildren(); diff --git a/lib/colvars/lepton/src/ParsedExpression.cpp b/lib/colvars/lepton/src/ParsedExpression.cpp index c259756346..fd3b091d3c 100644 --- a/lib/colvars/lepton/src/ParsedExpression.cpp +++ b/lib/colvars/lepton/src/ParsedExpression.cpp @@ -46,7 +46,7 @@ ParsedExpression::ParsedExpression(const ExpressionTreeNode& rootNode) : rootNod } const ExpressionTreeNode& ParsedExpression::getRootNode() const { - if (&rootNode.getOperation() == nullptr) + if (&rootNode.getOperation() == NULL) throw Exception("Illegal call to an initialized ParsedExpression"); return rootNode; } diff --git a/lib/kokkos/cmake/compile_tests/pthread.cpp b/lib/kokkos/cmake/compile_tests/pthread.cpp index 7fa98611be..92310da029 100644 --- a/lib/kokkos/cmake/compile_tests/pthread.cpp +++ b/lib/kokkos/cmake/compile_tests/pthread.cpp @@ -4,11 +4,11 @@ void* kokkos_test(void* args) { return args; } int main(void) { pthread_t thread; - /* Use nullptr to avoid C++11. Some compilers + /* Use NULL to avoid C++11. Some compilers do not have C++11 by default. Forcing C++11 in the compile tests can be done, but is unnecessary */ - pthread_create(&thread, nullptr, kokkos_test, nullptr); - pthread_join(thread, nullptr); + pthread_create(&thread, NULL, kokkos_test, NULL); + pthread_join(thread, NULL); return 0; } diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index d4db2c538d..a97fb2f7cc 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -640,7 +640,7 @@ void SharedAllocationRecord:: /*--------------------------------------------------------------------------*/ void* hip_resize_scratch_space(size_t bytes, bool force_shrink) { - static void* ptr = nullptr; + static void* ptr = NULL; static size_t current_size = 0; if (current_size == 0) { current_size = bytes; diff --git a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp index 613793fc60..fad36c02f1 100644 --- a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp @@ -139,7 +139,7 @@ void *HBWSpace::allocate(const char *arg_label, const size_t arg_alloc_size, } msg << " ]( " << arg_alloc_size << " ) FAILED"; if (ptr == nullptr) { - msg << " NULL"; + msg << " nullptr"; } else { msg << " NOT ALIGNED " << ptr; } diff --git a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp index 2b11adbf6d..a9a2778813 100644 --- a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp @@ -215,7 +215,7 @@ SharedAllocationRecord::SharedAllocationRecord( } else { Kokkos::Impl::throw_runtime_exception( - "Kokkos::Impl::SharedAllocationRecord given NULL allocation"); + "Kokkos::Impl::SharedAllocationRecord given nullptr allocation"); } } diff --git a/lib/kokkos/core/unit_test/TestCTestDevice.cpp b/lib/kokkos/core/unit_test/TestCTestDevice.cpp index c54c75f94b..b2ee79b856 100644 --- a/lib/kokkos/core/unit_test/TestCTestDevice.cpp +++ b/lib/kokkos/core/unit_test/TestCTestDevice.cpp @@ -13,7 +13,7 @@ int setenv(const char *name, const char *value, int overwrite) { int errcode = 0; if (!overwrite) { size_t envsize = 0; - errcode = getenv_s(&envsize, nullptr, 0, name); + errcode = getenv_s(&envsize, NULL, 0, name); if (errcode || envsize) return errcode; } return _putenv_s(name, value); -- GitLab From 05d41cd50de992fe806e4f4a3d8b42b6e39579a4 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 09:54:15 -0600 Subject: [PATCH 03/21] T2345: Replace instances of NULL with nullptr revert lib/poems to remove nullptr changes. Walking back changes to lib as needed. --- lib/poems/SystemProcessor.h | 30 +++++++++--------- lib/poems/poemsnodelib.h | 20 ++++++------ lib/poems/poemstree.h | 62 ++++++++++++++++++------------------- lib/poems/poemstreenode.cpp | 2 +- lib/poems/poemstreenode.h | 2 +- lib/poems/solver.cpp | 2 +- lib/poems/system.cpp | 10 +++--- lib/poems/workspace.cpp | 6 ++-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index c1c45a86a7..4fc8785dd7 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != nullptr) + if(currentNode != NULL) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != nullptr); //repeat this until all chains have been added + while(currentNode != NULL); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null + if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null { - return nullptr; + return NULL; } int * tmp; - POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = nullptr; //temporary variable to hold data - while(tempNode != nullptr) //when we have followed all links, stop + POEMSChain * tempChain = NULL; //temporary variable to hold data + while(tempNode != NULL) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == nullptr) + if(aNode == NULL) { - return nullptr; + return NULL; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == nullptr) //and if we find nothing... + if(returnVal == NULL) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == nullptr) //if we could not find any chains + if(returnVal == NULL) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be nullptr if no new chains are + return returnVal; //return what we find (will be NULL if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists + while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list + while(tmp->value != NULL || tmp2->value != NULL) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 04f0f4b79b..446fa2013f 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); +TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != nullptr) + if (t != NULL) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != nullptr) + if (t != NULL) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value nullptr +// The pointers have default value NULL TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == nullptr) + if (p == NULL) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=nullptr) + if(t !=NULL) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == nullptr && t->Right() == nullptr) + if (t->Left() == NULL && t->Right() == NULL) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == nullptr) + if (t == NULL) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=nullptr - if (t != nullptr) + //print tree with root t, as long as t!=NULL + if (t != NULL) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index 14f5fd4008..ee07a33255 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = nullptr); + void Insert(const int& item, const int& data, void * AuxData = NULL); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = nullptr; + DeleteAuxData = NULL; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return nullptr +// address and a pointer to its parent; otherwise, return NULL TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is nullptr - parent = nullptr; + // the parent of the root is NULL + parent = NULL; // terminate on empty subtree - while(t != nullptr) + while(t != NULL) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; nullptr if not found + // return pointer to node; NULL if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != nullptr) + if (current != NULL) { item = current->data; return current->GetAuxData(); } else // item not found in the tree. return False - return nullptr; + return NULL; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,nullptr,nullptr); + newNode = GetTreeNode(item,NULL,NULL); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == nullptr) + if (tree == NULL) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) + if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) return; - // If D has nullptr pointer, the + // If D has NULL pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == nullptr) + if (DNodePtr->right == NULL) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == nullptr) + else if (DNodePtr->left == NULL) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-nullptr + // Both pointers of DNodePtr are non-NULL else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != nullptr) + while (RNodePtr->right != NULL) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == nullptr) + if (PNodePtr == NULL) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=nullptr && current->data == item) + if (current !=NULL && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == nullptr) - return nullptr; + if (t == NULL) + return NULL; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns nullptr. + // present it makes a copy of left child or returns NULL. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=nullptr) + if (t->Left() !=NULL) newlptr = CopyTree(t->Left()); else - newlptr = nullptr; + newlptr = NULL; - if (t->Right() !=nullptr) + if (t->Right() !=NULL) newrptr = CopyTree(t->Right()); else - newrptr = nullptr; + newrptr = NULL; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != nullptr) { + if (t != NULL) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != nullptr) { - if (DeleteAuxData != nullptr) { + if (aux != NULL) { + if (DeleteAuxData != NULL) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to nullptr +// set the root pointer back to NULL void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = nullptr; // root now nullptr + t = NULL; // root now NULL } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 52905fc40f..051e13d6e0 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value nullptr assigns a empty subtree +// The pointer value NULL assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/poemstreenode.h b/lib/poems/poemstreenode.h index e5673344a9..a1835ba025 100644 --- a/lib/poems/poemstreenode.h +++ b/lib/poems/poemstreenode.h @@ -18,7 +18,7 @@ #ifndef TREENODE_H #define TREENODE_H -//#define nullptr 0 +//#define NULL 0 //Tree depends on TreeNode diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 7b1e718b93..67f5b607e3 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return nullptr; + default: return NULL; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 23554f4117..369213f7d0 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = nullptr; + mappings = NULL; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = nullptr; + Body* body = NULL; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = nullptr; + Point* point_ch = NULL; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = nullptr; + Body* body = NULL; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = nullptr; + Point* point_ch = NULL; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 21819d4c02..2b3257b0dd 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = nullptr; + system = NULL; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != nullptr) { + while(NodeValue != NULL) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return nullptr; + return NULL; } } -- GitLab From 14dfd3876ac4a53855804baa7f27abfb6a1a9d46 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 10:24:51 -0600 Subject: [PATCH 04/21] T2345: Walking back nullptr changes to lib/awpmd --- lib/awpmd/ivutils/include/logexc.h | 8 +++--- lib/awpmd/ivutils/include/pairhash.h | 28 +++++++++---------- lib/awpmd/ivutils/include/refobj.h | 20 ++++++------- lib/awpmd/ivutils/include/vector_3.h | 14 +++++----- lib/awpmd/ivutils/src/logexc.cpp | 2 +- lib/awpmd/systems/interact/TCP/wpmd.h | 20 ++++++------- lib/awpmd/systems/interact/TCP/wpmd_split.cpp | 4 +-- lib/awpmd/systems/interact/TCP/wpmd_split.h | 16 +++++------ 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 2eebfcc0ce..7bf6125bc6 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(nullptr),next(nullptr){ + :descriptor(descriptor_),prev(NULL),next(NULL){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=nullptr; - prev=nullptr; + glogp->next=NULL; + prev=NULL; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index 0f79fc4184..c29f72773f 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(nullptr),incr(0){} + iterator():ptr(NULL),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(nullptr,1) { + recmatrix(): parr(NULL,1) { sizey=sizex=0; - arr=nullptr; + arr=NULL; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(nullptr,0); + parr.reset(NULL,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(nullptr),incr(0){} + iterator():ptr(NULL),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(nullptr,1) { + sqmatrix(): parr(NULL,1) { size=0; - arr=nullptr; + arr=NULL; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ + sqmatrix(const sqmatrix &other):size(0),arr(NULL){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(nullptr,0); + parr.reset(NULL,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not nullptr, puts the found value there - virtual int Find(long i, long j, T *retval=nullptr)=0; - virtual int Find(long i, long j, T **retval=nullptr)=0; + //e if retval is not NULL, puts the found value there + virtual int Find(long i, long j, T *retval=NULL)=0; + virtual int Find(long i, long j, T **retval=NULL)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=nullptr){ + int Find(long i, long j, T *retval=NULL){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index 8e5fc7df45..a1a4feb0ff 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=nullptr, int managed=0){ + void reset(T* ptr=NULL, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==nullptr than p is not managed (as in mngptr) + int *num; //if num==NULL than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=nullptr; + else num=NULL; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=nullptr; + else num=NULL; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=nullptr; + else num=NULL; } public: - shptr(T* p=nullptr, int managed=1){ + shptr(T* p=NULL, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=nullptr; + num=NULL; } - p=nullptr; + p=NULL; } } bool valid() const { - return p!=nullptr; + return p!=NULL; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 534cea44aa..468abbda99 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=nullptr) const { + T maxcoord(int *ind=NULL) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 6e809dd65c..7e82af0f65 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=nullptr; +message_logger *message_logger::glogp=NULL; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index 4c65440014..e118b76f36 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ + void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=nullptr )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); + /// Default (q=NULL )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=nullptr); + virtual int interaction_ii(int flag,Vector_3P fi=NULL); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 55105066de..2c58bdaf28 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be nullptr, \n +/// will not update electronic force arrays, which may be NULL, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 0ffef2645d..44fb757576 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); + /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be nullptr, \n + /// will not update electronic force arrays, which may be NULL, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n -- GitLab From 9f0354f8160040d896fc62760b92c8c70ae0de36 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 10:48:48 -0600 Subject: [PATCH 05/21] T2345: Walking back nullptr changes in #defines in STUBS/mpi.h --- src/STUBS/mpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 5df63682b7..063dc542be 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -50,7 +50,7 @@ extern "C" { #define MPI_GROUP_EMPTY -1 #define MPI_ANY_SOURCE -1 -#define MPI_STATUS_IGNORE nullptr +#define MPI_STATUS_IGNORE NULL #define MPI_Comm int #define MPI_Request int @@ -60,7 +60,7 @@ extern "C" { #define MPI_Group int #define MPI_Offset long -#define MPI_IN_PLACE nullptr +#define MPI_IN_PLACE NULL #define MPI_MAX_PROCESSOR_NAME 128 #define MPI_MAX_LIBRARY_VERSION_STRING 128 -- GitLab From 1597cd5dcb87a0cb4e83492403ec3dd1fe4f5a72 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Sat, 12 Sep 2020 09:02:31 -0600 Subject: [PATCH 06/21] T2345: After examining comments changed by batch conversion of NULL to nullptr, I've corrected a small number where it seemed clear that the previous NULL should have been either "NULL" (where the code is looking for a string with that value), or null char / null byte (where the comment is talking about the char/byte that terminates a c-style string). Also changed 6 places where the batch change had changed 'NULL ptr' to 'nullptr ptr'. Now they simply say 'nullptr'. --- src/GPU/pair_eam_alloy_gpu.cpp | 2 +- src/GPU/pair_eam_fs_gpu.cpp | 2 +- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_fs_kokkos.cpp | 2 +- src/MANYBODY/pair_adp.cpp | 2 +- src/MANYBODY/pair_airebo.cpp | 2 +- src/MANYBODY/pair_airebo.h | 2 +- src/MANYBODY/pair_comb.cpp | 2 +- src/MANYBODY/pair_comb3.cpp | 2 +- src/MANYBODY/pair_eam_alloy.cpp | 2 +- src/MANYBODY/pair_eam_fs.cpp | 2 +- src/MANYBODY/pair_eim.cpp | 2 +- src/MANYBODY/pair_gw.cpp | 2 +- src/MANYBODY/pair_lcbop.cpp | 4 ++-- src/MANYBODY/pair_lcbop.h | 2 +- src/MANYBODY/pair_nb3b_harmonic.cpp | 2 +- src/MANYBODY/pair_polymorphic.cpp | 2 +- src/MANYBODY/pair_sw.cpp | 2 +- src/MANYBODY/pair_tersoff.cpp | 2 +- src/MANYBODY/pair_vashishta.cpp | 2 +- src/USER-COLVARS/fix_colvars.cpp | 2 +- src/USER-INTEL/pair_eam_alloy_intel.cpp | 2 +- src/USER-INTEL/pair_eam_fs_intel.cpp | 2 +- src/USER-MEAMC/pair_meamc.cpp | 2 +- src/USER-MISC/pair_agni.cpp | 2 +- src/USER-MISC/pair_drip.cpp | 2 +- src/USER-MISC/pair_edip.cpp | 2 +- src/USER-MISC/pair_edip_multi.cpp | 2 +- src/USER-MISC/pair_extep.cpp | 2 +- src/USER-MISC/pair_ilp_graphene_hbn.cpp | 2 +- src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 2 +- src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 2 +- src/USER-MISC/pair_lebedeva_z.cpp | 2 +- src/USER-MISC/pair_meam_spline.cpp | 2 +- src/USER-MISC/pair_meam_sw_spline.cpp | 2 +- src/USER-MISC/pair_tersoff_table.cpp | 2 +- src/USER-OMP/pair_eam_alloy_omp.cpp | 2 +- src/USER-OMP/pair_eam_fs_omp.cpp | 2 +- src/USER-REAXC/pair_reaxc.cpp | 2 +- src/USER-SMTBQ/pair_smtbq.cpp | 2 +- src/atom.cpp | 4 ++-- src/fix_spring_rg.cpp | 2 +- src/input.cpp | 12 ++++++------ src/pair_coul_streitz.cpp | 2 +- src/read_dump.cpp | 8 ++++---- src/run.cpp | 2 +- 46 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 9dd5c85c49..998ca92936 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -324,7 +324,7 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 10f6b4ebe9..5559bb470f 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -324,7 +324,7 @@ void PairEAMFSGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 4e0c44acba..52882c8be8 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMAlloyKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 2714da9cae..d697cfbe9a 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMFSKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 4eeab89381..3b98c91cb8 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -465,7 +465,7 @@ void PairADP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 8643f54812..eb92e0c58a 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -185,7 +185,7 @@ void PairAIREBO::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and H - // map[i] = which element (0,1) the Ith atom type is, -1 if nullptr + // map[i] = which element (0,1) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index d605ddc2d8..7539cc5e7f 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -40,7 +40,7 @@ class PairAIREBO : public Pair { enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code protected: - int *map; // 0 (C), 1 (H), or -1 (nullptr) for each type + int *map; // 0 (C), 1 (H), or -1 ("NULL") for each type int variant; int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 0e2ac8dac9..95b49b98f9 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -456,7 +456,7 @@ void PairComb::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index fd4f1b3822..01a1538f7b 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -192,7 +192,7 @@ void PairComb3::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 055a2baf11..f17d500a40 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -70,7 +70,7 @@ void PairEAMAlloy::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index 90c24bb254..1c055e1bcf 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -70,7 +70,7 @@ void PairEAMFS::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index 69e2832b37..8f229060cf 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -388,7 +388,7 @@ void PairEIM::coeff(int narg, char **arg) read_file(arg[2+nelements]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3 + nelements; i < narg; i++) { m = i - (3+nelements) + 1; diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index dd9b55b7bf..6a97975d45 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -283,7 +283,7 @@ void PairGW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index c84361d7a6..760ffc8cd8 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -135,8 +135,8 @@ void PairLCBOP::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read args that map atom types to C and nullptr - // map[i] = which element (0 for C) the Ith atom type is, -1 if nullptr + // read args that map atom types to C and "NULL" + // map[i] = which element (0 for C) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index 9ca2e3d55e..dacbe74158 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,7 +39,7 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 (nullptr) for each type + int *map; // 0 (C) or -1 ("NULL") for each type int me; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index a361955fa7..859652dd10 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -198,7 +198,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index cdf9a7f23a..99eb2fec55 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 9db9adf423..b74eda0f85 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -262,7 +262,7 @@ void PairSW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 21a8f7de67..b8379d15cc 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -306,7 +306,7 @@ void PairTersoff::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index fea414f5fb..10ac2c418f 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -269,7 +269,7 @@ void PairVashishta::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index eaa0d272c3..57162df249 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -961,7 +961,7 @@ void FixColvars::write_restart(FILE *fp) proxy->serialize_status(rest_text); // TODO call write_output_files() const char *cvm_state = rest_text.c_str(); - int len = strlen(cvm_state) + 1; // need to include terminating nullptr byte. + int len = strlen(cvm_state) + 1; // need to include terminating null byte. fwrite(&len,sizeof(int),1,fp); fwrite(cvm_state,1,len,fp); } diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index b93c9bc8c0..b78baf896f 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 2165f10aff..84cfcb8a11 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -69,7 +69,7 @@ void PairEAMFSIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 133bb611ca..4c4a3dcf62 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -556,7 +556,7 @@ void PairMEAMC::read_files(const std::string &globalfile, delete [] rozero; delete [] found; - // done if user param file is nullptr + // done if user param file is "NULL" if (userfile == "NULL") return; diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index afd600594b..0361942af1 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -266,7 +266,7 @@ void PairAGNI::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 449cf86699..b5b39a65a7 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -139,7 +139,7 @@ void PairDRIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 31dda8bb03..62d09e0c46 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -779,7 +779,7 @@ void PairEDIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 1a5d4925d9..07245b1728 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -539,7 +539,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 6d9f74de8e..d8fa565ae1 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -467,7 +467,7 @@ void PairExTeP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index f0c197ca3d..63ba47448a 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -167,7 +167,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index c308990839..0804f42b86 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -168,7 +168,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 80f57fb5dc..617a48c0fe 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -232,7 +232,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index cb65dc85f6..3168a35ab7 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -228,7 +228,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 455a21ada3..3be2a3858b 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -398,7 +398,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 0013fa5577..a8977a09d4 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -393,7 +393,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 6e0cacaff7..bc6be2d399 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -755,7 +755,7 @@ void PairTersoffTable::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index 9a797dafa2..2f29aced65 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index d474e039bf..a7fd0cac51 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -69,7 +69,7 @@ void PairEAMFSOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 6a2ba7d754..fd97a26359 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -327,7 +327,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" int itmp = 0; int nreax_types = system->reax_param.num_atom_types; diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index a40f676ff1..d84f302304 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -277,7 +277,7 @@ void PairSMTBQ::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/atom.cpp b/src/atom.cpp index a58e1e3181..539bf6fc0b 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2201,10 +2201,10 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find nullptr ptr: + // if find nullptr: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find nullptr ptr: + // if don't find nullptr: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 2805395053..6cd8637a5c 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -67,7 +67,7 @@ void FixSpringRG::init() { masstotal = group->mass(igroup); - // if rg0 was specified as nullptr, compute current Rg + // Compute current Rg // only occurs on 1st run if (rg0_flag) { diff --git a/src/input.cpp b/src/input.cpp index 5efbdfba3d..5e40d2dede 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -467,10 +467,10 @@ char *Input::nextword(char *str, char **next) // start = first char beyond quote // stop = first char of matching quote // next = first char beyond matching quote - // next must be nullptr or whitespace + // next must be null char or whitespace // if start is not single/double/triple quote: // stop = first whitespace char after start - // next = char after stop, or stop itself if stop is nullptr + // next = char after stop, or stop itself if stop is null char if (strstr(start,"\"\"\"") == start) { stop = strstr(&start[3],"\"\"\""); @@ -492,7 +492,7 @@ char *Input::nextword(char *str, char **next) else *next = stop+1; } - // set stop to nullptr to terminate word + // set stop to null char to terminate word *stop = '\0'; return start; @@ -510,9 +510,9 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // use str2 as scratch space to expand str, then copy back to str // reallocate str and str2 as necessary // do not replace $ inside single/double/triple quotes - // var = pts at variable name, ended by nullptr - // if $ is followed by '{', trailing '}' becomes nullptr - // else $x becomes x followed by nullptr + // var = pts at variable name, ended by null char + // if $ is followed by '{', trailing '}' becomes null char + // else $x becomes x followed by null char // beyond = points to text following variable int i,n,paren_count; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 6ff958483b..101aaf36a3 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -143,7 +143,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 2fd14b547a..dcbb95fccc 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid nullptr ptr + newmaxnew = MAX(newmaxnew,1); // avoid nullptr memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); diff --git a/src/run.cpp b/src/run.cpp index f5b571844f..2e55fba439 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -91,7 +91,7 @@ void Run::command(int narg, char **arg) // all remaining args are commands // first,last = arg index of first/last commands - // set ncommands = 0 if single command and it is nullptr + // set ncommands = 0 if single command and it is "NULL" } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); -- GitLab From bc850bcd97706e88185a4718bf47550586f76b6a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 12 Sep 2020 14:04:23 -0400 Subject: [PATCH 07/21] update molfile plugin headers with latest versions from VMD --- lib/molfile/molfile_plugin.h | 127 +++++++++++++++++++++++++++++------ lib/molfile/vmdplugin.h | 4 +- 2 files changed, 109 insertions(+), 22 deletions(-) diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 2b7c57b840..491cd375bb 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -11,7 +11,7 @@ * * $RCSfile: molfile_plugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.108 $ $Date: 2016/02/26 03:17:01 $ + * $Revision: 1.112 $ $Date: 2019/10/17 06:12:24 $ * ***************************************************************************/ @@ -111,7 +111,7 @@ typedef struct { char resname[8]; /**< required residue name string */ int resid; /**< required integer residue ID */ char segid[8]; /**< required segment name string, or "" */ -#if 0 && vmdplugin_ABIVERSION > 17 +#if 0 && vmdplugin_ABIVERSION > 10000 /* The new PDB file formats allows for much larger structures, */ /* which can therefore require longer chain ID strings. The */ /* new PDBx/mmCIF file formats do not have length limits on */ @@ -187,13 +187,58 @@ typedef struct molfile_timestep_metadata { int has_velocities; /**< if timesteps have velocities */ } molfile_timestep_metadata_t; + /* - * Per-timestep atom coordinates and periodic cell information + * + * Per-timestep atom coordinates, velocities, forces, energies, + * and periodic cell information + * + */ + +#if 0 +/** + * Periodically stored energies of various kinds + */ +typedef struct { + int energyflags; // XXX indicate use and semantics of data fields + + double total_energy; // XXX these copied from DESRES_READ_TIMESTEP2 case + double potential_energy; + double kinetic_energy; + double extended_energy; + double force_energy; + double total_pressure; + + // Alchemical free energy methods need to store individual energy samples. + // We don't really want pre-averaged quantities, they lead to problems later. + double lambda; // data gen sim parm: + aux scheduling + soft core parm + double temperature; // temp set by thermostat + // either we use deltaU, or we store U and Uprime... + double deltaU; // Ulambda - Ulambdaprime + double Ulambda; // U for lambda + double Ulambdaprime; // U for lambdaprime + + // IDWS methods + // XXX both values of lambdaprime and required de-interleaving information + + // Replica exchange methods + // XXX rectangle sample params? + + // REST2 method + // XXX + +} molfile_energies_t; +#endif + + +/** + * Per-timestep atom coordinates, velocities, time, energies + * and periodic cell info */ typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ float *velocities; /**< space for velocities of all atoms; same layout */ - /**< nullptr unless has_velocities is set */ + /**< NULL unless has_velocities is set */ /*@{*/ /** @@ -517,7 +562,7 @@ typedef struct { * form {orbital1(c1),orbital1(c2),.....,orbitalM(cN)} */ float *orbital_energies; /**< list of orbital energies for wavefunction */ float *occupancies; /**< orbital occupancies */ - int *orbital_ids; /**< orbital ID numbers; If nullptr then VMD will + int *orbital_ids; /**< orbital ID numbers; If NULL then VMD will * assume 1,2,3,...num_orbs. */ } molfile_qm_wavefunction_t; @@ -588,7 +633,7 @@ color r, g, b /** - * Main file reader API. Any function in this struct may be nullptr + * Main file reader API. Any function in this struct may be NULL * if not implemented by the plugin; the application checks this to determine * what functionality is present in the plugin. */ @@ -599,7 +644,7 @@ typedef struct { vmdplugin_HEAD /** - * Filename extension for this file type. May be nullptr if no filename + * Filename extension for this file type. May be NULL if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" @@ -611,7 +656,7 @@ typedef struct { const char *filename_extension; /** - * Try to open the file for reading. Return an opaque handle, or nullptr on + * Try to open the file for reading. Return an opaque handle, or NULL on * failure. Set the number of atoms; if the number of atoms cannot be * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; @@ -638,20 +683,20 @@ typedef struct { * the caller. * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be - * set to 0 and from/to should be set to nullptr to indicate that no bond + * set to 0 and from/to should be set to NULL to indicate that no bond * information was actually present, and automatic bond search should be * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to nullptr, in which case the caller will provide a + * pointer should be set to NULL, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array * will contain the bond type index for each from/to pair. These numbers * are consecutive integers starting from 0. * the bondtypenames list, contains the corresponding names, if available, - * as a nullptr string terminated list. nbondtypes is provided for convenience + * as a NULL string terminated list. nbondtypes is provided for convenience * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. @@ -662,11 +707,11 @@ typedef struct { int **bondtype, int *nbondtypes, char ***bondtypename); /** - * XXX this function will be augmented and possibly superseded by a + * XXX this function will be augmented and possibly superceded by a * new QM-capable version named read_timestep(), when finished. * * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is nullptr, then + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then * the frame should be skipped. Otherwise, the application must prepare * molfile_timestep_t by allocating space in coords for the corresponding * number of coordinates. @@ -684,7 +729,7 @@ typedef struct { /** * Open a coordinate file for writing using the given header information. - * Return an opaque handle, or nullptr on failure. The application must + * Return an opaque handle, or NULL on failure. The application must * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ @@ -757,7 +802,7 @@ typedef struct { * from/to and to/from versions of each. * This function must be called before write_structure(). * - * Like the read_bonds() routine, the bondorder pointer is set to nullptr + * Like the read_bonds() routine, the bondorder pointer is set to NULL * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. @@ -767,7 +812,7 @@ typedef struct { * index (consecutive integers starting from 0) and bondtypenames * contain the corresponding strings, in case the naming/numbering * scheme is different from the index numbers. - * if the pointers are set to nullptr, then this information is not available. + * if the pointers are set to NULL, then this information is not available. * bondtypenames can only be used of bondtypes is also given. * Return MOLFILE_SUCCESS if no errors occur. */ @@ -839,16 +884,39 @@ typedef struct { int (* read_qm_rundata)(void *, molfile_qm_t *qmdata); + /** + * Query the molfile plugin to determine whether or not memory + * allocations used for atomic coordinates and PBC unit cell information + * need to be aligned to a particular virtual memory or filesystem + * page size boundary to facilitate kernel-bypass unbuffered I/O, + * e.g., as used by jsplugin. This API should be called prior to the + * first call to read a timestep. The required page alignment size + * (in bytes) is returned to the caller. If this API has not been + * called, then the molfile plugin should revert to standard + * kernel-buffered I/O and suffer the associated performance loss. + * The caller can be assured that the plugin will not request any + * page alignment size that is greater than the value of + * MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, both as a runtime sanity check, + * and to ensure that a caller that is unable to perform the max + * aligned allocation doesn't call the API in the first place. + * If a page-aligned allocation is not required for the file being read, + * the plugin will return an alignment size of 1. + */ +#if vmdplugin_ABIVERSION > 17 + int (* read_timestep_pagealign_size)(void *, int *pagealignsize); +#endif + + /** * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are nullptr, then the coordinate or qm data should be skipped. + * arguments are NULL, then the coordinate or qm data should be skipped. * Otherwise, the application must prepare molfile_timestep_t and * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or nullptr pointers for the molfile_timestep_t and + * valid, or NULL pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. * The natoms and qm metadata parameters exist because some file formats @@ -862,6 +930,25 @@ typedef struct { int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *); int (* read_qm_timestep_metadata)(void *, molfile_qm_timestep_metadata_t *); + +#if defined(EXPERIMENTAL_DIRECTIO_APIS) + /** + * Calculate file offsets and I/O lengths for performing + * kernel-bypass direct I/O or using GPU-Direct Storage APIs, + * thereby enabling peak I/O rates to be achieved for analysis + * worksloads like clustering of trajectories. + */ + int (* calc_fileoffsets_timestep)(void *, + molfile_ssize_t frameindex, + int firstatom, + int lastatom, + int *firstatom, + int *pageoffset, + molfile_ssize_t *startoffset, + molfile_ssize_t *readlen); +#endif + + #if defined(DESRES_READ_TIMESTEP2) /** * Read a specified timestep! @@ -886,9 +973,9 @@ typedef struct { * caller the ability to prioritize, buffer, and redirect console messages * to an appropriate output channel, window, etc. This enables the use of * graphical consoles like TkCon without losing console output from plugins. - * If the function pointer is nullptr, no console output service is provided + * If the function pointer is NULL, no console output service is provided * by the calling application, and the output should default to stdout - * stream. If the function pointer is non-nullptr, all output will be + * stream. If the function pointer is non-NULL, all output will be * subsequently dealt with by the calling application. * * XXX this should really be put into a separate block of diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index 842d1e431c..7afc358e97 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -11,7 +11,7 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.33 $ $Date: 2015/10/29 05:10:54 $ + * $Revision: 1.34 $ $Date: 2018/05/02 03:12:56 $ * ***************************************************************************/ @@ -144,7 +144,7 @@ typedef struct { /** * Use this macro to initialize the abiversion member of each plugin */ -#define vmdplugin_ABIVERSION 17 +#define vmdplugin_ABIVERSION 18 /*@{*/ /** Use this macro to indicate a plugin's thread-safety at registration time */ -- GitLab From 93a0d4c096d15ef7953565924b24958e24528a07 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 12 Sep 2020 14:26:34 -0400 Subject: [PATCH 08/21] fix up some comments --- src/BODY/body_rounded_polygon.cpp | 2 +- src/BODY/body_rounded_polyhedron.cpp | 2 +- src/BODY/fix_wall_body_polygon.cpp | 2 +- src/BODY/fix_wall_body_polyhedron.cpp | 2 +- src/BODY/pair_body_rounded_polyhedron.cpp | 2 +- src/GPU/pppm_gpu.cpp | 2 +- src/GRANULAR/fix_wall_gran.cpp | 4 ++-- src/GRANULAR/fix_wall_gran.h | 2 +- src/GRANULAR/pair_gran_hooke_history.h | 2 +- src/GRANULAR/pair_granular.h | 2 +- src/KIM/fix_store_kim.h | 4 ++-- src/KIM/kim_interactions.cpp | 2 +- src/KOKKOS/atom_kokkos.cpp | 2 +- src/KOKKOS/pair_kokkos.h | 2 +- src/LATTE/fix_latte.cpp | 2 +- src/MISC/dump_xtc.cpp | 2 +- src/USER-DPD/pair_multi_lucy.cpp | 2 +- src/USER-DPD/pair_multi_lucy_rx.cpp | 2 +- src/USER-PHONON/fix_phonon.cpp | 2 +- src/atom.cpp | 4 ++-- src/atom.h | 2 +- src/comm.cpp | 12 ++++++------ src/compute_chunk_atom.h | 2 +- src/dump.cpp | 2 +- src/error.cpp | 8 ++++---- src/fix_property_atom.cpp | 2 +- src/input.cpp | 4 ++-- src/modify.cpp | 2 +- src/neighbor.cpp | 2 +- src/output.h | 2 +- src/pair_table.cpp | 2 +- src/read_dump.cpp | 8 ++++---- src/utils.cpp | 2 +- src/utils.h | 4 ++-- 34 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index f2e798c93c..c7d006c67f 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -321,7 +321,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is nullptr, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolygon::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index b647c7e541..423a3b3443 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -373,7 +373,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is nullptr, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolyhedron::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 99ae8ed094..2e69f70af7 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -226,7 +226,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 2507b94d25..472fe5fb21 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -233,7 +233,7 @@ void FixWallBodyPolyhedron::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 1d7461199d..a3cffef9cc 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -1880,7 +1880,7 @@ void PairBodyRoundedPolyhedron::project_pt_plane(const double* q, face_index = face index of the body xmi = atom i's coordinates q1 = tested point on the face (e.g. the projection of a point) - q2 = another point (can be nullptr) for face-edge intersection + q2 = another point (can be a null pointer) for face-edge intersection Output: inside1 = 1 if q1 is inside the polygon, 0 otherwise inside2 = 1 if q2 is inside the polygon, 0 otherwise diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 9b753edd68..a2e3e3ab98 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -117,7 +117,7 @@ void PPPMGPU::init() // thru its deallocate(), allocate() // NOTE: could free density_brick and vdxyz_brick after PPPM allocates them, // before allocating db_gpu and vd_brick down below, if don't need, - // if do this, make sure to set them to nullptr + // if do this, make sure to set them to a null pointer destroy_3d_offset(density_brick_gpu,nzlo_out,nylo_out); destroy_3d_offset(vd_brick,nzlo_out,nylo_out); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 25d271be9d..9482aae3e7 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -416,7 +416,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : mass_rigid = nullptr; // initialize history as if particle is not touching region - // history_one will be nullptr for wallstyle = REGION + // history_one will be a null pointer for wallstyle = REGION if (use_history && history_one) { int nlocal = atom->nlocal; @@ -576,7 +576,7 @@ void FixWallGran::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential // set history if pair potential stores history diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 1b3be22e7f..a81a4c787c 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -103,7 +103,7 @@ class FixWallGran : public Fix { // rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index dd9a843142..c27ce8a9af 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -61,7 +61,7 @@ class PairGranHookeHistory : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index ce417812de..7ef4f2af98 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -56,7 +56,7 @@ class PairGranular : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 4e4890ea6e..5775056876 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -79,8 +79,8 @@ class FixStoreKIM : public Fix { private: void *simulator_model; // pointer to KIM simulator model class void *model_name; // string of KIM model name - void *model_units; // string of unit conversion origin or nullptr - void *user_units; // string of unit conversion target or nullptr + void *model_units; // string of unit conversion origin or null pointer + void *user_units; // string of unit conversion target or null pointer }; } diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 7551216072..c5ae2ec380 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -108,7 +108,7 @@ void KimInteractions::do_setup(int narg, char **arg) // check if we had a kim_init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. - // validate model name if not given as nullptr. + // validate model name if not given as null pointer. int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index ed0cfccd43..e9093ee0a1 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -282,7 +282,7 @@ int AtomKokkos::add_custom(const char *name, int flag) /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to nullptr + free memory for vector and name and set ptrs to a null pointer ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 1eaf20eadb..cb55dd3141 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -94,7 +94,7 @@ struct PairComputeFunctor { dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); }; - // Call cleanup_copy which sets allocations nullptr which are destructed by the PairStyle + // Call cleanup_copy which sets allocations to null which are destructed by the PairStyle ~PairComputeFunctor() {c.cleanup_copy();list.copymode = 1;}; KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const { diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 0581f1e359..055e62c418 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -74,7 +74,7 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : thermo_virial = 1; // store ID of compute pe/atom used to generate Coulomb potential for LATTE - // nullptr means LATTE will compute Coulombic potential + // null pointer means LATTE will compute Coulombic potential coulomb = 0; id_pe = nullptr; diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 5c3ca7264e..35cca32871 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -137,7 +137,7 @@ void DumpXTC::init_style() void DumpXTC::openfile() { // XTC maintains it's own XDR file ptr - // set fp to nullptr so parent dump class will not use it + // set fp to a null pointer so parent dump class will not use it fp = nullptr; if (me == 0) diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 2e556d82e4..a266e94ccb 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -582,7 +582,7 @@ void PairMultiLucy::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucy::null_table(Table *tb) diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index e56743ea1d..d8356d20c4 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -727,7 +727,7 @@ void PairMultiLucyRX::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucyRX::null_table(Table *tb) diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index c80073f3c7..d8900d2348 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -162,7 +162,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fft = new FFT3d(lmp,world,nz,ny,nx,0,nz-1,0,ny-1,nxlo,nxhi,0,nz-1,0,ny-1,nxlo,nxhi,0,0,&mysize,0); memory->create(fft_data, MAX(1,mynq)*2, "fix_phonon:fft_data"); - // allocate variables; MAX(1,... is used because nullptr buffer will result in error for MPI + // allocate variables; MAX(1,... is used because a null buffer will result in error for MPI memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); diff --git a/src/atom.cpp b/src/atom.cpp index 539bf6fc0b..e140d2e473 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2201,10 +2201,10 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find nullptr: + // if find null pointer: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find nullptr: + // if don't find null pointer: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) diff --git a/src/atom.h b/src/atom.h index 841d224d23..4ea4157fa2 100644 --- a/src/atom.h +++ b/src/atom.h @@ -55,7 +55,7 @@ class Atom : protected Pointers { int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc - char *firstgroupname; // group-ID to store first, nullptr if unset + char *firstgroupname; // group-ID to store first, null pointer if unset // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variable diff --git a/src/comm.cpp b/src/comm.cpp index becb52df91..32a4152294 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -888,7 +888,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, if (inorder) nrvous = irregular->create_data_grouped(n,procs); else nrvous = irregular->create_data(n,procs); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -925,7 +925,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); @@ -967,7 +967,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!inorder) { memory->create(procs_a2a,nprocs,"rendezvous:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer inbuf_a2a = (char *) memory->smalloc((bigint) n*insize+1, "rendezvous:inbuf"); @@ -1032,7 +1032,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, } // all2all comm of inbuf from caller decomp to rendezvous decomp - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -1074,7 +1074,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!outorder) { memory->create(procs_a2a,nprocs,"rendezvous_a2a:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); @@ -1135,7 +1135,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of outbuf from rendezvous decomp back to caller decomp // caller will free outbuf - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,"rendezvous:outbuf"); diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 14c86383b7..392179043a 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -96,7 +96,7 @@ class ComputeChunkAtom : public Compute { class FixStore *fixstore; class Fix *lockfix; // ptr to FixAveChunk that is locking out setups - // nullptr if no lock currently in place + // null pointer if no lock currently in place bigint lockstart,lockstop; // timesteps for start and stop of locking bigint invoked_setup; // last timestep setup_chunks and nchunk calculated diff --git a/src/dump.cpp b/src/dump.cpp index 3f1e997d13..2259f9ef3e 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -202,7 +202,7 @@ Dump::~Dump() delete[] nameslist; } - // XTC style sets fp to nullptr since it closes file in its destructor + // XTC style sets fp to a null pointer since it closes file in its destructor if (multifile == 0 && fp != nullptr) { if (compressed) { diff --git a/src/error.cpp b/src/error.cpp index d89ea5b681..fff3072bb1 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -95,7 +95,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -143,7 +143,7 @@ void Error::all(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -192,7 +192,7 @@ void Error::one(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 35ac20e370..e6ed9ea023 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -152,7 +152,7 @@ FixPropertyAtom::~FixPropertyAtom() if (border) atom->delete_callback(id,2); // deallocate per-atom vectors in Atom class - // set ptrs to nullptr, so they no longer exist for Atom class + // set ptrs to a null pointer, so they no longer exist for Atom class for (int m = 0; m < nvalue; m++) { if (style[m] == MOLECULE) { diff --git a/src/input.cpp b/src/input.cpp index 5e40d2dede..4539dfabf8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -338,7 +338,7 @@ char *Input::one(const std::string &single) } // parse the line - // if no command, just return nullptr + // if no command, just return a null pointer parse(); if (command == nullptr) return nullptr; @@ -450,7 +450,7 @@ void Input::parse() treat text between single/double/triple quotes as one arg matching quote must be followed by whitespace char if not end of string strip quotes from returned word - return ptr to start of word or nullptr if no word in string + return ptr to start of word or null pointer if no word in string also return next = ptr after word ------------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index a908cfc7af..0f0a86cdd8 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -821,7 +821,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // warn if new group != old group // delete old fix, but do not call update_callback(), // since will replace this fix and thus other fix locs will not change - // set ptr to nullptr in case new fix scans list of fixes, + // set ptr to a null pointer in case new fix scans list of fixes, // e.g. scan will occur in add_callback() if called by new fix // if fix ID does not exist: // set newflag = 1 so create new fix diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 26e7d6b74b..db67f71548 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -378,7 +378,7 @@ void Neighbor::init() // We cannot remove special neighbors with kspace or kspace-like pair styles // as the exclusion needs to remove the full coulomb and not the damped interaction. // Special treatment is required for hybrid pair styles since Force::pair_match() - // will only return a non-nullptr pointer if there is only one substyle of the kind. + // will only return a non-null pointer if there is only one substyle of the kind. if (force->kspace) { special_flag[1] = special_flag[2] = special_flag[3] = 2; diff --git a/src/output.h b/src/output.h index 6a64e67c93..1af03df228 100644 --- a/src/output.h +++ b/src/output.h @@ -29,7 +29,7 @@ class Output : protected Pointers { bigint next_thermo; // next timestep for thermo output int thermo_every; // output freq for thermo, 0 if first/last only bigint last_thermo; // last timestep thermo was output - char *var_thermo; // variable name for thermo freq, nullptr if every + char *var_thermo; // variable name for thermo freq, null pointer if every int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations diff --git a/src/pair_table.cpp b/src/pair_table.cpp index c0fad544d7..a92d2e4911 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -821,7 +821,7 @@ void PairTable::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairTable::null_table(Table *tb) diff --git a/src/read_dump.cpp b/src/read_dump.cpp index dcbb95fccc..426d0f5a92 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid nullptr + newmaxnew = MAX(newmaxnew,1); // avoid null pointer memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); diff --git a/src/utils.cpp b/src/utils.cpp index e985f9e6e5..b0928fd18a 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -171,7 +171,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, errmsg += "'"; if (error) error->one(srcname,srcline,errmsg); - if (s) *s = '\0'; // truncate string to empty in case error is nullptr + if (s) *s = '\0'; // truncate string to empty in case error is null pointer } return; } diff --git a/src/utils.h b/src/utils.h index cf8952b8a6..c9e958365d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { * \param s buffer for storing the result of fgets() * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() - * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfgets(const char *srcname, int srcline, char *s, int size, @@ -75,7 +75,7 @@ namespace LAMMPS_NS { * \param size size of data elements read by fread() * \param num number of data elements read by fread() * \param fp file pointer used by fread() - * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfread(const char *srcname, int srcline, void *s, size_t size, -- GitLab From 9a5d8fd18b2969afaa2767d710b71e76e1875e3d Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 07:39:46 -0600 Subject: [PATCH 09/21] Manually resolve two rebase conflicts. --- lib/atc/ATC_Coupling.cpp | 50 +-- lib/atc/ATC_Coupling.h | 24 +- lib/atc/ATC_CouplingEnergy.cpp | 6 +- lib/atc/ATC_CouplingMomentumEnergy.cpp | 6 +- lib/atc/ATC_Method.cpp | 52 +-- lib/atc/ATC_Method.h | 2 +- lib/atc/ATC_Transfer.cpp | 22 +- lib/atc/Array.h | 28 +- lib/atc/Array2D.h | 20 +- lib/atc/AtomicRegulator.cpp | 36 +- lib/atc/AtomicRegulator.h | 2 +- lib/atc/CauchyBorn.cpp | 2 +- lib/atc/ChargeRegulator.cpp | 2 +- lib/atc/CloneVector.h | 6 +- lib/atc/ConcentrationRegulator.cpp | 8 +- lib/atc/DenseMatrix.h | 12 +- lib/atc/DenseVector.h | 8 +- lib/atc/DiagonalMatrix.h | 6 +- lib/atc/DislocationExtractor.h | 16 +- lib/atc/ElasticTimeIntegrator.cpp | 10 +- lib/atc/ElectronHeatFlux.h | 10 +- lib/atc/ExtrinsicModel.cpp | 6 +- lib/atc/ExtrinsicModelDriftDiffusion.cpp | 10 +- lib/atc/ExtrinsicModelElectrostatic.cpp | 10 +- lib/atc/ExtrinsicModelTwoTemperature.cpp | 4 +- lib/atc/FE_Element.cpp | 2 +- lib/atc/FE_Engine.cpp | 2 +- lib/atc/FE_Engine.h | 22 +- lib/atc/FE_Mesh.cpp | 12 +- lib/atc/FieldEulerIntegrator.cpp | 2 +- lib/atc/FieldManager.cpp | 2 +- lib/atc/FieldManager.h | 14 +- lib/atc/Function.cpp | 12 +- lib/atc/FundamentalAtomicQuantity.cpp | 2 +- lib/atc/FundamentalAtomicQuantity.h | 4 +- lib/atc/GhostManager.cpp | 26 +- lib/atc/InterscaleOperators.cpp | 8 +- lib/atc/InterscaleOperators.h | 4 +- lib/atc/KD_Tree.cpp | 14 +- lib/atc/KernelFunction.cpp | 6 +- lib/atc/KinetoThermostat.cpp | 48 +-- lib/atc/Kinetostat.cpp | 44 +-- lib/atc/LammpsInterface.cpp | 38 +-- lib/atc/LammpsInterface.h | 2 +- lib/atc/LinearSolver.cpp | 16 +- lib/atc/LinearSolver.h | 4 +- lib/atc/Material.cpp | 36 +- lib/atc/MoleculeSet.h | 8 +- lib/atc/NonLinearSolver.h | 2 +- lib/atc/OutputManager.cpp | 24 +- lib/atc/OutputManager.h | 6 +- lib/atc/PaqAtcUtility.cpp | 2 +- lib/atc/ParDenseMatrix.h | 2 +- lib/atc/ParSparseMatrix.cpp | 8 +- lib/atc/ParSparseMatrix.h | 6 +- lib/atc/PerAtomQuantity-inl.h | 10 +- lib/atc/PerAtomQuantity.h | 8 +- lib/atc/PerAtomQuantityLibrary.h | 130 +++---- lib/atc/PerPairQuantity.cpp | 2 +- lib/atc/PhysicsModel.h | 2 +- lib/atc/PoissonSolver.cpp | 6 +- lib/atc/PrescribedDataManager.cpp | 26 +- lib/atc/Quadrature.cpp | 6 +- lib/atc/SchrodingerSolver.cpp | 2 +- lib/atc/SparseMatrix-inl.h | 16 +- lib/atc/SparseVector.h | 2 +- lib/atc/SpeciesTimeIntegrator.cpp | 4 +- lib/atc/SpeciesTimeIntegrator.h | 2 +- lib/atc/Stress.cpp | 6 +- lib/atc/Stress.h | 2 +- lib/atc/ThermalTimeIntegrator.cpp | 4 +- lib/atc/Thermostat.cpp | 56 +-- lib/atc/TimeFilter.cpp | 2 +- lib/atc/TimeIntegrator.cpp | 12 +- lib/atc/TransferLibrary.cpp | 10 +- lib/atc/TransferLibrary.h | 34 +- lib/atc/TransferOperator.h | 6 +- lib/atc/Utility.h | 2 +- lib/awpmd/ivutils/include/logexc.h | 8 +- lib/awpmd/ivutils/include/pairhash.h | 28 +- lib/awpmd/ivutils/include/refobj.h | 20 +- lib/awpmd/ivutils/include/vector_3.h | 14 +- lib/awpmd/ivutils/src/logexc.cpp | 2 +- lib/awpmd/systems/interact/TCP/wpmd.h | 20 +- lib/awpmd/systems/interact/TCP/wpmd_split.cpp | 4 +- lib/awpmd/systems/interact/TCP/wpmd_split.h | 16 +- lib/colvars/colvar.cpp | 20 +- lib/colvars/colvaratoms.cpp | 8 +- lib/colvars/colvarbias.cpp | 26 +- lib/colvars/colvarbias.h | 4 +- lib/colvars/colvarbias_abf.cpp | 42 +-- lib/colvars/colvarbias_histogram.cpp | 4 +- lib/colvars/colvarbias_meta.cpp | 46 +-- lib/colvars/colvarcomp.cpp | 8 +- lib/colvars/colvarcomp_coordnums.cpp | 38 +-- lib/colvars/colvarcomp_distances.cpp | 2 +- lib/colvars/colvardeps.cpp | 2 +- lib/colvars/colvargrid.cpp | 14 +- lib/colvars/colvarmodule.cpp | 60 ++-- lib/colvars/colvarmodule.h | 6 +- lib/colvars/colvarparams.cpp | 6 +- lib/colvars/colvarparse.cpp | 10 +- lib/colvars/colvarparse.h | 8 +- lib/colvars/colvarproxy.cpp | 16 +- lib/colvars/colvarproxy.h | 2 +- lib/colvars/colvarscript.cpp | 20 +- lib/colvars/colvarscript.h | 2 +- lib/colvars/colvartypes.h | 4 +- lib/colvars/lepton/include/lepton/Operation.h | 12 +- lib/colvars/lepton/src/CompiledExpression.cpp | 8 +- lib/colvars/lepton/src/ExpressionTreeNode.cpp | 8 +- lib/colvars/lepton/src/ParsedExpression.cpp | 2 +- lib/gpu/cudpp_mini/cudpp.cpp | 14 +- lib/gpu/cudpp_mini/cudpp_plan.cpp | 2 +- lib/gpu/cudpp_mini/cudpp_plan_manager.cpp | 22 +- lib/gpu/cudpp_mini/cutil.h | 20 +- lib/gpu/geryon/hip_device.h | 4 +- lib/gpu/geryon/hip_kernel.h | 8 +- lib/gpu/geryon/hip_memory.h | 6 +- lib/gpu/geryon/hip_texture.h | 2 +- lib/gpu/geryon/nvd_kernel.h | 10 +- lib/gpu/geryon/nvd_memory.h | 6 +- lib/gpu/geryon/nvd_texture.h | 2 +- lib/gpu/geryon/ocl_device.h | 40 +-- lib/gpu/geryon/ocl_kernel.h | 26 +- lib/gpu/geryon/ocl_memory.h | 78 ++--- lib/gpu/geryon/ocl_timer.h | 6 +- lib/gpu/geryon/ucl_basemat.h | 4 +- lib/gpu/geryon/ucl_d_vec.h | 2 +- lib/gpu/lal_answer.cpp | 14 +- lib/gpu/lal_base_atomic.cpp | 10 +- lib/gpu/lal_base_charge.cpp | 10 +- lib/gpu/lal_base_dipole.cpp | 10 +- lib/gpu/lal_base_dpd.cpp | 10 +- lib/gpu/lal_base_ellipsoid.cpp | 16 +- lib/gpu/lal_base_three.cpp | 10 +- lib/gpu/lal_base_three.h | 2 +- lib/gpu/lal_device.cpp | 18 +- lib/gpu/lal_eam.cpp | 6 +- lib/gpu/lal_lj_tip4p_long.cpp | 4 +- lib/gpu/lal_neighbor.cpp | 2 +- lib/gpu/lal_pppm.cpp | 2 +- lib/gpu/lal_pppm_ext.cpp | 6 +- lib/gpu/lal_yukawa_colloid.cpp | 4 +- lib/kokkos/cmake/compile_tests/pthread.cpp | 6 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 2 +- lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp | 2 +- .../core/src/impl/Kokkos_SharedAlloc.cpp | 2 +- lib/kokkos/core/unit_test/TestCTestDevice.cpp | 2 +- lib/message/cslib/src/STUBS_ZMQ/zmq.h | 6 +- lib/message/cslib/src/cslib.cpp | 28 +- lib/message/cslib/src/cslib_wrap.cpp | 2 +- lib/message/cslib/src/msg.cpp | 6 +- lib/message/cslib/src/msg_mpi_two.cpp | 2 +- lib/message/cslib/src/msg_zmq.cpp | 8 +- lib/molfile/molfile_plugin.h | 32 +- lib/poems/SystemProcessor.h | 30 +- lib/poems/poemsnodelib.h | 20 +- lib/poems/poemstree.h | 62 ++-- lib/poems/poemstreenode.cpp | 2 +- lib/poems/poemstreenode.h | 2 +- lib/poems/solver.cpp | 2 +- lib/poems/system.cpp | 10 +- lib/poems/workspace.cpp | 6 +- src/ASPHERE/compute_temp_asphere.cpp | 4 +- src/ASPHERE/pair_gayberne.cpp | 24 +- src/ASPHERE/pair_line_lj.cpp | 4 +- src/ASPHERE/pair_resquared.cpp | 16 +- src/ASPHERE/pair_tri_lj.cpp | 4 +- src/BODY/body_nparticle.cpp | 4 +- src/BODY/body_rounded_polygon.cpp | 2 +- src/BODY/body_rounded_polyhedron.cpp | 4 +- src/BODY/compute_body_local.cpp | 6 +- src/BODY/compute_temp_body.cpp | 4 +- src/BODY/fix_wall_body_polygon.cpp | 14 +- src/BODY/fix_wall_body_polyhedron.cpp | 18 +- src/BODY/pair_body_nparticle.cpp | 4 +- src/BODY/pair_body_rounded_polygon.cpp | 16 +- src/BODY/pair_body_rounded_polyhedron.cpp | 32 +- src/CLASS2/angle_class2.cpp | 26 +- src/CLASS2/bond_class2.cpp | 10 +- src/CLASS2/dihedral_class2.cpp | 78 ++--- src/CLASS2/improper_class2.cpp | 18 +- src/CLASS2/pair_lj_class2.cpp | 20 +- src/CLASS2/pair_lj_class2_coul_cut.cpp | 22 +- src/CLASS2/pair_lj_class2_coul_long.cpp | 32 +- src/COLLOID/pair_brownian.cpp | 32 +- src/COLLOID/pair_brownian_poly.cpp | 2 +- src/COLLOID/pair_colloid.cpp | 18 +- src/COLLOID/pair_lubricate.cpp | 26 +- src/COLLOID/pair_lubricateU.cpp | 28 +- src/COLLOID/pair_lubricateU_poly.cpp | 2 +- src/COLLOID/pair_lubricate_poly.cpp | 4 +- src/COMPRESS/dump_atom_gz.cpp | 12 +- src/COMPRESS/dump_cfg_gz.cpp | 12 +- src/COMPRESS/dump_custom_gz.cpp | 12 +- src/COMPRESS/dump_local_gz.cpp | 12 +- src/COMPRESS/dump_xyz_gz.cpp | 12 +- src/CORESHELL/compute_temp_cs.cpp | 4 +- src/CORESHELL/pair_born_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_buck_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_lj_class2_coul_long_cs.cpp | 2 +- src/CORESHELL/pair_lj_cut_coul_long_cs.cpp | 2 +- src/DIPOLE/pair_lj_cut_dipole_cut.cpp | 18 +- src/DIPOLE/pair_lj_cut_dipole_long.cpp | 20 +- src/DIPOLE/pair_lj_long_dipole_long.cpp | 32 +- src/GPU/fix_gpu.cpp | 4 +- src/GPU/pair_born_coul_long_cs_gpu.cpp | 2 +- src/GPU/pair_born_coul_long_gpu.cpp | 2 +- src/GPU/pair_buck_coul_long_gpu.cpp | 2 +- src/GPU/pair_colloid_gpu.cpp | 2 +- src/GPU/pair_coul_long_cs_gpu.cpp | 4 +- src/GPU/pair_coul_long_gpu.cpp | 4 +- src/GPU/pair_eam_alloy_gpu.cpp | 4 +- src/GPU/pair_eam_alloy_gpu.h | 2 +- src/GPU/pair_eam_fs_gpu.cpp | 4 +- src/GPU/pair_eam_fs_gpu.h | 2 +- src/GPU/pair_eam_gpu.cpp | 2 +- src/GPU/pair_eam_gpu.h | 2 +- src/GPU/pair_gayberne_gpu.cpp | 2 +- src/GPU/pair_lj96_cut_gpu.cpp | 2 +- src/GPU/pair_lj_charmm_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_class2_coul_long_gpu.cpp | 2 +- src/GPU/pair_lj_cut_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_cut_coul_msm_gpu.cpp | 2 +- src/GPU/pair_lj_cut_dipole_long_gpu.cpp | 4 +- src/GPU/pair_lj_cut_gpu.cpp | 2 +- src/GPU/pair_lj_cut_tip4p_long_gpu.cpp | 8 +- src/GPU/pair_lj_expand_coul_long_gpu.cpp | 4 +- src/GPU/pair_lj_sdk_coul_long_gpu.cpp | 4 +- src/GPU/pair_mie_cut_gpu.cpp | 2 +- src/GPU/pair_resquared_gpu.cpp | 2 +- src/GPU/pair_sw_gpu.cpp | 8 +- src/GPU/pair_table_gpu.cpp | 4 +- src/GPU/pair_tersoff_gpu.cpp | 12 +- src/GPU/pair_tersoff_mod_gpu.cpp | 12 +- src/GPU/pair_tersoff_zbl_gpu.cpp | 12 +- src/GPU/pair_ufm_gpu.cpp | 2 +- src/GPU/pair_vashishta_gpu.cpp | 12 +- src/GPU/pppm_gpu.cpp | 10 +- src/GRANULAR/fix_pour.cpp | 24 +- src/GRANULAR/fix_wall_gran.cpp | 18 +- src/GRANULAR/fix_wall_gran.h | 2 +- src/GRANULAR/fix_wall_gran_region.cpp | 16 +- src/GRANULAR/pair_gran_hooke_history.cpp | 22 +- src/GRANULAR/pair_gran_hooke_history.h | 2 +- src/GRANULAR/pair_granular.cpp | 40 +-- src/GRANULAR/pair_granular.h | 2 +- src/KIM/fix_store_kim.cpp | 14 +- src/KIM/fix_store_kim.h | 4 +- src/KIM/kim_init.cpp | 8 +- src/KIM/kim_interactions.cpp | 10 +- src/KIM/kim_param.cpp | 12 +- src/KIM/kim_property.cpp | 4 +- src/KIM/pair_kim.cpp | 44 +-- src/KOKKOS/atom_kokkos.cpp | 12 +- src/KOKKOS/atom_vec_angle_kokkos.cpp | 2 +- src/KOKKOS/atom_vec_kokkos.cpp | 2 +- src/KOKKOS/comm_kokkos.cpp | 14 +- src/KOKKOS/fft3d_kokkos.cpp | 52 +-- src/KOKKOS/fix_langevin_kokkos.cpp | 26 +- src/KOKKOS/fix_minimize_kokkos.cpp | 2 +- src/KOKKOS/fix_neigh_history_kokkos.cpp | 6 +- src/KOKKOS/fix_nve_kokkos.cpp | 4 +- src/KOKKOS/fix_nve_sphere_kokkos.cpp | 4 +- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 2 +- src/KOKKOS/fix_reaxc_bonds_kokkos.cpp | 2 +- src/KOKKOS/fix_reaxc_species_kokkos.cpp | 2 +- src/KOKKOS/fix_rx_kokkos.cpp | 12 +- src/KOKKOS/fix_rx_kokkos.h | 2 +- src/KOKKOS/fix_setforce_kokkos.cpp | 4 +- src/KOKKOS/fix_shardlow_kokkos.cpp | 8 +- src/KOKKOS/gridcomm_kokkos.cpp | 14 +- src/KOKKOS/kokkos.cpp | 2 +- src/KOKKOS/memory_kokkos.h | 26 +- src/KOKKOS/min_kokkos.cpp | 2 +- src/KOKKOS/neighbor_kokkos.cpp | 10 +- src/KOKKOS/pair_buck_coul_cut_kokkos.cpp | 16 +- src/KOKKOS/pair_buck_coul_long_kokkos.cpp | 24 +- src/KOKKOS/pair_buck_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_cut_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_debye_kokkos.cpp | 8 +- src/KOKKOS/pair_coul_long_kokkos.cpp | 16 +- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_alloy_kokkos.h | 2 +- src/KOKKOS/pair_eam_fs_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_fs_kokkos.h | 2 +- src/KOKKOS/pair_eam_kokkos.h | 2 +- src/KOKKOS/pair_exp6_rx_kokkos.cpp | 12 +- src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 6 +- src/KOKKOS/pair_hybrid_kokkos.cpp | 2 +- src/KOKKOS/pair_kokkos.h | 2 +- ..._lj_charmm_coul_charmm_implicit_kokkos.cpp | 16 +- .../pair_lj_charmm_coul_charmm_kokkos.cpp | 16 +- .../pair_lj_charmm_coul_long_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp | 16 +- .../pair_lj_class2_coul_long_kokkos.cpp | 14 +- src/KOKKOS/pair_lj_class2_kokkos.cpp | 10 +- src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp | 18 +- src/KOKKOS/pair_lj_cut_kokkos.cpp | 14 +- src/KOKKOS/pair_lj_expand_kokkos.cpp | 10 +- .../pair_lj_gromacs_coul_gromacs_kokkos.cpp | 16 +- src/KOKKOS/pair_lj_gromacs_kokkos.cpp | 26 +- src/KOKKOS/pair_lj_sdk_kokkos.cpp | 10 +- src/KOKKOS/pair_morse_kokkos.cpp | 14 +- src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp | 4 +- src/KOKKOS/pair_reaxc_kokkos.cpp | 6 +- src/KOKKOS/pair_sw_kokkos.cpp | 4 +- src/KOKKOS/pair_table_kokkos.cpp | 10 +- src/KOKKOS/pair_table_rx_kokkos.cpp | 10 +- src/KOKKOS/pair_vashishta_kokkos.cpp | 4 +- src/KOKKOS/pair_yukawa_kokkos.cpp | 14 +- src/KOKKOS/pair_zbl_kokkos.cpp | 12 +- src/KOKKOS/pppm_kokkos.cpp | 52 +-- src/KOKKOS/rand_pool_wrap_kokkos.cpp | 4 +- src/KOKKOS/rand_pool_wrap_kokkos.h | 2 +- src/KOKKOS/remap_kokkos.cpp | 26 +- src/KSPACE/ewald.cpp | 24 +- src/KSPACE/ewald_dipole.cpp | 8 +- src/KSPACE/ewald_dipole_spin.cpp | 2 +- src/KSPACE/ewald_disp.cpp | 58 ++-- src/KSPACE/fft3d.cpp | 58 ++-- src/KSPACE/fft3d_wrap.cpp | 2 +- src/KSPACE/gridcomm.cpp | 12 +- src/KSPACE/kissfft.h | 6 +- src/KSPACE/msm.cpp | 84 ++--- src/KSPACE/msm_cg.cpp | 2 +- src/KSPACE/pair_born_coul_long.cpp | 38 +-- src/KSPACE/pair_born_coul_msm.cpp | 4 +- src/KSPACE/pair_buck_coul_long.cpp | 30 +- src/KSPACE/pair_buck_coul_msm.cpp | 4 +- src/KSPACE/pair_buck_long_coul_long.cpp | 42 +-- src/KSPACE/pair_coul_long.cpp | 24 +- src/KSPACE/pair_coul_msm.cpp | 2 +- src/KSPACE/pair_lj_charmm_coul_long.cpp | 34 +- src/KSPACE/pair_lj_charmm_coul_msm.cpp | 4 +- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 34 +- src/KSPACE/pair_lj_cut_coul_long.cpp | 32 +- src/KSPACE/pair_lj_cut_coul_msm.cpp | 4 +- src/KSPACE/pair_lj_cut_tip4p_long.cpp | 36 +- src/KSPACE/pair_lj_long_coul_long.cpp | 40 +-- src/KSPACE/pair_lj_long_tip4p_long.cpp | 44 +-- src/KSPACE/pair_tip4p_long.cpp | 20 +- src/KSPACE/pppm.cpp | 66 ++-- src/KSPACE/pppm_cg.cpp | 2 +- src/KSPACE/pppm_dipole.cpp | 34 +- src/KSPACE/pppm_dipole_spin.cpp | 12 +- src/KSPACE/pppm_disp.cpp | 322 +++++++++--------- src/KSPACE/pppm_stagger.cpp | 2 +- src/KSPACE/remap.cpp | 28 +- src/KSPACE/remap_wrap.cpp | 2 +- src/LATTE/fix_latte.cpp | 12 +- src/MANYBODY/fix_qeq_comb.cpp | 10 +- src/MANYBODY/pair_adp.cpp | 40 +-- src/MANYBODY/pair_airebo.cpp | 14 +- src/MANYBODY/pair_airebo.h | 2 +- src/MANYBODY/pair_atm.cpp | 8 +- src/MANYBODY/pair_bop.cpp | 232 ++++++------- src/MANYBODY/pair_comb.cpp | 42 +-- src/MANYBODY/pair_comb3.cpp | 62 ++-- src/MANYBODY/pair_eam.cpp | 42 +-- src/MANYBODY/pair_eam_alloy.cpp | 2 +- src/MANYBODY/pair_eam_cd.cpp | 10 +- src/MANYBODY/pair_eam_cd.h | 2 +- src/MANYBODY/pair_eam_fs.cpp | 2 +- src/MANYBODY/pair_eim.cpp | 32 +- src/MANYBODY/pair_gw.cpp | 14 +- src/MANYBODY/pair_gw_zbl.cpp | 2 +- src/MANYBODY/pair_lcbop.cpp | 18 +- src/MANYBODY/pair_lcbop.h | 2 +- src/MANYBODY/pair_nb3b_harmonic.cpp | 12 +- src/MANYBODY/pair_polymorphic.cpp | 4 +- src/MANYBODY/pair_sw.cpp | 14 +- src/MANYBODY/pair_tersoff.cpp | 14 +- src/MANYBODY/pair_vashishta.cpp | 14 +- src/MANYBODY/pair_vashishta_table.cpp | 8 +- src/MC/fix_atom_swap.cpp | 14 +- src/MC/fix_bond_break.cpp | 4 +- src/MC/fix_bond_create.cpp | 14 +- src/MC/fix_bond_swap.cpp | 12 +- src/MC/fix_gcmc.cpp | 28 +- src/MC/fix_tfmc.cpp | 6 +- src/MC/fix_widom.cpp | 14 +- src/MC/pair_dsmc.cpp | 20 +- src/MESSAGE/fix_client_md.cpp | 2 +- src/MESSAGE/message.cpp | 2 +- src/MESSAGE/server_mc.cpp | 4 +- src/MESSAGE/server_md.cpp | 28 +- src/MISC/compute_ti.cpp | 12 +- src/MISC/dump_xtc.cpp | 50 +-- src/MISC/fix_deposit.cpp | 20 +- src/MISC/fix_efield.cpp | 12 +- src/MISC/fix_evaporate.cpp | 6 +- src/MISC/fix_gld.cpp | 4 +- src/MISC/fix_oneway.cpp | 2 +- src/MISC/fix_orient_bcc.cpp | 6 +- src/MISC/fix_orient_fcc.cpp | 8 +- src/MISC/fix_thermal_conductivity.cpp | 2 +- src/MISC/fix_ttm.cpp | 16 +- src/MISC/fix_viscosity.cpp | 2 +- src/MISC/pair_nm_cut.cpp | 22 +- src/MISC/pair_nm_cut_coul_cut.cpp | 26 +- src/MISC/pair_nm_cut_coul_long.cpp | 34 +- src/MISC/xdr_compat.cpp | 14 +- src/MLIAP/compute_mliap.cpp | 6 +- src/MLIAP/mliap_data.cpp | 8 +- src/MLIAP/mliap_data.h | 2 +- src/MLIAP/mliap_descriptor_snap.cpp | 20 +- src/MLIAP/mliap_model.cpp | 10 +- src/MLIAP/mliap_model_quadratic.h | 2 +- src/MOLECULE/angle_charmm.cpp | 8 +- src/MOLECULE/angle_cosine.cpp | 2 +- src/MOLECULE/angle_cosine_periodic.cpp | 6 +- src/MOLECULE/angle_cosine_squared.cpp | 8 +- src/MOLECULE/angle_harmonic.cpp | 8 +- src/MOLECULE/angle_table.cpp | 16 +- src/MOLECULE/atom_vec_angle.cpp | 2 +- src/MOLECULE/atom_vec_bond.cpp | 2 +- src/MOLECULE/atom_vec_full.cpp | 2 +- src/MOLECULE/atom_vec_molecular.cpp | 2 +- src/MOLECULE/bond_fene.cpp | 10 +- src/MOLECULE/bond_fene_expand.cpp | 10 +- src/MOLECULE/bond_gromos.cpp | 6 +- src/MOLECULE/bond_harmonic.cpp | 6 +- src/MOLECULE/bond_morse.cpp | 8 +- src/MOLECULE/bond_nonlinear.cpp | 8 +- src/MOLECULE/bond_quartic.cpp | 12 +- src/MOLECULE/bond_table.cpp | 16 +- src/MOLECULE/dihedral_charmm.cpp | 12 +- src/MOLECULE/dihedral_charmmfsw.cpp | 16 +- src/MOLECULE/dihedral_harmonic.cpp | 6 +- src/MOLECULE/dihedral_helix.cpp | 6 +- src/MOLECULE/dihedral_multi_harmonic.cpp | 10 +- src/MOLECULE/dihedral_opls.cpp | 8 +- src/MOLECULE/fix_cmap.cpp | 46 +-- src/MOLECULE/improper_cvff.cpp | 6 +- src/MOLECULE/improper_harmonic.cpp | 4 +- src/MOLECULE/improper_umbrella.cpp | 6 +- src/MOLECULE/pair_hbond_dreiding_lj.cpp | 2 +- src/MOLECULE/pair_lj_charmm_coul_charmm.cpp | 24 +- .../pair_lj_charmmfsw_coul_charmmfsh.cpp | 22 +- src/MOLECULE/pair_lj_cut_tip4p_cut.cpp | 40 +-- src/MOLECULE/pair_tip4p_cut.cpp | 22 +- src/MPIIO/dump_atom_mpiio.cpp | 2 +- src/MPIIO/dump_cfg_mpiio.cpp | 2 +- src/MPIIO/dump_custom_mpiio.cpp | 6 +- src/MPIIO/dump_xyz_mpiio.cpp | 4 +- src/MSCG/fix_mscg.cpp | 2 +- src/PERI/compute_damage_atom.cpp | 2 +- src/PERI/compute_dilatation_atom.cpp | 2 +- src/PERI/compute_plasticity_atom.cpp | 2 +- src/PERI/fix_peri_neigh.cpp | 38 +-- src/PERI/pair_peri_eps.cpp | 32 +- src/PERI/pair_peri_lps.cpp | 24 +- src/PERI/pair_peri_pmb.cpp | 20 +- src/PERI/pair_peri_ves.cpp | 34 +- src/POEMS/fix_poems.cpp | 44 +-- src/PYTHON/fix_python_move.cpp | 10 +- src/PYTHON/pair_python.cpp | 10 +- src/PYTHON/python_compat.h | 4 +- src/PYTHON/python_impl.cpp | 32 +- src/QEQ/fix_qeq.cpp | 56 +-- src/QEQ/fix_qeq_fire.cpp | 4 +- src/QEQ/fix_qeq_shielded.cpp | 4 +- src/QEQ/fix_qeq_slater.cpp | 6 +- src/REPLICA/compute_event_displace.cpp | 14 +- src/REPLICA/fix_event.cpp | 4 +- src/REPLICA/fix_hyper.cpp | 2 +- src/REPLICA/fix_hyper_global.cpp | 10 +- src/REPLICA/fix_hyper_local.cpp | 40 +-- src/REPLICA/fix_neb.cpp | 18 +- src/REPLICA/hyper.cpp | 8 +- src/REPLICA/neb.cpp | 8 +- src/REPLICA/prd.cpp | 22 +- src/REPLICA/tad.cpp | 16 +- src/REPLICA/temper.cpp | 2 +- src/REPLICA/verlet_split.cpp | 6 +- src/RIGID/compute_erotate_rigid.cpp | 2 +- src/RIGID/compute_ke_rigid.cpp | 2 +- src/RIGID/compute_rigid_local.cpp | 10 +- src/RIGID/fix_ehex.cpp | 12 +- src/RIGID/fix_rattle.cpp | 2 +- src/RIGID/fix_rigid.cpp | 56 +-- src/RIGID/fix_rigid_nh.cpp | 20 +- src/RIGID/fix_rigid_nh_small.cpp | 20 +- src/RIGID/fix_rigid_small.cpp | 54 +-- src/RIGID/fix_shake.cpp | 42 +-- src/SHOCK/fix_append_atoms.cpp | 10 +- src/SHOCK/fix_msst.cpp | 16 +- src/SHOCK/fix_nphug.cpp | 2 +- src/SHOCK/fix_wall_piston.cpp | 6 +- src/SNAP/compute_sna_atom.cpp | 12 +- src/SNAP/compute_snad_atom.cpp | 12 +- src/SNAP/compute_snap.cpp | 12 +- src/SNAP/compute_snav_atom.cpp | 12 +- src/SNAP/pair_snap.cpp | 34 +- src/SNAP/sna.cpp | 20 +- src/SPIN/compute_spin.cpp | 2 +- src/SPIN/fix_langevin_spin.cpp | 2 +- src/SPIN/fix_neb_spin.cpp | 24 +- src/SPIN/fix_nve_spin.cpp | 6 +- src/SPIN/fix_precession_spin.cpp | 4 +- src/SPIN/fix_setforce_spin.cpp | 6 +- src/SPIN/min_spin_cg.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/SPIN/neb_spin.cpp | 8 +- src/SPIN/pair_spin.cpp | 2 +- src/SPIN/pair_spin.h | 2 +- src/SPIN/pair_spin_dipole_cut.cpp | 10 +- src/SPIN/pair_spin_dipole_long.cpp | 12 +- src/SPIN/pair_spin_dmi.cpp | 26 +- src/SPIN/pair_spin_exchange.cpp | 20 +- src/SPIN/pair_spin_magelec.cpp | 20 +- src/SPIN/pair_spin_neel.cpp | 28 +- src/SRD/fix_srd.cpp | 42 +-- src/SRD/fix_wall_srd.cpp | 2 +- src/STUBS/mpi.h | 4 +- src/USER-ADIOS/dump_atom_adios.cpp | 2 +- src/USER-ADIOS/dump_custom_adios.cpp | 2 +- src/USER-ADIOS/reader_adios.cpp | 4 +- src/USER-ATC/fix_atc.cpp | 2 +- src/USER-AWPMD/pair_awpmd_cut.cpp | 20 +- src/USER-BOCS/compute_pressure_bocs.cpp | 16 +- src/USER-BOCS/fix_bocs.cpp | 30 +- src/USER-CGDNA/bond_oxdna_fene.cpp | 6 +- src/USER-CGDNA/pair_oxdna2_coaxstk.cpp | 82 ++--- src/USER-CGDNA/pair_oxdna2_dh.cpp | 20 +- src/USER-CGDNA/pair_oxdna_coaxstk.cpp | 94 ++--- src/USER-CGDNA/pair_oxdna_excv.cpp | 40 +-- src/USER-CGDNA/pair_oxdna_hbond.cpp | 104 +++--- src/USER-CGDNA/pair_oxdna_stk.cpp | 86 ++--- src/USER-CGDNA/pair_oxdna_xstk.cpp | 100 +++--- src/USER-CGDNA/pair_oxrna2_stk.cpp | 98 +++--- src/USER-CGDNA/pair_oxrna2_xstk.cpp | 88 ++--- src/USER-CGSDK/angle_sdk.cpp | 8 +- src/USER-CGSDK/pair_lj_sdk.cpp | 20 +- src/USER-CGSDK/pair_lj_sdk_coul_long.cpp | 32 +- src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp | 4 +- src/USER-COLVARS/colvarproxy_lammps.cpp | 4 +- src/USER-COLVARS/fix_colvars.cpp | 26 +- src/USER-COLVARS/group_ndx.cpp | 2 +- src/USER-COLVARS/ndx_group.cpp | 34 +- src/USER-DIFFRACTION/compute_saed.cpp | 2 +- src/USER-DIFFRACTION/compute_xrd.cpp | 2 +- src/USER-DIFFRACTION/fix_saed_vtk.cpp | 18 +- src/USER-DPD/compute_dpd_atom.cpp | 2 +- src/USER-DPD/fix_dpd_energy.cpp | 6 +- src/USER-DPD/fix_eos_table.cpp | 20 +- src/USER-DPD/fix_eos_table_rx.cpp | 42 +-- src/USER-DPD/fix_rx.cpp | 98 +++--- src/USER-DPD/fix_shardlow.cpp | 16 +- src/USER-DPD/npair_half_bin_newton_ssa.cpp | 6 +- src/USER-DPD/pair_dpd_fdt.cpp | 18 +- src/USER-DPD/pair_dpd_fdt_energy.cpp | 22 +- src/USER-DPD/pair_exp6_rx.cpp | 50 +-- src/USER-DPD/pair_multi_lucy.cpp | 36 +- src/USER-DPD/pair_multi_lucy_rx.cpp | 44 +-- src/USER-DPD/pair_table_rx.cpp | 14 +- src/USER-DRUDE/compute_temp_drude.cpp | 6 +- src/USER-DRUDE/fix_drude.cpp | 12 +- src/USER-DRUDE/fix_drude_transform.cpp | 4 +- src/USER-DRUDE/fix_langevin_drude.cpp | 12 +- src/USER-DRUDE/pair_lj_cut_thole_long.cpp | 40 +-- src/USER-DRUDE/pair_thole.cpp | 20 +- src/USER-EFF/compute_ke_atom_eff.cpp | 2 +- src/USER-EFF/compute_temp_deform_eff.cpp | 2 +- src/USER-EFF/compute_temp_region_eff.cpp | 2 +- src/USER-EFF/fix_langevin_eff.cpp | 4 +- src/USER-EFF/pair_eff_cut.cpp | 14 +- src/USER-FEP/compute_fep.cpp | 24 +- src/USER-FEP/fix_adapt_fep.cpp | 16 +- src/USER-FEP/pair_coul_cut_soft.cpp | 18 +- src/USER-FEP/pair_coul_long_soft.cpp | 18 +- .../pair_lj_charmm_coul_long_soft.cpp | 36 +- src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp | 32 +- .../pair_lj_class2_coul_long_soft.cpp | 32 +- src/USER-FEP/pair_lj_class2_soft.cpp | 24 +- src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp | 32 +- src/USER-FEP/pair_lj_cut_coul_long_soft.cpp | 34 +- src/USER-FEP/pair_lj_cut_soft.cpp | 26 +- src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp | 32 +- src/USER-FEP/pair_morse_soft.cpp | 22 +- src/USER-FEP/pair_tip4p_long_soft.cpp | 20 +- src/USER-H5MD/dump_h5md.cpp | 40 +-- src/USER-INTEL/angle_charmm_intel.h | 2 +- src/USER-INTEL/angle_harmonic_intel.h | 2 +- src/USER-INTEL/bond_fene_intel.h | 2 +- src/USER-INTEL/bond_harmonic_intel.h | 2 +- src/USER-INTEL/dihedral_charmm_intel.h | 2 +- src/USER-INTEL/dihedral_fourier_intel.h | 2 +- src/USER-INTEL/dihedral_harmonic_intel.h | 2 +- src/USER-INTEL/dihedral_opls_intel.h | 2 +- src/USER-INTEL/fix_intel.cpp | 20 +- src/USER-INTEL/fix_intel.h | 4 +- src/USER-INTEL/improper_cvff_intel.h | 2 +- src/USER-INTEL/improper_harmonic_intel.h | 2 +- src/USER-INTEL/intel_buffers.cpp | 40 +-- src/USER-INTEL/intel_buffers.h | 4 +- src/USER-INTEL/intel_preprocess.h | 2 +- src/USER-INTEL/nbin_intel.cpp | 4 +- src/USER-INTEL/npair_full_bin_ghost_intel.cpp | 4 +- src/USER-INTEL/npair_intel.cpp | 4 +- src/USER-INTEL/pair_airebo_intel.cpp | 18 +- src/USER-INTEL/pair_buck_coul_cut_intel.cpp | 8 +- src/USER-INTEL/pair_buck_coul_cut_intel.h | 2 +- src/USER-INTEL/pair_buck_coul_long_intel.cpp | 16 +- src/USER-INTEL/pair_buck_coul_long_intel.h | 2 +- src/USER-INTEL/pair_buck_intel.cpp | 8 +- src/USER-INTEL/pair_buck_intel.h | 2 +- src/USER-INTEL/pair_dpd_intel.cpp | 2 +- src/USER-INTEL/pair_dpd_intel.h | 2 +- src/USER-INTEL/pair_eam_alloy_intel.cpp | 2 +- src/USER-INTEL/pair_eam_fs_intel.cpp | 2 +- src/USER-INTEL/pair_eam_intel.h | 2 +- src/USER-INTEL/pair_gayberne_intel.cpp | 16 +- src/USER-INTEL/pair_gayberne_intel.h | 2 +- .../pair_lj_charmm_coul_charmm_intel.cpp | 8 +- .../pair_lj_charmm_coul_charmm_intel.h | 2 +- .../pair_lj_charmm_coul_long_intel.cpp | 14 +- .../pair_lj_charmm_coul_long_intel.h | 2 +- .../pair_lj_cut_coul_long_intel.cpp | 18 +- src/USER-INTEL/pair_lj_cut_coul_long_intel.h | 2 +- src/USER-INTEL/pair_lj_cut_intel.cpp | 2 +- src/USER-INTEL/pair_lj_cut_intel.h | 2 +- .../pair_lj_long_coul_long_intel.cpp | 2 +- src/USER-INTEL/pair_sw_intel.cpp | 8 +- src/USER-INTEL/pair_sw_intel.h | 2 +- src/USER-INTEL/pair_tersoff_intel.cpp | 8 +- src/USER-INTEL/pair_tersoff_intel.h | 2 +- src/USER-INTEL/pppm_disp_intel.cpp | 24 +- src/USER-INTEL/pppm_intel.cpp | 6 +- src/USER-INTEL/verlet_lrt_intel.cpp | 10 +- src/USER-LB/fix_lb_fluid.cpp | 46 +-- src/USER-LB/fix_lb_pc.cpp | 6 +- src/USER-LB/fix_lb_rigid_pc_sphere.cpp | 4 +- src/USER-LB/fix_lb_viscous.cpp | 2 +- src/USER-MANIFOLD/fix_manifoldforce.cpp | 2 +- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 2 +- src/USER-MANIFOLD/fix_nve_manifold_rattle.h | 4 +- src/USER-MANIFOLD/fix_nvt_manifold_rattle.h | 4 +- src/USER-MANIFOLD/manifold.h | 2 +- src/USER-MANIFOLD/manifold_factory.cpp | 2 +- src/USER-MANIFOLD/manifold_factory.h | 2 +- src/USER-MANIFOLD/manifold_gaussian_bump.cpp | 2 +- src/USER-MANIFOLD/manifold_thylakoid.cpp | 4 +- src/USER-MANIFOLD/manifold_thylakoid.h | 2 +- src/USER-MEAMC/meam_impl.cpp | 10 +- src/USER-MEAMC/meam_setup_done.cpp | 16 +- src/USER-MEAMC/pair_meamc.cpp | 26 +- src/USER-MESODPD/compute_edpd_temp_atom.cpp | 2 +- src/USER-MESODPD/compute_tdpd_cc_atom.cpp | 2 +- src/USER-MESODPD/pair_edpd.cpp | 30 +- src/USER-MESODPD/pair_mdpd.cpp | 22 +- src/USER-MESODPD/pair_tdpd.cpp | 28 +- src/USER-MESONT/compute_mesont.cpp | 6 +- src/USER-MESONT/pair_mesocnt.cpp | 8 +- src/USER-MESONT/pair_mesont_tpm.cpp | 18 +- src/USER-MGPT/mgpt_readpot.cpp | 6 +- src/USER-MGPT/mgpt_readpot.h | 6 +- src/USER-MGPT/pair_mgpt.cpp | 6 +- src/USER-MISC/angle_cosine_shift.cpp | 10 +- src/USER-MISC/angle_cosine_shift_exp.cpp | 24 +- src/USER-MISC/angle_dipole.cpp | 8 +- src/USER-MISC/angle_fourier.cpp | 16 +- src/USER-MISC/angle_fourier_simple.cpp | 12 +- src/USER-MISC/angle_quartic.cpp | 8 +- src/USER-MISC/bond_harmonic_shift.cpp | 6 +- src/USER-MISC/bond_harmonic_shift_cut.cpp | 6 +- src/USER-MISC/bond_special.cpp | 4 +- src/USER-MISC/compute_ackland_atom.cpp | 10 +- src/USER-MISC/compute_basal_atom.cpp | 10 +- src/USER-MISC/compute_cnp_atom.cpp | 4 +- src/USER-MISC/compute_entropy_atom.cpp | 4 +- src/USER-MISC/compute_gyration_shape.cpp | 2 +- .../compute_gyration_shape_chunk.cpp | 2 +- src/USER-MISC/compute_hma.cpp | 6 +- src/USER-MISC/compute_pressure_cylinder.cpp | 10 +- src/USER-MISC/compute_pressure_grem.cpp | 2 +- src/USER-MISC/compute_stress_mop.cpp | 14 +- src/USER-MISC/compute_stress_mop_profile.cpp | 16 +- src/USER-MISC/compute_temp_rotate.cpp | 2 +- src/USER-MISC/compute_viscosity_cos.cpp | 2 +- src/USER-MISC/dihedral_cosine_shift_exp.cpp | 10 +- src/USER-MISC/dihedral_fourier.cpp | 8 +- src/USER-MISC/dihedral_nharmonic.cpp | 4 +- src/USER-MISC/dihedral_quadratic.cpp | 4 +- src/USER-MISC/dihedral_spherical.cpp | 42 +-- src/USER-MISC/dihedral_table.cpp | 14 +- src/USER-MISC/dihedral_table_cut.cpp | 34 +- src/USER-MISC/fix_addtorque.cpp | 2 +- src/USER-MISC/fix_ave_correlate_long.cpp | 8 +- src/USER-MISC/fix_electron_stopping.cpp | 12 +- src/USER-MISC/fix_ffl.cpp | 6 +- src/USER-MISC/fix_filter_corotate.cpp | 32 +- src/USER-MISC/fix_gle.cpp | 26 +- src/USER-MISC/fix_grem.cpp | 8 +- src/USER-MISC/fix_imd.cpp | 72 ++-- src/USER-MISC/fix_ipi.cpp | 2 +- src/USER-MISC/fix_npt_cauchy.cpp | 18 +- src/USER-MISC/fix_orient_eco.cpp | 4 +- src/USER-MISC/fix_pafi.cpp | 4 +- src/USER-MISC/fix_pimd.cpp | 30 +- src/USER-MISC/fix_propel_self.cpp | 2 +- src/USER-MISC/fix_srp.cpp | 4 +- src/USER-MISC/fix_ti_spring.cpp | 2 +- src/USER-MISC/fix_ttm_mod.cpp | 16 +- src/USER-MISC/fix_wall_reflect_stochastic.cpp | 2 +- src/USER-MISC/improper_cossq.cpp | 4 +- src/USER-MISC/improper_distance.cpp | 4 +- src/USER-MISC/improper_fourier.cpp | 10 +- src/USER-MISC/improper_ring.cpp | 4 +- src/USER-MISC/pair_agni.cpp | 22 +- src/USER-MISC/pair_buck_mdf.cpp | 24 +- src/USER-MISC/pair_cosine_squared.cpp | 12 +- src/USER-MISC/pair_coul_diel.cpp | 14 +- src/USER-MISC/pair_coul_shield.cpp | 12 +- src/USER-MISC/pair_coul_slater_long.cpp | 8 +- src/USER-MISC/pair_drip.cpp | 26 +- src/USER-MISC/pair_e3b.cpp | 12 +- src/USER-MISC/pair_edip.cpp | 32 +- src/USER-MISC/pair_edip_multi.cpp | 20 +- src/USER-MISC/pair_extep.cpp | 38 +-- src/USER-MISC/pair_gauss_cut.cpp | 16 +- src/USER-MISC/pair_ilp_graphene_hbn.cpp | 38 +-- src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 38 +-- src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 22 +- src/USER-MISC/pair_lebedeva_z.cpp | 22 +- src/USER-MISC/pair_lennard_mdf.cpp | 18 +- src/USER-MISC/pair_list.cpp | 34 +- src/USER-MISC/pair_lj_expand_coul_long.cpp | 34 +- src/USER-MISC/pair_lj_mdf.cpp | 14 +- src/USER-MISC/pair_lj_sf_dipole_sf.cpp | 20 +- src/USER-MISC/pair_local_density.cpp | 46 +-- src/USER-MISC/pair_meam_spline.cpp | 44 +-- src/USER-MISC/pair_meam_spline.h | 4 +- src/USER-MISC/pair_meam_sw_spline.cpp | 24 +- src/USER-MISC/pair_meam_sw_spline.h | 4 +- src/USER-MISC/pair_momb.cpp | 24 +- src/USER-MISC/pair_morse_smooth_linear.cpp | 16 +- src/USER-MISC/pair_srp.cpp | 20 +- src/USER-MISC/pair_tersoff_table.cpp | 4 +- src/USER-MISC/temper_grem.cpp | 2 +- src/USER-MISC/temper_npt.cpp | 2 +- src/USER-MOFFF/angle_class2_p6.cpp | 30 +- src/USER-MOFFF/angle_cosine_buck6d.cpp | 8 +- .../improper_inversion_harmonic.cpp | 4 +- src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp | 28 +- .../pair_buck6d_coul_gauss_long.cpp | 32 +- src/USER-MOLFILE/dump_molfile.cpp | 14 +- src/USER-MOLFILE/molfile_interface.cpp | 96 +++--- src/USER-MOLFILE/reader_molfile.cpp | 14 +- src/USER-NETCDF/dump_netcdf.cpp | 8 +- src/USER-NETCDF/dump_netcdf_mpiio.cpp | 10 +- src/USER-OMP/bond_class2_omp.cpp | 2 +- src/USER-OMP/bond_fene_expand_omp.cpp | 2 +- src/USER-OMP/bond_fene_omp.cpp | 2 +- src/USER-OMP/bond_gromos_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_shift_cut_omp.cpp | 2 +- src/USER-OMP/bond_harmonic_shift_omp.cpp | 2 +- src/USER-OMP/bond_morse_omp.cpp | 2 +- src/USER-OMP/bond_nonlinear_omp.cpp | 2 +- src/USER-OMP/bond_quartic_omp.cpp | 2 +- src/USER-OMP/bond_table_omp.cpp | 2 +- src/USER-OMP/ewald_omp.cpp | 2 +- src/USER-OMP/fix_neigh_history_omp.cpp | 8 +- src/USER-OMP/fix_omp.cpp | 18 +- src/USER-OMP/fix_qeq_comb_omp.cpp | 6 +- src/USER-OMP/fix_qeq_reax_omp.cpp | 4 +- src/USER-OMP/msm_cg_omp.cpp | 2 +- src/USER-OMP/pair_adp_omp.cpp | 2 +- src/USER-OMP/pair_agni_omp.cpp | 2 +- src/USER-OMP/pair_airebo_omp.cpp | 2 +- src/USER-OMP/pair_beck_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_born_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_born_omp.cpp | 2 +- src/USER-OMP/pair_brownian_omp.cpp | 10 +- src/USER-OMP/pair_brownian_poly_omp.cpp | 10 +- src/USER-OMP/pair_buck_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_buck_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_buck_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_buck_long_coul_long_omp.cpp | 10 +- src/USER-OMP/pair_buck_omp.cpp | 2 +- src/USER-OMP/pair_colloid_omp.cpp | 2 +- src/USER-OMP/pair_comb_omp.cpp | 2 +- src/USER-OMP/pair_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_coul_cut_soft_omp.cpp | 2 +- src/USER-OMP/pair_coul_debye_omp.cpp | 2 +- src/USER-OMP/pair_coul_diel_omp.cpp | 2 +- src/USER-OMP/pair_coul_dsf_omp.cpp | 2 +- src/USER-OMP/pair_coul_long_omp.cpp | 4 +- src/USER-OMP/pair_coul_long_soft_omp.cpp | 2 +- src/USER-OMP/pair_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_dpd_omp.cpp | 10 +- src/USER-OMP/pair_dpd_tstat_omp.cpp | 10 +- src/USER-OMP/pair_eam_alloy_omp.cpp | 2 +- src/USER-OMP/pair_eam_fs_omp.cpp | 2 +- src/USER-OMP/pair_eam_omp.cpp | 2 +- src/USER-OMP/pair_edip_omp.cpp | 2 +- src/USER-OMP/pair_eim_omp.cpp | 2 +- src/USER-OMP/pair_gauss_cut_omp.cpp | 2 +- src/USER-OMP/pair_gauss_omp.cpp | 2 +- src/USER-OMP/pair_gayberne_omp.cpp | 2 +- src/USER-OMP/pair_gran_hertz_history_omp.cpp | 2 +- src/USER-OMP/pair_gran_hooke_history_omp.cpp | 2 +- src/USER-OMP/pair_gran_hooke_omp.cpp | 2 +- src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp | 4 +- .../pair_hbond_dreiding_morse_omp.cpp | 4 +- src/USER-OMP/pair_lj96_cut_omp.cpp | 4 +- ...air_lj_charmm_coul_charmm_implicit_omp.cpp | 2 +- .../pair_lj_charmm_coul_charmm_omp.cpp | 2 +- src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp | 4 +- .../pair_lj_charmm_coul_long_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_lj_class2_coul_long_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_omp.cpp | 2 +- src/USER-OMP/pair_lj_cubic_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp | 2 +- .../pair_lj_cut_coul_cut_soft_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_coul_long_omp.cpp | 4 +- .../pair_lj_cut_coul_long_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp | 2 +- src/USER-OMP/pair_lj_cut_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_soft_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_thole_long_omp.cpp | 4 +- src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp | 6 +- src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp | 6 +- .../pair_lj_cut_tip4p_long_soft_omp.cpp | 6 +- src/USER-OMP/pair_lj_expand_omp.cpp | 2 +- .../pair_lj_gromacs_coul_gromacs_omp.cpp | 2 +- src/USER-OMP/pair_lj_gromacs_omp.cpp | 2 +- src/USER-OMP/pair_lj_long_coul_long_omp.cpp | 10 +- src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp | 14 +- src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp | 2 +- src/USER-OMP/pair_lj_sdk_omp.cpp | 2 +- src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp | 2 +- src/USER-OMP/pair_lj_smooth_linear_omp.cpp | 2 +- src/USER-OMP/pair_lj_smooth_omp.cpp | 2 +- src/USER-OMP/pair_lubricate_omp.cpp | 2 +- src/USER-OMP/pair_lubricate_poly_omp.cpp | 2 +- src/USER-OMP/pair_meam_spline_omp.cpp | 2 +- src/USER-OMP/pair_morse_omp.cpp | 2 +- src/USER-OMP/pair_morse_smooth_linear_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_coul_long_omp.cpp | 2 +- src/USER-OMP/pair_nm_cut_omp.cpp | 2 +- src/USER-OMP/pair_peri_lps_omp.cpp | 2 +- src/USER-OMP/pair_peri_pmb_omp.cpp | 2 +- src/USER-OMP/pair_reaxc_omp.cpp | 4 +- src/USER-OMP/pair_resquared_omp.cpp | 2 +- src/USER-OMP/pair_soft_omp.cpp | 2 +- src/USER-OMP/pair_sw_omp.cpp | 2 +- src/USER-OMP/pair_table_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_mod_c_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_mod_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_omp.cpp | 2 +- src/USER-OMP/pair_tersoff_table_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_cut_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_long_omp.cpp | 6 +- src/USER-OMP/pair_tip4p_long_soft_omp.cpp | 6 +- src/USER-OMP/pair_ufm_omp.cpp | 2 +- src/USER-OMP/pair_vashishta_omp.cpp | 2 +- src/USER-OMP/pair_vashishta_table_omp.cpp | 2 +- src/USER-OMP/pair_yukawa_colloid_omp.cpp | 2 +- src/USER-OMP/pair_yukawa_omp.cpp | 2 +- src/USER-OMP/pair_zbl_omp.cpp | 2 +- src/USER-OMP/reaxc_bonds_omp.cpp | 2 +- src/USER-OMP/reaxc_forces_omp.cpp | 2 +- src/USER-OMP/thr_data.cpp | 18 +- src/USER-OMP/thr_data.h | 4 +- src/USER-OMP/thr_omp.cpp | 6 +- src/USER-PHONON/dynamical_matrix.cpp | 6 +- src/USER-PHONON/fix_phonon.cpp | 26 +- src/USER-PHONON/third_order.cpp | 6 +- src/USER-PLUMED/fix_plumed.cpp | 8 +- src/USER-PTM/compute_ptm_atom.cpp | 8 +- src/USER-PTM/ptm_index.cpp | 22 +- src/USER-PTM/ptm_initialize_data.h | 90 ++--- src/USER-QMMM/fix_qmmm.cpp | 18 +- src/USER-QTB/fix_qbmsst.cpp | 28 +- src/USER-QTB/fix_qtb.cpp | 22 +- src/USER-QUIP/pair_quip.cpp | 8 +- src/USER-REACTION/fix_bond_react.cpp | 64 ++-- src/USER-REAXC/compute_spec_atom.cpp | 4 +- src/USER-REAXC/fix_qeq_reax.cpp | 46 +-- src/USER-REAXC/fix_reaxc.cpp | 4 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 12 +- src/USER-REAXC/fix_reaxc_species.cpp | 50 +-- src/USER-REAXC/pair_reaxc.cpp | 16 +- src/USER-REAXC/reaxc_allocate.cpp | 8 +- src/USER-REAXC/reaxc_control.cpp | 2 +- src/USER-REAXC/reaxc_io_tools.cpp | 8 +- src/USER-REAXC/reaxc_list.cpp | 18 +- src/USER-REAXC/reaxc_tool_box.cpp | 18 +- src/USER-REAXC/reaxc_traj.cpp | 4 +- src/USER-SCAFACOS/scafacos.cpp | 8 +- src/USER-SDPD/fix_meso_move.cpp | 26 +- .../pair_sdpd_taitwater_isothermal.cpp | 2 +- src/USER-SMD/compute_smd_contact_radius.cpp | 2 +- src/USER-SMD/compute_smd_damage.cpp | 2 +- src/USER-SMD/compute_smd_hourglass_error.cpp | 4 +- src/USER-SMD/compute_smd_internal_energy.cpp | 2 +- src/USER-SMD/compute_smd_plastic_strain.cpp | 2 +- .../compute_smd_plastic_strain_rate.cpp | 2 +- src/USER-SMD/compute_smd_rho.cpp | 2 +- src/USER-SMD/compute_smd_tlsph_defgrad.cpp | 2 +- src/USER-SMD/compute_smd_tlsph_dt.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_num_neighs.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_shape.cpp | 6 +- src/USER-SMD/compute_smd_tlsph_strain.cpp | 4 +- .../compute_smd_tlsph_strain_rate.cpp | 4 +- src/USER-SMD/compute_smd_tlsph_stress.cpp | 4 +- .../compute_smd_triangle_vertices.cpp | 2 +- src/USER-SMD/compute_smd_ulsph_effm.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_num_neighs.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_strain.cpp | 2 +- .../compute_smd_ulsph_strain_rate.cpp | 4 +- src/USER-SMD/compute_smd_ulsph_stress.cpp | 4 +- src/USER-SMD/compute_smd_vol.cpp | 2 +- src/USER-SMD/fix_smd_adjust_dt.cpp | 14 +- src/USER-SMD/fix_smd_integrate_tlsph.cpp | 2 +- src/USER-SMD/fix_smd_integrate_ulsph.cpp | 6 +- src/USER-SMD/fix_smd_setvel.cpp | 6 +- .../fix_smd_tlsph_reference_configuration.cpp | 18 +- src/USER-SMD/fix_smd_wall_surface.cpp | 36 +- src/USER-SMD/pair_smd_hertz.cpp | 8 +- src/USER-SMD/pair_smd_tlsph.cpp | 30 +- .../pair_smd_triangulated_surface.cpp | 8 +- src/USER-SMD/pair_smd_ulsph.cpp | 30 +- src/USER-SMTBQ/pair_smtbq.cpp | 84 ++--- src/USER-SPH/compute_sph_e_atom.cpp | 2 +- src/USER-SPH/compute_sph_rho_atom.cpp | 2 +- src/USER-SPH/compute_sph_t_atom.cpp | 2 +- src/USER-TALLY/compute_force_tally.cpp | 4 +- src/USER-TALLY/compute_heat_flux_tally.cpp | 6 +- src/USER-TALLY/compute_pe_mol_tally.cpp | 2 +- src/USER-TALLY/compute_pe_tally.cpp | 4 +- src/USER-TALLY/compute_stress_tally.cpp | 4 +- src/USER-UEF/fix_nh_uef.cpp | 2 +- src/USER-VTK/dump_vtk.cpp | 44 +-- src/USER-YAFF/angle_cross.cpp | 12 +- src/USER-YAFF/angle_mm3.cpp | 4 +- src/USER-YAFF/bond_mm3.cpp | 4 +- src/USER-YAFF/improper_distharm.cpp | 4 +- src/USER-YAFF/improper_sqdistharm.cpp | 4 +- .../pair_lj_switch3_coulgauss_long.cpp | 34 +- .../pair_mm3_switch3_coulgauss_long.cpp | 34 +- src/VORONOI/compute_voronoi_atom.cpp | 28 +- src/angle.cpp | 8 +- src/angle_hybrid.cpp | 8 +- src/angle_zero.cpp | 2 +- src/atom.cpp | 238 ++++++------- src/atom.h | 2 +- src/atom_map.cpp | 8 +- src/atom_vec.cpp | 4 +- src/atom_vec_body.cpp | 8 +- src/atom_vec_ellipsoid.cpp | 4 +- src/atom_vec_hybrid.cpp | 10 +- src/atom_vec_line.cpp | 4 +- src/atom_vec_tri.cpp | 4 +- src/balance.cpp | 26 +- src/body.cpp | 4 +- src/bond.cpp | 10 +- src/bond.h | 2 +- src/bond_hybrid.cpp | 8 +- src/bond_zero.cpp | 4 +- src/citeme.cpp | 2 +- src/comm.cpp | 34 +- src/comm.h | 4 +- src/comm_brick.cpp | 28 +- src/comm_tiled.cpp | 48 +-- src/compute.cpp | 8 +- src/compute_adf.cpp | 24 +- src/compute_aggregate_atom.cpp | 6 +- src/compute_angle.cpp | 2 +- src/compute_angle_local.cpp | 10 +- src/compute_angmom_chunk.cpp | 2 +- src/compute_bond.cpp | 2 +- src/compute_bond_local.cpp | 10 +- src/compute_centro_atom.cpp | 4 +- src/compute_centroid_stress_atom.cpp | 6 +- src/compute_chunk_atom.cpp | 44 +-- src/compute_chunk_atom.h | 2 +- src/compute_chunk_spread_atom.cpp | 8 +- src/compute_cluster_atom.cpp | 4 +- src/compute_cna_atom.cpp | 4 +- src/compute_com_chunk.cpp | 2 +- src/compute_contact_atom.cpp | 4 +- src/compute_coord_atom.cpp | 6 +- src/compute_dihedral.cpp | 2 +- src/compute_dihedral_local.cpp | 10 +- src/compute_dipole_chunk.cpp | 6 +- src/compute_displace_atom.cpp | 6 +- src/compute_erotate_sphere_atom.cpp | 2 +- src/compute_fragment_atom.cpp | 8 +- src/compute_global_atom.cpp | 10 +- src/compute_group_group.cpp | 12 +- src/compute_gyration_chunk.cpp | 4 +- src/compute_heat_flux.cpp | 2 +- src/compute_hexorder_atom.cpp | 4 +- src/compute_improper.cpp | 2 +- src/compute_improper_local.cpp | 10 +- src/compute_inertia_chunk.cpp | 4 +- src/compute_ke_atom.cpp | 2 +- src/compute_msd.cpp | 2 +- src/compute_msd_chunk.cpp | 2 +- src/compute_omega_chunk.cpp | 4 +- src/compute_orientorder_atom.cpp | 6 +- src/compute_pair.cpp | 4 +- src/compute_pair_local.cpp | 8 +- src/compute_pe_atom.cpp | 2 +- src/compute_pressure.cpp | 12 +- src/compute_property_atom.cpp | 4 +- src/compute_property_chunk.cpp | 2 +- src/compute_property_local.cpp | 8 +- src/compute_rdf.cpp | 6 +- src/compute_reduce.cpp | 20 +- src/compute_reduce_chunk.cpp | 14 +- src/compute_slice.cpp | 2 +- src/compute_stress_atom.cpp | 6 +- src/compute_temp_chunk.cpp | 6 +- src/compute_temp_deform.cpp | 2 +- src/compute_temp_partial.cpp | 2 +- src/compute_temp_profile.cpp | 2 +- src/compute_temp_ramp.cpp | 2 +- src/compute_temp_region.cpp | 4 +- src/compute_temp_sphere.cpp | 2 +- src/compute_torque_chunk.cpp | 2 +- src/compute_vacf.cpp | 2 +- src/compute_vcm_chunk.cpp | 2 +- src/create_atoms.cpp | 6 +- src/create_atoms.h | 2 +- src/create_bonds.cpp | 4 +- src/delete_atoms.cpp | 6 +- src/delete_bonds.cpp | 2 +- src/dihedral.cpp | 8 +- src/dihedral_hybrid.cpp | 8 +- src/displace_atoms.cpp | 6 +- src/domain.cpp | 8 +- src/dump.cpp | 74 ++-- src/dump_atom.cpp | 2 +- src/dump_cfg.cpp | 4 +- src/dump_custom.cpp | 82 ++--- src/dump_dcd.cpp | 8 +- src/dump_image.cpp | 50 +-- src/dump_local.cpp | 22 +- src/dump_movie.cpp | 6 +- src/dump_xyz.cpp | 12 +- src/error.cpp | 12 +- src/fix.cpp | 4 +- src/fix.h | 2 +- src/fix_adapt.cpp | 28 +- src/fix_addforce.cpp | 6 +- src/fix_ave_atom.cpp | 12 +- src/fix_ave_chunk.cpp | 74 ++-- src/fix_ave_correlate.cpp | 14 +- src/fix_ave_histo.cpp | 42 +-- src/fix_ave_histo_weight.cpp | 8 +- src/fix_ave_time.cpp | 36 +- src/fix_aveforce.cpp | 10 +- src/fix_balance.cpp | 2 +- src/fix_box_relax.cpp | 4 +- src/fix_controller.cpp | 2 +- src/fix_deform.cpp | 6 +- src/fix_enforce2d.cpp | 2 +- src/fix_external.cpp | 8 +- src/fix_gravity.cpp | 8 +- src/fix_group.cpp | 10 +- src/fix_halt.cpp | 4 +- src/fix_heat.cpp | 6 +- src/fix_indent.cpp | 4 +- src/fix_langevin.cpp | 20 +- src/fix_minimize.cpp | 2 +- src/fix_move.cpp | 36 +- src/fix_neigh_history.cpp | 42 +-- src/fix_nh.cpp | 24 +- src/fix_numdiff.cpp | 4 +- src/fix_press_berendsen.cpp | 6 +- src/fix_print.cpp | 8 +- src/fix_property_atom.cpp | 16 +- src/fix_read_restart.cpp | 2 +- src/fix_respa.cpp | 6 +- src/fix_restrain.cpp | 6 +- src/fix_setforce.cpp | 10 +- src/fix_spring.cpp | 2 +- src/fix_spring_chunk.cpp | 6 +- src/fix_spring_rg.cpp | 2 +- src/fix_spring_self.cpp | 4 +- src/fix_store.cpp | 16 +- src/fix_store_force.cpp | 2 +- src/fix_store_state.cpp | 14 +- src/fix_temp_berendsen.cpp | 6 +- src/fix_temp_csld.cpp | 10 +- src/fix_temp_csvr.cpp | 6 +- src/fix_temp_rescale.cpp | 6 +- src/fix_tmd.cpp | 12 +- src/fix_vector.cpp | 6 +- src/fix_viscous.cpp | 2 +- src/fix_wall.cpp | 2 +- src/fix_wall_region.cpp | 2 +- src/force.cpp | 76 ++--- src/group.cpp | 30 +- src/image.cpp | 28 +- src/improper.cpp | 8 +- src/improper_hybrid.cpp | 8 +- src/info.cpp | 14 +- src/input.cpp | 84 ++--- src/integrate.cpp | 8 +- src/irregular.cpp | 10 +- src/irregular.h | 2 +- src/kspace.cpp | 8 +- src/lammps.cpp | 138 ++++---- src/lattice.cpp | 4 +- src/library.cpp | 244 ++++++------- src/lmppython.cpp | 2 +- src/memory.cpp | 12 +- src/memory.h | 74 ++-- src/min.cpp | 28 +- src/min_hftn.cpp | 24 +- src/min_linesearch.cpp | 8 +- src/modify.cpp | 106 +++--- src/molecule.cpp | 88 ++--- src/my_page.cpp | 4 +- src/my_page.h | 2 +- src/nbin.cpp | 6 +- src/neigh_list.cpp | 40 +-- src/neigh_request.cpp | 10 +- src/neighbor.cpp | 92 ++--- src/npair.cpp | 4 +- src/nstencil.cpp | 14 +- src/ntopo.cpp | 2 +- src/output.cpp | 40 +-- src/output.h | 2 +- src/pair.cpp | 36 +- src/pair.h | 2 +- src/pair_beck.cpp | 18 +- src/pair_born.cpp | 24 +- src/pair_born_coul_dsf.cpp | 24 +- src/pair_born_coul_wolf.cpp | 24 +- src/pair_buck.cpp | 20 +- src/pair_buck_coul_cut.cpp | 22 +- src/pair_coul_cut.cpp | 12 +- src/pair_coul_debye.cpp | 8 +- src/pair_coul_dsf.cpp | 12 +- src/pair_coul_streitz.cpp | 14 +- src/pair_coul_wolf.cpp | 10 +- src/pair_dpd.cpp | 18 +- src/pair_dpd_tstat.cpp | 16 +- src/pair_gauss.cpp | 16 +- src/pair_hybrid.cpp | 42 +-- src/pair_hybrid_overlay.cpp | 2 +- src/pair_lj96_cut.cpp | 20 +- src/pair_lj_cubic.cpp | 12 +- src/pair_lj_cut.cpp | 20 +- src/pair_lj_cut_coul_cut.cpp | 22 +- src/pair_lj_cut_coul_debye.cpp | 10 +- src/pair_lj_cut_coul_dsf.cpp | 22 +- src/pair_lj_cut_coul_wolf.cpp | 20 +- src/pair_lj_expand.cpp | 20 +- src/pair_lj_gromacs.cpp | 18 +- src/pair_lj_gromacs_coul_gromacs.cpp | 18 +- src/pair_lj_smooth.cpp | 18 +- src/pair_lj_smooth_linear.cpp | 12 +- src/pair_mie_cut.cpp | 26 +- src/pair_morse.cpp | 18 +- src/pair_soft.cpp | 12 +- src/pair_table.cpp | 32 +- src/pair_ufm.cpp | 18 +- src/pair_yukawa.cpp | 14 +- src/pair_zbl.cpp | 14 +- src/pair_zero.cpp | 8 +- src/procmap.cpp | 18 +- src/random_mars.cpp | 2 +- src/rcb.cpp | 28 +- src/read_data.cpp | 120 +++---- src/read_dump.cpp | 28 +- src/read_restart.cpp | 52 +-- src/reader.cpp | 10 +- src/reader_native.cpp | 12 +- src/reader_xyz.cpp | 12 +- src/region.cpp | 8 +- src/region_cylinder.cpp | 2 +- src/region_intersect.cpp | 2 +- src/region_sphere.cpp | 2 +- src/region_union.cpp | 2 +- src/replicate.cpp | 2 +- src/rerun.cpp | 4 +- src/reset_mol_ids.cpp | 4 +- src/respa.cpp | 4 +- src/run.cpp | 4 +- src/set.cpp | 6 +- src/special.cpp | 2 +- src/thermo.cpp | 32 +- src/universe.cpp | 14 +- src/update.cpp | 10 +- src/utils.cpp | 20 +- src/utils.h | 10 +- src/variable.cpp | 274 +++++++-------- src/variable.h | 4 +- src/velocity.cpp | 32 +- src/write_coeff.cpp | 14 +- src/write_data.cpp | 12 +- src/write_dump.cpp | 2 +- src/write_restart.cpp | 14 +- 1217 files changed, 8605 insertions(+), 8605 deletions(-) diff --git a/lib/atc/ATC_Coupling.cpp b/lib/atc/ATC_Coupling.cpp index db72b0cb0c..552bb9bb37 100644 --- a/lib/atc/ATC_Coupling.cpp +++ b/lib/atc/ATC_Coupling.cpp @@ -30,26 +30,26 @@ namespace ATC { useFeMdMassMatrix_(false), trackCharge_(false), temperatureDef_(NONE), - prescribedDataMgr_(NULL), - physicsModel_(NULL), + prescribedDataMgr_(nullptr), + physicsModel_(nullptr), extrinsicModelManager_(this), - atomicRegulator_(NULL), + atomicRegulator_(nullptr), atomQuadForInternal_(true), - elementMask_(NULL), - elementMaskMass_(NULL), - elementMaskMassMd_(NULL), - nodalAtomicMass_(NULL), - nodalAtomicCount_(NULL), - nodalAtomicHeatCapacity_(NULL), - internalToMask_(NULL), - internalElement_(NULL), - ghostElement_(NULL), - nodalGeometryType_(NULL), + elementMask_(nullptr), + elementMaskMass_(nullptr), + elementMaskMassMd_(nullptr), + nodalAtomicMass_(nullptr), + nodalAtomicCount_(nullptr), + nodalAtomicHeatCapacity_(nullptr), + internalToMask_(nullptr), + internalElement_(nullptr), + ghostElement_(nullptr), + nodalGeometryType_(nullptr), bndyIntType_(NO_QUADRATURE), - bndyFaceSet_(NULL), - atomicWeightsMask_(NULL), - shpFcnMask_(NULL), - shpFcnDerivsMask_(NULL), + bndyFaceSet_(nullptr), + atomicWeightsMask_(nullptr), + shpFcnMask_(nullptr), + shpFcnDerivsMask_(nullptr), sourceIntegration_(FULL_DOMAIN) { // size the field mask @@ -68,7 +68,7 @@ namespace ATC { ATC_Coupling::~ATC_Coupling() { interscaleManager_.clear(); - if (feEngine_) { delete feEngine_; feEngine_ = NULL; } + if (feEngine_) { delete feEngine_; feEngine_ = nullptr; } if (physicsModel_) delete physicsModel_; if (atomicRegulator_) delete atomicRegulator_; if (prescribedDataMgr_) delete prescribedDataMgr_; @@ -127,7 +127,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -164,7 +164,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // fix current value if (narg == argIdx) { set nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName); @@ -258,7 +258,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string esetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { string a(arg[argIdx]); @@ -367,7 +367,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -529,7 +529,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - UXT_Function * f = NULL; + UXT_Function * f = nullptr; // parse linear if (narg == argIdx+2) { f = UXT_Function_Mgr::instance()->linear_function(atof(arg[argIdx]),atof(arg[argIdx+1])); @@ -760,7 +760,7 @@ namespace ATC { WeakEquation::PDE_Type ATC_Coupling::pde_type(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return WeakEquation::PROJECTION_PDE; + if (weakEq == nullptr) return WeakEquation::PROJECTION_PDE; return weakEq->type(); } //-------------------------------------------------- @@ -768,7 +768,7 @@ namespace ATC { bool ATC_Coupling::is_dynamic(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return false; + if (weakEq == nullptr) return false; return (physicsModel_->weak_equation(fieldName)->type() == WeakEquation::DYNAMIC_PDE); } diff --git a/lib/atc/ATC_Coupling.h b/lib/atc/ATC_Coupling.h index 9f406febbe..e119b68738 100644 --- a/lib/atc/ATC_Coupling.h +++ b/lib/atc/ATC_Coupling.h @@ -114,10 +114,10 @@ namespace ATC { FIELDS &rhs, const Array< std::set > atomMaterialGroups, const VectorDependencyManager * shpFcnDerivs, - const SPAR_MAN * shpFcn = NULL, - const DIAG_MAN * atomicWeights = NULL, - const MatrixDependencyManager * elementMask = NULL, - const SetDependencyManager * nodeSet = NULL); + const SPAR_MAN * shpFcn = nullptr, + const DIAG_MAN * atomicWeights = nullptr, + const MatrixDependencyManager * elementMask = nullptr, + const SetDependencyManager * nodeSet = nullptr); /** access to full right hand side / forcing vector */ FIELDS &rhs() {return rhs_;}; Array2D rhs_mask() const { @@ -152,14 +152,14 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, // = FULL_DOMAIN - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** wrapper for FE_Engine's compute_tangent_matrix */ void compute_rhs_tangent(const std::pair row_col, const RHS_MASK & rhsMask, const FIELDS & fields, SPAR_MAT & stiffness, const IntegrationDomainType integrationType, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); void tangent_matrix(const std::pair row_col, const RHS_MASK & rhsMask, const PhysicsModel * physicsModel, @@ -197,7 +197,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } else { @@ -206,7 +206,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } } @@ -233,7 +233,7 @@ namespace ATC { /** access to time integrator */ const TimeIntegrator * time_integrator(const FieldName & field) const { _ctiIt_ = timeIntegrators_.find(field); - if (_ctiIt_ == timeIntegrators_.end()) return NULL; + if (_ctiIt_ == timeIntegrators_.end()) return nullptr; return _ctiIt_->second; }; @@ -322,7 +322,7 @@ namespace ATC { void compute_flux(const Array2D & rhs_mask, const FIELDS &fields, GRAD_FIELD_MATS &flux, - const PhysicsModel * physicsModel=NULL, + const PhysicsModel * physicsModel=nullptr, const bool normalize = false); /** evaluate rhs on the atomic domain which is near the FE region */ void masked_atom_domain_rhs_integral(const Array2D & rhs_mask, @@ -334,7 +334,7 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** access to boundary fluxes */ DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();}; DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];}; @@ -352,7 +352,7 @@ namespace ATC { // mass matrix filtering void delete_mass_mat_time_filter(FieldName thisField); /** compute mass matrix for requested field */ - void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = NULL); + void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = nullptr); /** updates filtering of MD contributions */ void update_mass_matrix(FieldName thisField); /** compute the mass matrix components coming from MD integration */ diff --git a/lib/atc/ATC_CouplingEnergy.cpp b/lib/atc/ATC_CouplingEnergy.cpp index c3b07c242d..8fae1f0703 100644 --- a/lib/atc/ATC_CouplingEnergy.cpp +++ b/lib/atc/ATC_CouplingEnergy.cpp @@ -30,8 +30,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL) + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr) { // Allocate PhysicsModel create_physics_model(THERMAL, matParamFile); @@ -103,7 +103,7 @@ namespace ATC { // always need kinetic energy AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_CouplingMomentumEnergy.cpp b/lib/atc/ATC_CouplingMomentumEnergy.cpp index 1fc2931977..32df5fd7b9 100644 --- a/lib/atc/ATC_CouplingMomentumEnergy.cpp +++ b/lib/atc/ATC_CouplingMomentumEnergy.cpp @@ -32,8 +32,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL), + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr), refPE_(0) { // Allocate PhysicsModel @@ -190,7 +190,7 @@ namespace ATC { FieldManager fieldManager(this); PerAtomQuantity * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_Method.cpp b/lib/atc/ATC_Method.cpp index f2173e9575..113d175e26 100644 --- a/lib/atc/ATC_Method.cpp +++ b/lib/atc/ATC_Method.cpp @@ -35,37 +35,37 @@ using std::pair; namespace ATC { ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) : - nodalAtomicVolume_(NULL), + nodalAtomicVolume_(nullptr), needReset_(true), lammpsInterface_(LammpsInterface::instance()), interscaleManager_(this), timeFilterManager_(this), integrateInternalAtoms_(false), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), ghostManager_(this), - feEngine_(NULL), + feEngine_(nullptr), initialized_(false), meshDataInitialized_(false), localStep_(0), sizeComm_(8), // 3 positions + 1 material id * 2 for output - atomCoarseGrainingPositions_(NULL), - atomGhostCoarseGrainingPositions_(NULL), - atomProcGhostCoarseGrainingPositions_(NULL), - atomReferencePositions_(NULL), + atomCoarseGrainingPositions_(nullptr), + atomGhostCoarseGrainingPositions_(nullptr), + atomProcGhostCoarseGrainingPositions_(nullptr), + atomReferencePositions_(nullptr), nNodes_(0), nsd_(lammpsInterface_->dimension()), - xref_(NULL), + xref_(nullptr), readXref_(false), needXrefProcessorGhosts_(false), trackDisplacement_(false), needsAtomToElementMap_(true), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalElementSet_(""), - atomMasses_(NULL), - atomPositions_(NULL), - atomVelocities_(NULL), - atomForces_(NULL), + atomMasses_(nullptr), + atomPositions_(nullptr), + atomVelocities_(nullptr), + atomForces_(nullptr), parallelConsistency_(true), outputNow_(false), outputTime_(true), @@ -79,13 +79,13 @@ namespace ATC { sizeVector_(0), scalarVectorFreq_(0), sizePerAtomCols_(4), - perAtomOutput_(NULL), + perAtomOutput_(nullptr), perAtomArray_(perAtomArray), extScalar_(0), extVector_(0), - extList_(NULL), + extList_(nullptr), thermoEnergyFlag_(0), - atomVolume_(NULL), + atomVolume_(nullptr), atomicWeightsWriteFlag_(false), atomicWeightsWriteFrequency_(0), atomWeightType_(LATTICE), @@ -103,12 +103,12 @@ namespace ATC { mdMassNormalization_(false), kernelBased_(false), kernelOnTheFly_(false), - kernelFunction_(NULL), + kernelFunction_(nullptr), bondOnTheFly_(false), - accumulant_(NULL), - accumulantMol_(NULL), - accumulantMolGrad_(NULL), - accumulantWeights_(NULL), + accumulant_(nullptr), + accumulantMol_(nullptr), + accumulantMolGrad_(nullptr), + accumulantWeights_(nullptr), accumulantInverseVolumes_(&invNodeVolumes_), accumulantBandwidth_(0), useRestart_(false), @@ -117,7 +117,7 @@ namespace ATC { setRefPEvalue_(false), refPEvalue_(0.), readRefPE_(false), - nodalRefPotentialEnergy_(NULL), + nodalRefPotentialEnergy_(nullptr), simTime_(0.0), stepCounter_(0) { @@ -1122,7 +1122,7 @@ pecified FieldName & thisField, int & thisIndex) { string thisName = args[argIdx++]; - if (args[argIdx] == NULL) { + if (args[argIdx] == nullptr) { throw ATC_Error("Need to give field '"+thisName+"' more args"); } thisField = string_to_field(thisName); @@ -1282,7 +1282,7 @@ pecified if (this->reset_methods()) { // clear memory manager interscaleManager_.clear_temporary_data(); - atomVolume_ = NULL; + atomVolume_ = nullptr; // reference positions and energy if (!initialized_) { @@ -1517,7 +1517,7 @@ pecified } else { // set variables to compute atomic weights - DENS_MAN * nodalVolume(NULL); + DENS_MAN * nodalVolume(nullptr); switch (atomWeightType_) { case USER: atomVolume_ = new AtomVolumeUser(this,Valpha_); diff --git a/lib/atc/ATC_Method.h b/lib/atc/ATC_Method.h index e356243e03..0779990a99 100644 --- a/lib/atc/ATC_Method.h +++ b/lib/atc/ATC_Method.h @@ -423,7 +423,7 @@ namespace ATC { bool use_md_mass_normalization() const { return mdMassNormalization_;} bool kernel_based() { return kernelBased_; } bool kernel_on_the_fly() const { return kernelOnTheFly_;} - bool has_kernel_function() { return kernelFunction_ != NULL; } + bool has_kernel_function() { return kernelFunction_ != nullptr; } KernelFunction * kernel_function() { return kernelFunction_; } std::vector & type_list() { return typeList_; } std::vector & group_list() { return groupList_; } diff --git a/lib/atc/ATC_Transfer.cpp b/lib/atc/ATC_Transfer.cpp index 833e1d1f27..a9e87e3ff9 100644 --- a/lib/atc/ATC_Transfer.cpp +++ b/lib/atc/ATC_Transfer.cpp @@ -68,19 +68,19 @@ namespace ATC { LAMMPS_NS::Fix * thisFix, string matParamFile) : ATC_Method(groupName,perAtomArray,thisFix), - xPointer_(NULL), + xPointer_(nullptr), outputStepZero_(true), neighborReset_(false), - pairMap_(NULL), - bondMatrix_(NULL), - pairVirial_(NULL), - pairHeatFlux_(NULL), + pairMap_(nullptr), + bondMatrix_(nullptr), + pairVirial_(nullptr), + pairHeatFlux_(nullptr), nComputes_(0), hasPairs_(true), hasBonds_(false), resetKernelFunction_(false), dxaExactMode_(true), - cauchyBornStress_(NULL) + cauchyBornStress_(nullptr) { nTypes_ = lammpsInterface_->ntypes(); @@ -114,7 +114,7 @@ namespace ATC { rateFlags_ = false; outputFields_.resize(NUM_TOTAL_FIELDS); - for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = NULL; } + for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; } // Hardy requires ref positions for processor ghosts for bond list @@ -491,7 +491,7 @@ namespace ATC { ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag); interscaleManager_.add_per_atom_quantity(c,tag); int projection = iter->second; - DIAG_MAN * w = NULL; + DIAG_MAN * w = nullptr; if (projection == VOLUME_NORMALIZATION ) { w = accumulantInverseVolumes_; } else if (projection == NUMBER_NORMALIZATION ) @@ -976,7 +976,7 @@ namespace ATC { DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity(); DENS_MAT E(H.nRows(),1); ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); //DENS_MAT & T = hardyData_["temperature"]; //cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"]; cauchy_born_energy(H, E, temp); @@ -988,14 +988,14 @@ namespace ATC { // compute: cauchy born stress if (fieldFlags_(CAUCHY_BORN_STRESS)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_stress(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_stress"].set_quantity(), temp); } // compute: cauchy born energy if (fieldFlags_(CAUCHY_BORN_ENERGY)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_energy(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_energy"].set_quantity(), temp); } diff --git a/lib/atc/Array.h b/lib/atc/Array.h index 21e66a9551..c29729d320 100644 --- a/lib/atc/Array.h +++ b/lib/atc/Array.h @@ -78,7 +78,7 @@ protected: template Array::Array(void) { len_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -90,8 +90,8 @@ Array::Array(int len) { template Array::Array(const Array& A) { len_ = A.len_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[len_]; for(int i=0;i::Array(const Array& A) { template Array::~Array() { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; } template @@ -111,12 +111,12 @@ void Array::reset(int len) { } else { // size change, realloc memory len_ = len; - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; if (len_ > 0) data_ = new T[len_]; else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -130,7 +130,7 @@ void Array::resize(int len, bool copy) { else { // size change, realloc memory len_ = len; if (len_ > 0) { - if (copy && data_ != NULL) { + if (copy && data_ != nullptr) { Array temp(*this); delete[] data_; data_ = new T[len_]; @@ -140,12 +140,12 @@ void Array::resize(int len, bool copy) { } } else { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; data_ = new T[len_]; } } else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -158,10 +158,10 @@ T& Array::operator() (int i) { template Array& Array::operator= (const Array &other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS len_ = other.len_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[len_]; } @@ -250,7 +250,7 @@ T* Array::ptr() const { template void Array::print(std::string name) const { std::cout << "------- Begin "<::AliasArray(const Array& A) { template AliasArray::~AliasArray(void) { len_ = 0; - data_ = NULL; // trick base class into not deleting parent data + data_ = nullptr; // trick base class into not deleting parent data } template diff --git a/lib/atc/Array2D.h b/lib/atc/Array2D.h index 25f895f72c..37b7dcb3c9 100644 --- a/lib/atc/Array2D.h +++ b/lib/atc/Array2D.h @@ -57,7 +57,7 @@ template Array2D::Array2D() { nrows_ = 0; ncols_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -71,8 +71,8 @@ template Array2D::Array2D(const Array2D& A) { nrows_ = A.nrows_; ncols_ = A.ncols_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[nrows_ * ncols_]; for(int i=0;i::reset(int nrows, int ncols) { else { // size changed; realloc memory nrows_ = nrows; ncols_ = ncols; - if (data_ != NULL) + if (data_ != nullptr) delete [] data_; if (ncols_ > 0 && nrows_ > 0) data_ = new T[nrows_ * ncols_]; else { - data_ = NULL; + data_ = nullptr; nrows_ = 0; ncols_ = 0; } @@ -120,11 +120,11 @@ AliasArray Array2D::column(int col) const { template Array2D& Array2D::operator= (const Array2D& other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS nrows_ = other.nrows_; ncols_ = other.ncols_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[nrows_ * ncols_]; } @@ -170,14 +170,14 @@ void Array2D::write_restart(FILE *f) const { template Array2D::~Array2D() { - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; } template void Array2D::print(std::string name) const { std::cout << "------- Begin "< >::iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { data = new DENS_MAN(nNodes_,nCols); @@ -115,14 +115,14 @@ namespace ATC { //-------------------------------------------------------- // get_regulator_data: - // gets a pointer to the requested data, or NULL if + // gets a pointer to the requested data, or nullptr if // if doesn't exist //-------------------------------------------------------- const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const { map >::const_iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { - return NULL; + return nullptr; } else { return const_cast((it->second).second); @@ -521,7 +521,7 @@ namespace ATC { fieldMask_(NUM_FIELDS,NUM_FLUX), nNodes_(atomicRegulator_->num_nodes()), regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix), - shpFcnDerivs_(NULL) + shpFcnDerivs_(nullptr) { fieldMask_ = false; } @@ -552,21 +552,21 @@ namespace ATC { RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator, const string & regulatorPrefix) : RegulatorMethod(atomicRegulator,regulatorPrefix), - lambda_(NULL), - atomLambdas_(NULL), - shapeFunctionMatrix_(NULL), + lambda_(nullptr), + atomLambdas_(nullptr), + shapeFunctionMatrix_(nullptr), linearSolverType_(AtomicRegulator::NO_SOLVE), maxIterations_(atomicRegulator->max_iterations()), tolerance_(atomicRegulator->tolerance()), - matrixSolver_(NULL), - regulatedNodes_(NULL), - applicationNodes_(NULL), - boundaryNodes_(NULL), - shpFcn_(NULL), - atomicWeights_(NULL), - elementMask_(NULL), - lambdaAtomMap_(NULL), - weights_(NULL), + matrixSolver_(nullptr), + regulatedNodes_(nullptr), + applicationNodes_(nullptr), + boundaryNodes_(nullptr), + shpFcn_(nullptr), + atomicWeights_(nullptr), + elementMask_(nullptr), + lambdaAtomMap_(nullptr), + weights_(nullptr), nsd_(atomicRegulator_->nsd()), nLocal_(atomicRegulator_->nlocal()) { diff --git a/lib/atc/AtomicRegulator.h b/lib/atc/AtomicRegulator.h index b9fccb902c..360af3a4f6 100644 --- a/lib/atc/AtomicRegulator.h +++ b/lib/atc/AtomicRegulator.h @@ -143,7 +143,7 @@ namespace ATC { /** can externally set regulator dynamic contributions */ virtual void reset_lambda_contribution(const DENS_MAT & /* target */, const FieldName /* field */) {}; virtual void reset_lambda_contribution(const DENS_MAT & target) { reset_lambda_contribution(target,NUM_TOTAL_FIELDS); } - /** returns a const pointer to the DENS_MAN associated with the tag, or NULL */ + /** returns a const pointer to the DENS_MAN associated with the tag, or nullptr */ const DENS_MAN * regulator_data(const std::string tag) const; /** return the maximum number of iterations */ int max_iterations() {return maxIterations_;}; diff --git a/lib/atc/CauchyBorn.cpp b/lib/atc/CauchyBorn.cpp index 85b100ca64..81f7b4e1a8 100644 --- a/lib/atc/CauchyBorn.cpp +++ b/lib/atc/CauchyBorn.cpp @@ -426,7 +426,7 @@ namespace ATC { for (INDEX j=i; j<3; j++) s(i,j) += factor * dd(i,j); - // If f_W is not NULL then append thermal contribution. + // If f_W is not nullptr then append thermal contribution. if (F_w) *F_w += 0.5*kb*T*log(detD); } //============================================================================ diff --git a/lib/atc/ChargeRegulator.cpp b/lib/atc/ChargeRegulator.cpp index bae78a7613..972530829c 100644 --- a/lib/atc/ChargeRegulator.cpp +++ b/lib/atc/ChargeRegulator.cpp @@ -164,7 +164,7 @@ namespace ATC { chargeRegulator_(chargeRegulator), lammpsInterface_(LammpsInterface::instance()), rC_(0), rCsq_(0), - targetValue_(NULL), + targetValue_(nullptr), targetPhi_(p.value), surface_(p.faceset), atomGroupBit_(p.groupBit), diff --git a/lib/atc/CloneVector.h b/lib/atc/CloneVector.h index 02db700f27..63d11636b3 100644 --- a/lib/atc/CloneVector.h +++ b/lib/atc/CloneVector.h @@ -52,7 +52,7 @@ private: //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Vector &c) - : Vector(), _baseV(const_cast*>(&c)), _baseM(NULL) + : Vector(), _baseV(const_cast*>(&c)), _baseM(nullptr) {} //----------------------------------------------------------------------------- // Construct from a matrix, the const_cast isn't pretty @@ -65,7 +65,7 @@ CloneVector::CloneVector(const Vector &c) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(dim), _idx(idx) {} //----------------------------------------------------------------------------- @@ -73,7 +73,7 @@ CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const DiagonalMatrix &c, INDEX /* idx */) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(CLONE_DIAG), _idx(0) {} //----------------------------------------------------------------------------- diff --git a/lib/atc/ConcentrationRegulator.cpp b/lib/atc/ConcentrationRegulator.cpp index 4255b919b9..499a5501c1 100644 --- a/lib/atc/ConcentrationRegulator.cpp +++ b/lib/atc/ConcentrationRegulator.cpp @@ -186,14 +186,14 @@ const double kMinScale_ = 10000.; ConcentrationRegulator::ConcentrationRegulatorParameters & p) : ConcentrationRegulatorMethod(concReg), concentrationRegulator_(concReg), - interscaleManager_(NULL), + interscaleManager_(nullptr), lammpsInterface_(LammpsInterface::instance()), - list_(NULL), + list_(nullptr), targetConcentration_(p.value), targetCount_(0), elemset_(p.elemset), - p_(NULL), - randomNumberGenerator_(NULL), + p_(nullptr), + randomNumberGenerator_(nullptr), q0_(0), controlType_(p.type), controlIndex_(0), diff --git a/lib/atc/DenseMatrix.h b/lib/atc/DenseMatrix.h index e585289aaa..e4759f02d4 100644 --- a/lib/atc/DenseMatrix.h +++ b/lib/atc/DenseMatrix.h @@ -16,10 +16,10 @@ template class DenseMatrix : public Matrix { public: - DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(NULL){ _create(rows, cols, z); } - DenseMatrix(const DenseMatrix& c) : Matrix(), _data(NULL){ _copy(c); } - DenseMatrix(const SparseMatrix& c): Matrix(), _data(NULL){ c.dense_copy(*this);} - DenseMatrix(const Matrix& c) : Matrix(), _data(NULL){ _copy(c); } + DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(nullptr){ _create(rows, cols, z); } + DenseMatrix(const DenseMatrix& c) : Matrix(), _data(nullptr){ _copy(c); } + DenseMatrix(const SparseMatrix& c): Matrix(), _data(nullptr){ c.dense_copy(*this);} + DenseMatrix(const Matrix& c) : Matrix(), _data(nullptr){ _copy(c); } // const SparseMatrix * p = sparse_cast(&c); // (p) ? p->dense_copy(*this) : _copy(c); } ~DenseMatrix() { _delete();} @@ -261,7 +261,7 @@ void DenseMatrix::_delete() _nRows = _nCols = 0; if (_data){ delete [] _data; - _data = NULL; + _data = nullptr; } } //---------------------------------------------------------------------------- @@ -273,7 +273,7 @@ void DenseMatrix::_create(INDEX rows, INDEX cols, bool zero) _nRows=rows; _nCols=cols; - _data = (this->size() ? new T [_nCols*_nRows] : NULL); + _data = (this->size() ? new T [_nCols*_nRows] : nullptr); if (zero) this->zero(); } //---------------------------------------------------------------------------- diff --git a/lib/atc/DenseVector.h b/lib/atc/DenseVector.h index 38ed68f937..bab90bf3ff 100644 --- a/lib/atc/DenseVector.h +++ b/lib/atc/DenseVector.h @@ -16,9 +16,9 @@ class DenseVector : public Vector { public: explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); } - DenseVector(const DenseVector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const Vector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(NULL) { copy(ptr,nrows); } + DenseVector(const DenseVector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const Vector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(nullptr) { copy(ptr,nrows); } virtual ~DenseVector() { _delete(); } //* resizes the Vector, ignores nCols, optionally copys what fits @@ -123,7 +123,7 @@ template inline void DenseVector::_create(INDEX n, bool zero) { _size=n; - _data = _size ? new T [_size] : NULL ; + _data = _size ? new T [_size] : nullptr ; if (zero) this->zero(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/lib/atc/DiagonalMatrix.h b/lib/atc/DiagonalMatrix.h index ca3001f225..b24e19dd4e 100644 --- a/lib/atc/DiagonalMatrix.h +++ b/lib/atc/DiagonalMatrix.h @@ -205,7 +205,7 @@ DiagonalMatrix operator-(const DiagonalMatrix &A, const DiagonalMatrix //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) - : _data(NULL) + : _data(nullptr) { reset(rows, zero); } @@ -214,7 +214,7 @@ DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(c); } @@ -223,7 +223,7 @@ DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const Vector& v) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(v); } diff --git a/lib/atc/DislocationExtractor.h b/lib/atc/DislocationExtractor.h index c2bfe27e04..a0ba3aa995 100644 --- a/lib/atc/DislocationExtractor.h +++ b/lib/atc/DislocationExtractor.h @@ -197,7 +197,7 @@ protected: a.pos.Y = atom->x[i][1]; a.pos.Z = atom->x[i][2]; a.flags = 0; - a.cluster = NULL; + a.cluster = nullptr; a.numNeighbors = 0; a.setFlag(ATOM_IS_LOCAL_ATOM); } @@ -290,7 +290,7 @@ protected: currentAtom->pos.Y = atom->x[i][1]; currentAtom->pos.Z = atom->x[i][2]; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -302,7 +302,7 @@ protected: // Receive atoms from other processors. for(int iproc = 1; iproc < comm->nprocs; iproc++) { MPI_Status status; - MPI_Recv(buffer.empty() ? NULL : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); + MPI_Recv(buffer.empty() ? nullptr : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); int ndoubles; MPI_Get_count(&status, MPI_DOUBLE, &ndoubles); int nReceived = ndoubles / 3; @@ -314,7 +314,7 @@ protected: currentAtom->pos.Y = *data++; currentAtom->pos.Z = *data++; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -332,11 +332,11 @@ protected: *data++ = atom->x[i][2]; } // Send local atom coordinates to master proc. - MPI_Send(buffer.empty() ? NULL : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); + MPI_Send(buffer.empty() ? nullptr : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); } // Make sure all input atoms are wrapped at periodic boundary conditions. - wrapInputAtoms(NULL_VECTOR); + wrapInputAtoms(nullptr_VECTOR); // Build nearest neighbor lists. buildNearestNeighborLists(); @@ -376,7 +376,7 @@ protected: } } // Broadcast segments. - MPI_Bcast(segmentBuffer.empty() ? NULL : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(segmentBuffer.empty() ? nullptr : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract segments from receive buffer. @@ -402,7 +402,7 @@ protected: DISLOCATIONS_ASSERT(sendItem == pointBuffer.end()); } // Broadcast segments. - MPI_Bcast(pointBuffer.empty() ? NULL : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(pointBuffer.empty() ? nullptr : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract points from receive buffer. diff --git a/lib/atc/ElasticTimeIntegrator.cpp b/lib/atc/ElasticTimeIntegrator.cpp index 5e11f1584c..785568cbb2 100644 --- a/lib/atc/ElasticTimeIntegrator.cpp +++ b/lib/atc/ElasticTimeIntegrator.cpp @@ -184,8 +184,8 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicDisplacement_(NULL), - nodalAtomicForce_(NULL) + nodalAtomicDisplacement_(nullptr), + nodalAtomicForce_(nullptr) { // do nothing } @@ -410,9 +410,9 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), - nodalAtomicDisplacement_(NULL), + nodalAtomicDisplacement_(nullptr), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd()) { @@ -633,7 +633,7 @@ namespace ATC { FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) : MomentumIntegrationMethod(momentumTimeIntegrator), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), diff --git a/lib/atc/ElectronHeatFlux.h b/lib/atc/ElectronHeatFlux.h index d0bc2a44f2..4c5b6200d3 100644 --- a/lib/atc/ElectronHeatFlux.h +++ b/lib/atc/ElectronHeatFlux.h @@ -17,7 +17,7 @@ namespace ATC { class ElectronHeatFlux { public: - ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFlux() {}; /** computes heat flux */ virtual void electron_heat_flux(const FIELD_MATS &fields, @@ -68,7 +68,7 @@ namespace ATC { { public: ElectronHeatFluxLinear(std::fstream &matfile,std::map & parameters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxLinear() {}; virtual void electron_heat_flux(const FIELD_MATS & /* fields */, const GRAD_FIELD_MATS &gradFields, @@ -95,7 +95,7 @@ namespace ATC { { public: ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map ¶meters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxPowerLaw() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, @@ -134,8 +134,8 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t public: ElectronHeatFluxThermopower(std::fstream &matfile, std::map & parameters, - /*const*/ ElectronFlux * electronFlux = NULL, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronFlux * electronFlux = nullptr, + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxThermopower() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, diff --git a/lib/atc/ExtrinsicModel.cpp b/lib/atc/ExtrinsicModel.cpp index b20b2a26d1..8e0079d965 100644 --- a/lib/atc/ExtrinsicModel.cpp +++ b/lib/atc/ExtrinsicModel.cpp @@ -114,7 +114,7 @@ namespace ATC { ATC::LammpsInterface::instance()->print_msg_once(ss.str()); myModel = new ExtrinsicModelElectrostatic (this,modelType,matFileName); - } else myModel = NULL; + } else myModel = nullptr; extrinsicModels_.push_back(myModel); // add new fields to fields data @@ -157,7 +157,7 @@ namespace ATC { for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) { if ((*imodel)->model_type()==type) return *imodel; } - return NULL; + return nullptr; } @@ -343,7 +343,7 @@ namespace ATC { atc_(modelManager->atc()), modelManager_(modelManager), modelType_(modelType), - physicsModel_(NULL) + physicsModel_(nullptr) { rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX); rhsMaskIntrinsic_ = false; diff --git a/lib/atc/ExtrinsicModelDriftDiffusion.cpp b/lib/atc/ExtrinsicModelDriftDiffusion.cpp index f9b93a147a..a9d8f27604 100644 --- a/lib/atc/ExtrinsicModelDriftDiffusion.cpp +++ b/lib/atc/ExtrinsicModelDriftDiffusion.cpp @@ -38,17 +38,17 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName), - continuityIntegrator_(NULL), + continuityIntegrator_(nullptr), poissonSolverType_(DIRECT), // ITERATIVE | DIRECT - poissonSolver_(NULL), + poissonSolver_(nullptr), baseSize_(0), electronDensityEqn_(ELECTRON_CONTINUITY), fluxUpdateFreq_(1), schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT - schrodingerSolver_(NULL), + schrodingerSolver_(nullptr), schrodingerPoissonMgr_(), - schrodingerPoissonSolver_(NULL), + schrodingerPoissonSolver_(nullptr), maxConsistencyIter_(0), maxConstraintIter_(1), safe_dEf_(0.1), Ef_shift_(0.0), oneD_(false), oneDcoor_(0), oneDconserve_(0) @@ -351,7 +351,7 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName), - cddmPoissonSolver_(NULL), + cddmPoissonSolver_(nullptr), baseSize_(0) { // delete base class's version of the physics model diff --git a/lib/atc/ExtrinsicModelElectrostatic.cpp b/lib/atc/ExtrinsicModelElectrostatic.cpp index ef3aa52dee..d0aa56d67d 100644 --- a/lib/atc/ExtrinsicModelElectrostatic.cpp +++ b/lib/atc/ExtrinsicModelElectrostatic.cpp @@ -38,15 +38,15 @@ namespace ATC { poissonSolverType_(DIRECT), // ITERATIVE | DIRECT poissonSolverTol_(0), poissonSolverMaxIter_(0), - poissonSolver_(NULL), + poissonSolver_(nullptr), maxSolves_(0), baseSize_(0), - chargeRegulator_(NULL), + chargeRegulator_(nullptr), useSlab_(false), includeShortRange_(true), - atomForces_(NULL), - nodalAtomicCharge_(NULL), - nodalAtomicGhostCharge_(NULL) + atomForces_(nullptr), + nodalAtomicCharge_(nullptr), + nodalAtomicGhostCharge_(nullptr) { physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName); // set up correct masks for coupling diff --git a/lib/atc/ExtrinsicModelTwoTemperature.cpp b/lib/atc/ExtrinsicModelTwoTemperature.cpp index 2be6cfeb3c..35846fe496 100644 --- a/lib/atc/ExtrinsicModelTwoTemperature.cpp +++ b/lib/atc/ExtrinsicModelTwoTemperature.cpp @@ -26,7 +26,7 @@ namespace ATC { string matFileName) : ExtrinsicModel(modelManager,modelType,matFileName), electronTimeIntegration_(TimeIntegrator::IMPLICIT), - temperatureIntegrator_(NULL), + temperatureIntegrator_(nullptr), nsubcycle_(1), exchangeFlag_(true), baseSize_(0) @@ -164,7 +164,7 @@ namespace ATC { rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i); } if (electronTimeIntegration_ == TimeIntegrator::NONE) { - temperatureIntegrator_ = NULL; + temperatureIntegrator_ = nullptr; return; } if (temperatureIntegrator_) delete temperatureIntegrator_; diff --git a/lib/atc/FE_Element.cpp b/lib/atc/FE_Element.cpp index 0d2fc036c7..299b9f191d 100644 --- a/lib/atc/FE_Element.cpp +++ b/lib/atc/FE_Element.cpp @@ -36,7 +36,7 @@ static const double localCoordinatesTolerance = 1.e-09; tolerance_(localCoordinatesTolerance), projectionGuess_(COORDINATE_ALIGNED) { - feInterpolate_ = NULL; + feInterpolate_ = nullptr; } FE_Element::~FE_Element() diff --git a/lib/atc/FE_Engine.cpp b/lib/atc/FE_Engine.cpp index 5e01709b19..9e3c5180e2 100644 --- a/lib/atc/FE_Engine.cpp +++ b/lib/atc/FE_Engine.cpp @@ -32,7 +32,7 @@ namespace ATC{ //----------------------------------------------------------------- FE_Engine::FE_Engine(MPI_Comm comm) : communicator_(comm), - feMesh_(NULL), + feMesh_(nullptr), initialized_(false), outputManager_() { diff --git a/lib/atc/FE_Engine.h b/lib/atc/FE_Engine.h index eb59f04eef..ade7626f80 100644 --- a/lib/atc/FE_Engine.h +++ b/lib/atc/FE_Engine.h @@ -90,7 +90,7 @@ namespace ATC { /** write data: data is arrayed over _unique_ nodes and then mapped by the engine */ - void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=NULL); + void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr); void write_data(double time, OUTPUT_LIST *data); void write_restart_file(std::string fileName, RESTART_LIST *data) @@ -150,7 +150,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute tangent matrix for a pair of fields - given quadrature */ void compute_tangent_matrix(const RHS_MASK &rhsMask, @@ -162,7 +162,7 @@ namespace ATC { const SPAR_MAT &N, const SPAR_MAT_VEC &dN, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a consistent mass matrix for a field */ void compute_mass_matrix( @@ -171,7 +171,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, CON_MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a dimensionless mass matrix */ void compute_mass_matrix(SPAR_MAT &mass_matrix) const; @@ -191,7 +191,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute dimensional lumped mass matrix using given quadrature */ void compute_lumped_mass_matrix( @@ -212,7 +212,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, FIELD_MATS &energy, - const DenseMatrix *elementMask=NULL, + const DenseMatrix *elementMask=nullptr, const IntegrationDomainType domain=FULL_DOMAIN) const; /** compute residual or RHS of the dynamic weak eqn */ @@ -223,7 +223,7 @@ namespace ATC { const Array &elementMaterials, FIELDS &rhs, bool freeOnly=false, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute RHS for given quadrature */ void compute_rhs_vector(const RHS_MASK &rhsMask, @@ -251,7 +251,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, GRAD_FIELD_MATS &flux, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute the flux on the MD/FE boundary */ void compute_boundary_flux(const RHS_MASK &rhsMask, @@ -272,8 +272,8 @@ namespace ATC { const SPAR_MAT_VEC &dN, const DIAG_MAT &flux_mask, FIELDS &rhs, - const DenseMatrix *elementMask=NULL, - const std::set *nodeSet=NULL) const; + const DenseMatrix *elementMask=nullptr, + const std::set *nodeSet=nullptr) const; /** compute prescribed flux given an array of functions of x & t */ void add_fluxes(const Array &fieldMask, @@ -465,7 +465,7 @@ namespace ATC { int nsd() const { return feMesh_->num_spatial_dimensions(); } /** return if the FE mesh has been created */ - int has_mesh() const { return feMesh_!=NULL; } + int has_mesh() const { return feMesh_!=nullptr; } /** get nodal coordinates for a given element */ void element_coordinates(const int eltIdx, DENS_MAT &coords) diff --git a/lib/atc/FE_Mesh.cpp b/lib/atc/FE_Mesh.cpp index 4ea10a681a..6af29ee37e 100644 --- a/lib/atc/FE_Mesh.cpp +++ b/lib/atc/FE_Mesh.cpp @@ -46,7 +46,7 @@ namespace ATC { partitioned_(false), nNodes_(0), nNodesUnique_(0), - feElement_(NULL), + feElement_(nullptr), twoDimensional_(false), hasPlanarFaces_(false) @@ -1708,7 +1708,7 @@ namespace ATC { const Array< pair< string, set > > *nodeSets): FE_Mesh(), minEltSize_(0), - tree_(NULL) + tree_(nullptr) { // Pick which element class to make if (elementType == "HEX8") { @@ -1774,7 +1774,7 @@ namespace ATC { } // Insert nodes and elements into KD-tree for PIE search. - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); } @@ -2107,7 +2107,7 @@ namespace ATC { // use the KD tree for partitioning, getting more blocks than // processors - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); @@ -2519,7 +2519,7 @@ namespace ATC { const double zscale) : hx_(hx), hy_(hy), hz_(hz) { - tree_ = NULL; + tree_ = nullptr; hasPlanarFaces_ = true; xscale_ = xscale; yscale_ = yscale; @@ -2820,7 +2820,7 @@ namespace ATC { const double zscale) { hasPlanarFaces_ = true; - tree_ = NULL; + tree_ = nullptr; xscale_ = xscale; yscale_ = yscale; zscale_ = zscale; diff --git a/lib/atc/FieldEulerIntegrator.cpp b/lib/atc/FieldEulerIntegrator.cpp index 0abc71cbab..ba23af40c9 100644 --- a/lib/atc/FieldEulerIntegrator.cpp +++ b/lib/atc/FieldEulerIntegrator.cpp @@ -112,7 +112,7 @@ FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator( const Array2D< bool > & rhsMask, // copy const double alpha ) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask), - alpha_(alpha),solver_(NULL) + alpha_(alpha),solver_(nullptr) { rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0]; diff --git a/lib/atc/FieldManager.cpp b/lib/atc/FieldManager.cpp index 338f06acad..8a7fb0d50b 100644 --- a/lib/atc/FieldManager.cpp +++ b/lib/atc/FieldManager.cpp @@ -271,7 +271,7 @@ typedef PerAtomQuantity PAQ; u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY); } else { - DENS_MAN * q = NULL; + DENS_MAN * q = nullptr; if (atc_->kernel_on_the_fly()) { if (atc_->kernel_based()) { q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic, diff --git a/lib/atc/FieldManager.h b/lib/atc/FieldManager.h index 9a98676417..b12db230c5 100644 --- a/lib/atc/FieldManager.h +++ b/lib/atc/FieldManager.h @@ -47,7 +47,7 @@ namespace ATC { case SPECIES_FLUX: return species_flux(name); case INTERNAL_ENERGY: return internal_energy(name); case ENERGY: return energy(name); - default: throw ATC_Error("FieldManager:: unknown field"); return NULL; + default: throw ATC_Error("FieldManager:: unknown field"); return nullptr; } } CanonicalName string_to_canonical_name(std::string name){ @@ -83,11 +83,11 @@ namespace ATC { case PROLONGED_VELOCITY: return prolonged_field(VELOCITY); default: - throw ATC_Error("FieldManager:: unknown PAQ"); return NULL; + throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr; } } /** this function returns a restriction of atomic data */ - DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = NULL); + DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = nullptr); protected: ATC_Method * atc_; InterscaleManager & interscaleManager_; @@ -120,10 +120,10 @@ namespace ATC { PAQ * atomic_species_vector(); // internal functions - DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = NULL); - DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = NULL); - DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = NULL); - DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return NULL;}; + DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = nullptr); + DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = nullptr); + DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = nullptr); + DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return nullptr;}; PAQ * prolonged_field(FieldName field); private: FieldManager(void); diff --git a/lib/atc/Function.cpp b/lib/atc/Function.cpp index 062cbcb9b2..e73d64aaea 100644 --- a/lib/atc/Function.cpp +++ b/lib/atc/Function.cpp @@ -26,13 +26,13 @@ namespace ATC { //==================================================================== // UXT_Function_Mgr //==================================================================== - UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = NULL; + UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- UXT_Function_Mgr * UXT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new UXT_Function_Mgr(); } return myInstance_; @@ -90,7 +90,7 @@ namespace ATC { { string tag = other->tag(); - UXT_Function * returnFunction = NULL; + UXT_Function * returnFunction = nullptr; if (tag=="linear") { ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other; returnFunction = new ScalarLinearFunction(*other_cast); @@ -144,14 +144,14 @@ namespace ATC { // XT_Function_Mgr //-------------------------------------------------------------------- //-------------------------------------------------------------------- -XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; +XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- XT_Function_Mgr * XT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new XT_Function_Mgr(); } return myInstance_; @@ -227,7 +227,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; { string tag = other->tag(); - XT_Function * returnFunction = NULL; + XT_Function * returnFunction = nullptr; if (tag=="linear") { LinearFunction * other_cast = (LinearFunction*) other; returnFunction = new LinearFunction(*other_cast); diff --git a/lib/atc/FundamentalAtomicQuantity.cpp b/lib/atc/FundamentalAtomicQuantity.cpp index 0ebb54e168..63824bd0dd 100644 --- a/lib/atc/FundamentalAtomicQuantity.cpp +++ b/lib/atc/FundamentalAtomicQuantity.cpp @@ -126,7 +126,7 @@ namespace ATC { double unitsConversion, AtomType atomType) : ShallowAtomQuantity(atc,0,atomType), - computePointer_(NULL), + computePointer_(nullptr), computeTag_(tag), unitsConversion_(unitsConversion) { diff --git a/lib/atc/FundamentalAtomicQuantity.h b/lib/atc/FundamentalAtomicQuantity.h index 5fb525cd6f..d5cf9f8a21 100644 --- a/lib/atc/FundamentalAtomicQuantity.h +++ b/lib/atc/FundamentalAtomicQuantity.h @@ -131,11 +131,11 @@ namespace ATC { /** gets appropriate pointer for lammps data */ virtual double * lammps_scalar() const - {return NULL;}; + {return nullptr;}; /** gets appropriate pointer for lammps data */ virtual double ** lammps_vector() const - {return NULL;}; + {return nullptr;}; private: diff --git a/lib/atc/GhostManager.cpp b/lib/atc/GhostManager.cpp index 77594ec406..1482a5a47d 100644 --- a/lib/atc/GhostManager.cpp +++ b/lib/atc/GhostManager.cpp @@ -23,7 +23,7 @@ namespace ATC { // Constructor //-------------------------------------------------------- GhostManager::GhostManager(ATC_Method * atc) : - ghostModifier_(NULL), + ghostModifier_(nullptr), atc_(atc), boundaryDynamics_(NO_BOUNDARY_DYNAMICS), needReset_(true) @@ -116,7 +116,7 @@ namespace ATC { { if (ghostModifier_) { delete ghostModifier_; - ghostModifier_ = NULL; + ghostModifier_ = nullptr; } if (!atc_->groupbit_ghost()) { @@ -252,7 +252,7 @@ namespace ATC { //-------------------------------------------------------- GhostModifier::GhostModifier(GhostManager * ghostManager) : ghostManager_(ghostManager), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), integrateAtoms_(false) { // do nothing @@ -321,9 +321,9 @@ namespace ATC { //-------------------------------------------------------- GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) : GhostModifier(ghostManager), - atomPositions_(NULL), - atomFeDisplacement_(NULL), - atomRefPositions_(NULL) + atomPositions_(nullptr), + atomFeDisplacement_(nullptr), + atomRefPositions_(nullptr) { // do nothing } @@ -382,9 +382,9 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierPrescribed(ghostManager), - atomVelocities_(NULL), - atomFeVelocity_(NULL), - atomForces_(NULL), + atomVelocities_(nullptr), + atomFeVelocity_(nullptr), + atomForces_(nullptr), kappa_(kappa), gamma_(gamma), mu_(mu) @@ -486,8 +486,8 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu), - ghostToBoundaryDistance_(NULL), - layerId_(NULL) + ghostToBoundaryDistance_(nullptr), + layerId_(nullptr) { // do nothing @@ -731,8 +731,8 @@ namespace ATC { GhostModifier(ghostManager), lammpsInterface_(LammpsInterface::instance()), elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalToAtom_((ghostManager_->atc())->internal_to_atom_map()), ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()), groupbit_((ghostManager_->atc())->groupbit()), diff --git a/lib/atc/InterscaleOperators.cpp b/lib/atc/InterscaleOperators.cpp index f1e5607b6e..eeac14adf8 100644 --- a/lib/atc/InterscaleOperators.cpp +++ b/lib/atc/InterscaleOperators.cpp @@ -30,7 +30,7 @@ namespace ATC{ for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) { fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES); for (unsigned int j = 0; j < LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES; j++) - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } @@ -126,7 +126,7 @@ namespace ATC{ if (fundamentalAtomQuantities_[i][j]) { index = dfs_visit(fundamentalAtomQuantities_[i][j],index); if ((fundamentalAtomQuantities_[i][j])->memory_type()==TEMPORARY) { - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } } @@ -453,7 +453,7 @@ namespace ATC{ DependencyManager * InterscaleManager::find(const string & tag) { // REFACTOR add check for duplicate entries - DependencyManager * quantity = NULL; + DependencyManager * quantity = nullptr; quantity = find_in_list(perAtomQuantities_,tag); if (quantity) return quantity; @@ -482,7 +482,7 @@ namespace ATC{ quantity = find_in_list(smallMoleculeSets_,tag); if (quantity) return quantity; - return NULL; + return nullptr; } //-------------------------------------------------------- diff --git a/lib/atc/InterscaleOperators.h b/lib/atc/InterscaleOperators.h index 3a4d81212e..40c5144bf8 100644 --- a/lib/atc/InterscaleOperators.h +++ b/lib/atc/InterscaleOperators.h @@ -277,7 +277,7 @@ namespace ATC { data * return_quantity(std::map & list, const std::string & tag) { typename std::map::iterator it = list.find(tag); - if (it==list.end()) return NULL; + if (it==list.end()) return nullptr; return it->second; } @@ -310,7 +310,7 @@ namespace ATC { { typename std::map::iterator it = list.find(tag); if (it!=list.end()) return it->second; - return NULL; + return nullptr; } /** helper function to force the reset of all data in a list */ diff --git a/lib/atc/KD_Tree.cpp b/lib/atc/KD_Tree.cpp index 1432663e80..181be27dc5 100644 --- a/lib/atc/KD_Tree.cpp +++ b/lib/atc/KD_Tree.cpp @@ -83,17 +83,17 @@ KD_Tree::KD_Tree(vector *points, vector *elements, if (foundElemRight) rightElems->push_back(*elit); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - leftElems->size() < 4 || leftElems->size() == 0) { - leftChild_ = NULL; + leftChild_ = nullptr; delete leftPts; delete leftElems; } else { leftChild_ = new KD_Tree(leftPts, leftElems, (dimension+1) % 3); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - rightElems->size() < 4 || rightElems->size() == 0) { - rightChild_ = NULL; + rightChild_ = nullptr; delete rightPts; delete rightElems; } else { @@ -109,7 +109,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { // tree, either recurse to the left or return this node's elements // if there is no left child. if (query.lessThanInDimension(value_, dimension)) { - if (leftChild_ == NULL) { + if (leftChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -119,7 +119,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { } return leftChild_->find_nearest_elements(query, (dimension+1) % 3); } else { - if (rightChild_ == NULL) { + if (rightChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -147,7 +147,7 @@ vector > KD_Tree::getElemIDs(int depth) { sort(candElemIDs.begin(), candElemIDs.end()); result.push_back(candElemIDs); - } else if (leftChild_ == NULL || rightChild_ == NULL) { + } else if (leftChild_ == nullptr || rightChild_ == nullptr) { // Insert all nodes at this level once, // then insert a bunch of empty vectors. temp = this->getElemIDs(0); diff --git a/lib/atc/KernelFunction.cpp b/lib/atc/KernelFunction.cpp index 70a1616e01..6095c14284 100644 --- a/lib/atc/KernelFunction.cpp +++ b/lib/atc/KernelFunction.cpp @@ -20,13 +20,13 @@ namespace ATC { //======================================================================== // KernelFunctionMgr //======================================================================== - KernelFunctionMgr * KernelFunctionMgr::myInstance_ = NULL; + KernelFunctionMgr * KernelFunctionMgr::myInstance_ = nullptr; //------------------------------------------------------------------------ // instance //------------------------------------------------------------------------ KernelFunctionMgr * KernelFunctionMgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new KernelFunctionMgr(); } return myInstance_; @@ -65,7 +65,7 @@ namespace ATC { No default */ int argIdx = 0; - KernelFunction * ptr = NULL; + KernelFunction * ptr = nullptr; char* type = arg[argIdx++]; if (strcmp(type,"step")==0) { double parameters[1] = {atof(arg[argIdx])}; // cutoff radius diff --git a/lib/atc/KinetoThermostat.cpp b/lib/atc/KinetoThermostat.cpp index c10f7eb458..89d598c102 100644 --- a/lib/atc/KinetoThermostat.cpp +++ b/lib/atc/KinetoThermostat.cpp @@ -151,7 +151,7 @@ namespace ATC { VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) : VelocityGlc(kinetostat), velocity_(atc_->field(VELOCITY)), - thermostatCorrection_(NULL) + thermostatCorrection_(nullptr) { // do nothing } @@ -188,7 +188,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -226,14 +226,14 @@ namespace ATC { KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat, int couplingMaxIterations) : KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations), - atomVelocities_(NULL), + atomVelocities_(nullptr), nodalVelocities_(atc_->field(VELOCITY)), - lambdaMomentum_(NULL), - lambdaEnergy_(NULL), - atomicFluctuatingVelocityRescaled_(NULL), - atomicStreamingVelocity_(NULL), - thermostat_(NULL), - kinetostat_(NULL) + lambdaMomentum_(nullptr), + lambdaEnergy_(nullptr), + atomicFluctuatingVelocityRescaled_(nullptr), + atomicStreamingVelocity_(nullptr), + thermostat_(nullptr), + kinetostat_(nullptr) { thermostat_ = this->construct_rescale_thermostat(); kinetostat_ = new VelocityRescaleCombined(kinetoThermostat); @@ -389,7 +389,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) : ThermostatRescaleMixedKePe(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -458,21 +458,21 @@ namespace ATC { velocity_(atc_->field(VELOCITY)), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomRegulatorForces_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), - atomVelocities_(NULL), + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomRegulatorForces_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), + atomVelocities_(nullptr), isFirstTimestep_(true), - nodalAtomicMomentum_(NULL), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL), + nodalAtomicMomentum_(nullptr), + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr), dtFactor_(0.) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize diff --git a/lib/atc/Kinetostat.cpp b/lib/atc/Kinetostat.cpp index 7f95398dcb..676896a2f9 100644 --- a/lib/atc/Kinetostat.cpp +++ b/lib/atc/Kinetostat.cpp @@ -307,11 +307,11 @@ namespace ATC { RegulatorShapeFunction(kinetostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - atomKinetostatForce_(NULL), - atomVelocities_(NULL), - atomMasses_(NULL) + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + atomKinetostatForce_(nullptr), + atomVelocities_(nullptr), + atomMasses_(nullptr) { // data associated with stage 3 in ATC_Method::initialize lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_); @@ -376,7 +376,7 @@ namespace ATC { //-------------------------------------------------------- GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) : KinetostatShapeFunction(kinetostat), - atomPositions_(NULL) + atomPositions_(nullptr) { // do nothing } @@ -462,7 +462,7 @@ namespace ATC { //-------------------------------------------------------- DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMassWeightedDisplacement_(NULL), + nodalAtomicMassWeightedDisplacement_(nullptr), nodalDisplacements_(atc_->field(DISPLACEMENT)) { // do nothing @@ -763,7 +763,7 @@ namespace ATC { //-------------------------------------------------------- VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalVelocities_(atc_->field(VELOCITY)) { // do nothing @@ -1095,8 +1095,8 @@ namespace ATC { StressFlux::StressFlux(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), nodalForce_(atc_->field_rhs(VELOCITY)), - nodalAtomicForce_(NULL), - nodalGhostForce_(NULL), + nodalAtomicForce_(nullptr), + nodalGhostForce_(nullptr), momentumSource_(atc_->atomic_source(VELOCITY)) { // flag for performing boundary flux calculation @@ -1540,14 +1540,14 @@ namespace ATC { KinetostatShapeFunction(kinetostat,regulatorPrefix), velocity_(atc_->field(VELOCITY)), //timeFilter_(atomicRegulator_->time_filter()), - //nodalAtomicLambdaForce_(NULL), - //lambdaPowerFiltered_(NULL), - //atomKinetostatForces_(NULL), - //atomMasses_(NULL), - nodalAtomicMomentum_(NULL), + //nodalAtomicLambdaForce_(nullptr), + //lambdaPowerFiltered_(nullptr), + //atomKinetostatForces_(nullptr), + //atomMasses_(nullptr), + nodalAtomicMomentum_(nullptr), isFirstTimestep_(true), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), dtFactor_(0.) { // constuct/obtain data corresponding to stage 3 of ATC_Method::initialize @@ -1796,8 +1796,8 @@ namespace ATC { const string & regulatorPrefix) : KinetostatGlcFs(kinetostat,regulatorPrefix), momentumSource_(atc_->atomic_source(VELOCITY)), - nodalGhostForce_(NULL), - nodalGhostForceFiltered_(NULL) + nodalGhostForce_(nullptr), + nodalGhostForceFiltered_(nullptr) { // flag for performing boundary flux calculation fieldMask_(VELOCITY,FLUX) = true; @@ -2403,9 +2403,9 @@ namespace ATC { KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat, bool constructKinetostats) : RegulatorMethod(kinetostat), - kinetostatFlux_(NULL), - kinetostatFixed_(NULL), - kinetostatBcs_(NULL) + kinetostatFlux_(nullptr), + kinetostatFixed_(nullptr), + kinetostatBcs_(nullptr) { if (constructKinetostats) { if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) { diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 9964a1c4bb..5727af1904 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -58,14 +58,14 @@ const static int MAX_GROUP_BIT = 2147483647; //4294967295; // pow(2,31)-1; double norm(double * v) {return sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); } -LammpsInterface * LammpsInterface::myInstance_ = NULL; +LammpsInterface * LammpsInterface::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- LammpsInterface * LammpsInterface::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new LammpsInterface(); } return myInstance_; @@ -77,7 +77,7 @@ LammpsInterface * LammpsInterface::instance() void LammpsInterface::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } @@ -85,13 +85,13 @@ void LammpsInterface::Destroy() // constructor // ----------------------------------------------------------------- LammpsInterface::LammpsInterface() - : lammps_(NULL), - fixPointer_(NULL), + : lammps_(nullptr), + fixPointer_(nullptr), commRank_(0), - atomPE_(NULL), + atomPE_(nullptr), refBoxIsSet_(false), - random_(NULL), - globalrandom_(NULL) + random_(nullptr), + globalrandom_(nullptr) { } @@ -225,7 +225,7 @@ void LammpsInterface::sparse_allsum(SparseMatrix &toShare) const std::string LammpsInterface::read_file(std::string filename) const { - FILE *fp = NULL; + FILE *fp = nullptr; if (! comm_rank()) { fp = fopen(filename.c_str(),"r"); if (!fp) throw ATC_Error("can't open file: "+filename); @@ -343,7 +343,7 @@ double * LammpsInterface::atom_scalar(FundamentalAtomQuantity quantityType) cons } else throw ATC_Error("BAD type requested in atom_scalar"); - return NULL; + return nullptr; } double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const @@ -356,7 +356,7 @@ double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) con return fatom(); else throw ATC_Error("BAD type requested in atom_vector"); - return NULL; + return nullptr; } int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const @@ -948,10 +948,10 @@ POTENTIAL LammpsInterface::potential() const "lj/cut/coul/long", "lj/cut/coul/cut", "lj/charmm/coul/long"}; - LAMMPS_NS::Pair *pair = NULL; + LAMMPS_NS::Pair *pair = nullptr; for (int i = 0; i < nStyles; i++){ pair = lammps_->force->pair_match(pairStyles[i].c_str(),1); - if (pair != NULL) break; + if (pair != nullptr) break; } return pair; } @@ -979,8 +979,8 @@ bool LammpsInterface::epsilons(int itype, POTENTIAL pair, double * epsilon0) con int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); int i1,i2; for (int i=1; i < ntypes()+1; i++) { if (i < itype) { i1 = i; i2 = itype; } @@ -998,8 +998,8 @@ bool LammpsInterface::set_epsilons(int itype, POTENTIAL pair, double * epsilon) int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); // scale interactions int i1,i2; for (int i = 1; i < ntypes()+1; i++) { @@ -1498,7 +1498,7 @@ double * LammpsInterface::compute_pe_peratom(void) const return atomPE_->vector_atom; } else { - return NULL; + return nullptr; } } @@ -1542,7 +1542,7 @@ LAMMPS_NS::PairEAM* LammpsInterface::pair_eam() const // return lammps_->force->pair; //} LAMMPS_NS::PairEAM* pair_eam = dynamic_cast (lammps_->force->pair); - if (pair_eam != NULL) { + if (pair_eam != nullptr) { return pair_eam; } else { diff --git a/lib/atc/LammpsInterface.h b/lib/atc/LammpsInterface.h index 2032571da5..6883a9ca0b 100644 --- a/lib/atc/LammpsInterface.h +++ b/lib/atc/LammpsInterface.h @@ -534,7 +534,7 @@ class LammpsInterface { /** Dulong-Petit heat capacity per volume in M,L,T,t units */ double heat_capacity(void) const; /** mass per volume in reference configuraturation in M,L units */ - double mass_density(int* numPerType=NULL) const; + double mass_density(int* numPerType=nullptr) const; /** permittivity of free space, converts from LAMMPS potential units implied by the electric field units to LAMMPS charge units/LAMMPS length units (e.g., V to elemental charge/A) */ double epsilon0(void) const; double coulomb_constant(void) const; diff --git a/lib/atc/LinearSolver.cpp b/lib/atc/LinearSolver.cpp index 655d6130c4..0204ddd938 100644 --- a/lib/atc/LinearSolver.cpp +++ b/lib/atc/LinearSolver.cpp @@ -35,9 +35,9 @@ LinearSolver::LinearSolver( allowReinitialization_(false), homogeneousBCs_(false), bcs_(&bcs), - rhs_(NULL), + rhs_(nullptr), rhsDense_(), - b_(NULL), + b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -65,9 +65,9 @@ LinearSolver::LinearSolver( matrixModified_(false), allowReinitialization_(false), homogeneousBCs_(false), - bcs_(NULL), // null implies no constraints will be added later - rhs_(NULL), - rhsDense_(), b_(NULL), + bcs_(nullptr), // null implies no constraints will be added later + rhs_(nullptr), + rhsDense_(), b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -343,7 +343,7 @@ void LinearSolver::set_fixed_values(VECTOR & X) void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, const DENS_MAT * M) /* const */ { initialize_matrix(); // no inverse needed - const DENS_MAT * Kp = NULL; + const DENS_MAT * Kp = nullptr; const DENS_MAT * Mp =M; DENS_MAT MM; DENS_MAT KM; @@ -388,7 +388,7 @@ void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors bool LinearSolver::solve(VECTOR & x, const VECTOR & b) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; rhs_ = &b; initialized_ = false; @@ -479,7 +479,7 @@ bool LinearSolver::solve(VECTOR & x, const VECTOR & b) void LinearSolver::greens_function(int I, VECTOR & G_I) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; diff --git a/lib/atc/LinearSolver.h b/lib/atc/LinearSolver.h index 5f456b9a1d..1d429d8816 100644 --- a/lib/atc/LinearSolver.h +++ b/lib/atc/LinearSolver.h @@ -64,7 +64,7 @@ class LinearSolver { allow_reinitialization must be called before first solve, etc */ void allow_reinitialization(void); // depending on method save a copy of A void set_homogeneous_bcs(void) { homogeneousBCs_ = true;} // for nonlinear solver, solve for increment - void initialize(const BC_SET * bcs = NULL); + void initialize(const BC_SET * bcs = nullptr); /** solve - solves A x = b @@ -80,7 +80,7 @@ class LinearSolver { - returns the e-values & e-vectors for constrained system Ax + v x = 0 - if M is provided the eval problem : ( A + v M ) x = 0 is solved*/ void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, - const DENS_MAT * M = NULL); + const DENS_MAT * M = nullptr); /** access to penalty coefficient - if a penalty method is not being used this returns zero */ diff --git a/lib/atc/Material.cpp b/lib/atc/Material.cpp index 676a87524f..64673d7993 100644 --- a/lib/atc/Material.cpp +++ b/lib/atc/Material.cpp @@ -28,21 +28,21 @@ namespace ATC { Material::Material() : rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { } //-------------------------------------------------------------- @@ -70,21 +70,21 @@ namespace ATC { : tag_(tag), rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { /*! \page man_material material \section syntax diff --git a/lib/atc/MoleculeSet.h b/lib/atc/MoleculeSet.h index cffafd950d..763f08ef4d 100644 --- a/lib/atc/MoleculeSet.h +++ b/lib/atc/MoleculeSet.h @@ -33,7 +33,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** reset the number of atoms/molecules on this processor */ void reset_nlocal() {this->set_reset();}; @@ -108,8 +108,8 @@ namespace ATC { public: SmallMoleculeSet(ATC_Method * atc, int groupBit, - PerAtomQuantity * bondList = NULL, - PerAtomQuantity * numBond = NULL); + PerAtomQuantity * bondList = nullptr, + PerAtomQuantity * numBond = nullptr); virtual ~SmallMoleculeSet(); @@ -117,7 +117,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** access molecule atoms by lammps id */ std::set atoms_by_global_molecule(int id) const; diff --git a/lib/atc/NonLinearSolver.h b/lib/atc/NonLinearSolver.h index 010e3ee72e..299408c4c3 100644 --- a/lib/atc/NonLinearSolver.h +++ b/lib/atc/NonLinearSolver.h @@ -43,7 +43,7 @@ class NonLinearSolver { /** Constructor */ NonLinearSolver( TangentOperator * f, // provides f and f' at x, pointer for polymorphism - const BC_SET * bcs = NULL, + const BC_SET * bcs = nullptr, const int dof = 0, bool parallel = false ); diff --git a/lib/atc/OutputManager.cpp b/lib/atc/OutputManager.cpp index 066c240cab..83257a3d21 100644 --- a/lib/atc/OutputManager.cpp +++ b/lib/atc/OutputManager.cpp @@ -48,8 +48,8 @@ OutputManager::OutputManager(string outputPrefix, set & otypes) firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_(outputPrefix), ensightOutput_(otypes.count(ENSIGHT)), @@ -68,8 +68,8 @@ OutputManager::OutputManager() firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_("NULL"), ensightOutput_(true), @@ -132,7 +132,7 @@ void OutputManager::print_custom_names() { // Dump text-based fields to disk for later restart void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"wb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -153,7 +153,7 @@ void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) void OutputManager::read_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"rb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -230,7 +230,7 @@ void OutputManager::write_geometry_ensight(void) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; + FILE * fp=nullptr; char buffer[80]; if ( ! initialized_ ) { fp=fopen(geom_file_name.c_str(),"wb"); // open @@ -240,7 +240,7 @@ void OutputManager::write_geometry_ensight(void) else { fp=fopen(geom_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight geometry file"); } @@ -491,14 +491,14 @@ void OutputManager::write_data_ensight(string field_name, const MATRIX *field_da // open or append data file string data_file_name = filenames[ifile]; - FILE * fp=NULL; + FILE * fp=nullptr; if ( outputTimes_.size() == 1 ) { fp=fopen(data_file_name.c_str(),"wb"); // open } else { fp=fopen(data_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight data file: "+data_file_name); } @@ -799,8 +799,8 @@ void OutputManager::write_dictionary(double /* time */, OUTPUT_LIST *data) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; - if ((fp=fopen(dict_file_name.c_str(),"w")) == NULL) + FILE * fp=nullptr; + if ((fp=fopen(dict_file_name.c_str(),"w")) == nullptr) { throw ATC_Error("can not create Ensight case file"); } diff --git a/lib/atc/OutputManager.h b/lib/atc/OutputManager.h index c5a901e9f4..4454d65265 100644 --- a/lib/atc/OutputManager.h +++ b/lib/atc/OutputManager.h @@ -52,13 +52,13 @@ namespace ATC { coordinates : num _total_ points/nodes X num spatial dim connectivities : num elements X num nodes per element*/ void write_geometry(const MATRIX *coordinates, - const Array2D *connectivity=NULL); + const Array2D *connectivity=nullptr); /** write data from a time step specify node_map to handle periodic soln & data */ - void write_data(double time, OUTPUT_LIST *data, const int *node_map=NULL); + void write_data(double time, OUTPUT_LIST *data, const int *node_map=nullptr); void write_data(double time, FIELDS *soln, OUTPUT_LIST *data, - const int *node_map=NULL); + const int *node_map=nullptr); /** add custom names for any field */ void add_field_names(const std::string& name, const std::vector& list) { diff --git a/lib/atc/PaqAtcUtility.cpp b/lib/atc/PaqAtcUtility.cpp index b6a2ed2871..bdcf269626 100644 --- a/lib/atc/PaqAtcUtility.cpp +++ b/lib/atc/PaqAtcUtility.cpp @@ -18,7 +18,7 @@ namespace ATC { AtomType atomType) : atc_(atc), atomType_(atomType), - myNlocal(NULL) + myNlocal(nullptr) { switch (atomType_) { case ALL: diff --git a/lib/atc/ParDenseMatrix.h b/lib/atc/ParDenseMatrix.h index 1c9e75f171..873bf0f410 100644 --- a/lib/atc/ParDenseMatrix.h +++ b/lib/atc/ParDenseMatrix.h @@ -148,7 +148,7 @@ namespace ATC_matrix { #endif // Clear out the local matrix's pointer so we don't double-free - A_local._data = NULL; + A_local._data = nullptr; delete [] majorCounts; delete [] offsets; diff --git a/lib/atc/ParSparseMatrix.cpp b/lib/atc/ParSparseMatrix.cpp index 69ab2453e1..77c8eb33d5 100644 --- a/lib/atc/ParSparseMatrix.cpp +++ b/lib/atc/ParSparseMatrix.cpp @@ -233,8 +233,8 @@ DenseMatrix ParSparseMatrix::transMat( SparseMatrix C_local = ((SparseMatrix)A_local) * B; // destroy newA intelligently - A_local._val = NULL; - A_local._ja = NULL; + A_local._val = nullptr; + A_local._ja = nullptr; // Add all the result vectors together on each processor. sumSparse(C_local, C); @@ -285,8 +285,8 @@ void ParSparseMatrix::partition( // Prepare an A_local matrix for deletion after it has been loaded with // data members from another matrix. void ParSparseMatrix::finalize() { - _val = NULL; - _ja = NULL; + _val = nullptr; + _ja = nullptr; } void ParSparseMatrix::operator=(const SparseMatrix &source) diff --git a/lib/atc/ParSparseMatrix.h b/lib/atc/ParSparseMatrix.h index 0985115d07..b2642e87be 100644 --- a/lib/atc/ParSparseMatrix.h +++ b/lib/atc/ParSparseMatrix.h @@ -135,9 +135,9 @@ namespace ATC_matrix { Avar.hasTemplate_ = Ap.hasTemplate_; // Avoid catastrophe - Ap._val = NULL; - Ap._ja = NULL; - Ap._ia = NULL; + Ap._val = nullptr; + Ap._ja = nullptr; + Ap._ia = nullptr; } diff --git a/lib/atc/PerAtomQuantity-inl.h b/lib/atc/PerAtomQuantity-inl.h index f95e5d306d..b570e7645b 100644 --- a/lib/atc/PerAtomQuantity-inl.h +++ b/lib/atc/PerAtomQuantity-inl.h @@ -24,8 +24,8 @@ namespace ATC { atomType_(atomType), nCols_(nCols), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL), - lammpsVector_(NULL) + lammpsScalar_(nullptr), + lammpsVector_(nullptr) { // do nothing } @@ -452,7 +452,7 @@ namespace ATC { lammpsInterface_(LammpsInterface::instance()), atomType_(atomType), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL) + lammpsScalar_(nullptr) { // do nothing } @@ -610,8 +610,8 @@ namespace ATC { nCols_(nCols), maxEntriesPerRow_(maxEntriesPerRow), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsVector_(NULL), - lammpsColIndices_(NULL) + lammpsVector_(nullptr), + lammpsColIndices_(nullptr) { // do nothing } diff --git a/lib/atc/PerAtomQuantity.h b/lib/atc/PerAtomQuantity.h index e6cb19981a..a822b6a9b6 100644 --- a/lib/atc/PerAtomQuantity.h +++ b/lib/atc/PerAtomQuantity.h @@ -441,10 +441,10 @@ namespace ATC { virtual void set_lammps_to_quantity() const {}; /** gets appropriate pointer for lammps data */ - virtual T * lammps_scalar() const {return NULL;}; + virtual T * lammps_scalar() const {return nullptr;}; /** gets appropriate pointer for lammps data */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; private: @@ -1452,10 +1452,10 @@ namespace ATC { virtual void set_quantity_to_lammps() const {}; /** gets appropriate data for lammps pointer */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; /** gets appropriate data for lammps pointer to column indices */ - virtual int ** lammps_column_indices() const {return NULL;}; + virtual int ** lammps_column_indices() const {return nullptr;}; private: diff --git a/lib/atc/PerAtomQuantityLibrary.h b/lib/atc/PerAtomQuantityLibrary.h index 0089df7855..3e3cb78e95 100644 --- a/lib/atc/PerAtomQuantityLibrary.h +++ b/lib/atc/PerAtomQuantityLibrary.h @@ -125,7 +125,7 @@ namespace ATC { // constructor AtomToElementMap(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -304,7 +304,7 @@ namespace ATC { // constructor AtomVolumeElement(ATC_Method * atc, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -349,7 +349,7 @@ namespace ATC { // constructor AtomVolumeRegion(ATC_Method * atc, - DENS_MAN * atomCoarseGrainingPositions = NULL, + DENS_MAN * atomCoarseGrainingPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -422,9 +422,9 @@ namespace ATC { // constructor AtomicMassWeightedDisplacement(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomReferencePositions = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomReferencePositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -462,8 +462,8 @@ namespace ATC { // constructor FluctuatingVelocity(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -497,8 +497,8 @@ namespace ATC { // constructor ChargeVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - FundamentalAtomQuantity * atomCharges = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + FundamentalAtomQuantity * atomCharges = nullptr, AtomType atomType = INTERNAL); // destructor @@ -532,8 +532,8 @@ namespace ATC { // constructor SpeciesVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - PerAtomQuantity * atomTypeVector = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + PerAtomQuantity * atomTypeVector = nullptr, AtomType atomType = INTERNAL); // destructor @@ -567,8 +567,8 @@ namespace ATC { // constructor AtomicMomentum(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -631,8 +631,8 @@ namespace ATC { // constructor TwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -670,8 +670,8 @@ namespace ATC { // constructor KineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -707,9 +707,9 @@ namespace ATC { // constructor FluctuatingKineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -747,9 +747,9 @@ namespace ATC { // constructor TwiceFluctuatingKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -793,8 +793,8 @@ namespace ATC { MixedKePeEnergy(ATC_Method * atc, double keMultiplier, double peMultiplier, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -838,8 +838,8 @@ namespace ATC { // constructor TotalEnergy(ATC_Method * atc, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -871,8 +871,8 @@ namespace ATC { // constructor FluctuatingPotentialEnergy(ATC_Method * atc, - PerAtomQuantity * potentialEnergy = NULL, - PerAtomQuantity * referencePotential = NULL, + PerAtomQuantity * potentialEnergy = nullptr, + PerAtomQuantity * referencePotential = nullptr, AtomType atomType = INTERNAL); // destructor @@ -911,8 +911,8 @@ namespace ATC { // constructor DotTwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomForces = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomForces = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -948,7 +948,7 @@ namespace ATC { // constructor VelocitySquared(ATC_Method *atc, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -981,9 +981,9 @@ namespace ATC { // constructor LambdaSquared(ATC_Method *atc, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1149,7 +1149,7 @@ namespace ATC { // constructor AtomToNodeset(ATC_Method * atc, SetDependencyManager * subsetNodes, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1194,7 +1194,7 @@ namespace ATC { // constructor AtomToElementset(ATC_Method * atc, MatrixDependencyManager * elementMask, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1273,7 +1273,7 @@ namespace ATC { // constructor VelocitySquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1307,9 +1307,9 @@ namespace ATC { // constructor LambdaSquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1371,7 +1371,7 @@ namespace ATC { // constructor AtomicVelocityRescaleFactor(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1403,8 +1403,8 @@ namespace ATC { // constructor AtomicFluctuatingVelocityRescaled(ATC_Method * atc, - PerAtomQuantity * atomRescaleFactor = NULL, - PerAtomQuantity * atomFluctuatingVelocity = NULL, + PerAtomQuantity * atomRescaleFactor = nullptr, + PerAtomQuantity * atomFluctuatingVelocity = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1439,10 +1439,10 @@ namespace ATC { // constructor AtomicCombinedRescaleThermostatError(ATC_Method * atc, - PerAtomQuantity * atomFluctuatingMomentumRescaled = NULL, - PerAtomQuantity * atomMeanVelocity = NULL, - PerAtomQuantity * atomStreamingVelocity = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomFluctuatingMomentumRescaled = nullptr, + PerAtomQuantity * atomMeanVelocity = nullptr, + PerAtomQuantity * atomStreamingVelocity = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1483,8 +1483,8 @@ namespace ATC { // constructor AtomicThermostatForce(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomLambdas = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1519,8 +1519,8 @@ namespace ATC { // constructor AtomicKinetostatForceDisplacement(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1558,8 +1558,8 @@ namespace ATC { // constructor AtomicKinetostatForceVelocity(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL) : AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {}; @@ -1589,7 +1589,7 @@ namespace ATC { // constructor AtomicKinetostatForceStress(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, + PerAtomQuantity * atomLambda = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1621,7 +1621,7 @@ namespace ATC { // constructor PerAtomKernelFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1656,8 +1656,8 @@ namespace ATC { // constructor PerAtomShapeFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomElements = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomElements = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1695,8 +1695,8 @@ namespace ATC { // constructor LambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LambdaCouplingMatrix() { @@ -1734,9 +1734,9 @@ namespace ATC { // constructor LocalLambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * lambdaAtomMap = NULL, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * lambdaAtomMap = nullptr, + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LocalLambdaCouplingMatrix() { @@ -1771,7 +1771,7 @@ namespace ATC { GhostCouplingMatrix(ATC_Method * atc, SPAR_MAN * shapeFunction, SetDependencyManager * subsetNodes, - MatrixDependencyManager * nodeToOverlapMap = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr); // destructor virtual ~GhostCouplingMatrix() { diff --git a/lib/atc/PerPairQuantity.cpp b/lib/atc/PerPairQuantity.cpp index 3632a87aa9..01308e4b39 100644 --- a/lib/atc/PerPairQuantity.cpp +++ b/lib/atc/PerPairQuantity.cpp @@ -272,7 +272,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface, BondMatrix(lammpsInterface,pairMap,x,feMesh), kernelFunction_(kernelFunction) { - if (kernelFunction_ == NULL) + if (kernelFunction_ == nullptr) throw ATC_Error("No AtC kernel function initialized"); }; void BondMatrixKernel::reset(void) const diff --git a/lib/atc/PhysicsModel.h b/lib/atc/PhysicsModel.h index 50b327ce0b..8479727a89 100644 --- a/lib/atc/PhysicsModel.h +++ b/lib/atc/PhysicsModel.h @@ -105,7 +105,7 @@ namespace ATC const WeakEquation * weak_equation(FieldName field) const { std::map::const_iterator itr = weakEqns_.find(field); - if (itr == weakEqns_.end()) return NULL; + if (itr == weakEqns_.end()) return nullptr; return (weakEqns_.find(field))->second; } diff --git a/lib/atc/PoissonSolver.cpp b/lib/atc/PoissonSolver.cpp index 86670ae218..52909fc454 100644 --- a/lib/atc/PoissonSolver.cpp +++ b/lib/atc/PoissonSolver.cpp @@ -33,9 +33,9 @@ PoissonSolver::PoissonSolver( fieldName_(fieldName), rhsMask_(rhsMask), linear_(false), - solver_(NULL), - solverNL_(NULL), - tangent_(NULL), + solver_(nullptr), + solverNL_(nullptr), + tangent_(nullptr), solverType_(solverType), solverTol_(0), solverMaxIter_(0), diff --git a/lib/atc/PrescribedDataManager.cpp b/lib/atc/PrescribedDataManager.cpp index bd649c8ace..947191a0e4 100644 --- a/lib/atc/PrescribedDataManager.cpp +++ b/lib/atc/PrescribedDataManager.cpp @@ -34,8 +34,8 @@ namespace ATC { bcs_[thisField].reset(nNodes_,thisSize); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < thisSize ; ++idof) { - ics_[thisField](inode,idof) = NULL; - bcs_[thisField](inode,idof) = NULL; + ics_[thisField](inode,idof) = nullptr; + bcs_[thisField](inode,idof) = nullptr; } } // compact inode, value lists @@ -44,7 +44,7 @@ namespace ATC { elementSources_[thisField].reset(nElems_,thisSize); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < thisSize ; ++idof) { - elementSources_[thisField](ielem,idof) = NULL; + elementSources_[thisField](ielem,idof) = nullptr; } } // node based sources @@ -76,8 +76,8 @@ namespace ATC { bcs_[fieldName].reset(nNodes_,size); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < size ; ++idof) { - ics_[fieldName](inode,idof) = NULL; - bcs_[fieldName](inode,idof) = NULL; + ics_[fieldName](inode,idof) = nullptr; + bcs_[fieldName](inode,idof) = nullptr; } } @@ -85,7 +85,7 @@ namespace ATC { elementSources_[fieldName].reset(nElems_,size); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < size ; ++idof) { - elementSources_[fieldName](ielem,idof) = NULL; + elementSources_[fieldName](ielem,idof) = nullptr; } } } @@ -159,7 +159,7 @@ namespace ATC { set::const_iterator iset; for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) { int inode = *iset; - bcs_[thisField](inode,thisIndex) = NULL; + bcs_[thisField](inode,thisIndex) = nullptr; } } @@ -182,7 +182,7 @@ namespace ATC { const FieldName thisField, const int thisIndex) { - bcs_[thisField](nodeId,thisIndex) = NULL; + bcs_[thisField](nodeId,thisIndex) = nullptr; } //------------------------------------------------------------------------- // fix_flux @@ -203,7 +203,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (XT_Function*) f; } @@ -222,7 +222,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < XT_Function * > & dof = faceSources_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -244,7 +244,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (UXT_Function*) f; } @@ -263,7 +263,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -342,7 +342,7 @@ namespace ATC { set::const_iterator iset; for (iset = elemSet.begin(); iset != elemSet.end(); iset++) { int ielem = *iset; - elementSources_[thisField](ielem,thisIndex) = NULL; + elementSources_[thisField](ielem,thisIndex) = nullptr; } } //------------------------------------------------------------------------- diff --git a/lib/atc/Quadrature.cpp b/lib/atc/Quadrature.cpp index 8efe0e2969..94fe4a701c 100644 --- a/lib/atc/Quadrature.cpp +++ b/lib/atc/Quadrature.cpp @@ -5,14 +5,14 @@ using namespace std; namespace ATC { -Quadrature * Quadrature::myInstance_ = NULL; +Quadrature * Quadrature::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- Quadrature * Quadrature::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new Quadrature(); } return myInstance_; @@ -24,7 +24,7 @@ Quadrature * Quadrature::instance() void Quadrature::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } diff --git a/lib/atc/SchrodingerSolver.cpp b/lib/atc/SchrodingerSolver.cpp index d79fa85595..3819562a70 100644 --- a/lib/atc/SchrodingerSolver.cpp +++ b/lib/atc/SchrodingerSolver.cpp @@ -646,7 +646,7 @@ double fermi_dirac(const double E, const double T) double mu, double D ) : SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0), - solver_(NULL), + solver_(nullptr), mobility_(mu),diffusivity_(D) { Ef0_ = Ef0; diff --git a/lib/atc/SparseMatrix-inl.h b/lib/atc/SparseMatrix-inl.h index 36867ad8de..2923d6daa5 100644 --- a/lib/atc/SparseMatrix-inl.h +++ b/lib/atc/SparseMatrix-inl.h @@ -17,14 +17,14 @@ TRI_COORD::TRI_COORD(INDEX row, INDEX col, T val, bool add_to) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(INDEX rows, INDEX cols) - : _val(NULL), _ia(NULL), _ja(NULL), _size(0), _nRowsCRS(0), hasTemplate_(false), + : _val(nullptr), _ia(nullptr), _ja(nullptr), _size(0), _nRowsCRS(0), hasTemplate_(false), _nRows(rows),_nCols(cols) {} //----------------------------------------------------------------------------- // copy constructor //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const SparseMatrix& C) - : Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) + : Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { _copy(C); } @@ -33,7 +33,7 @@ SparseMatrix::SparseMatrix(const SparseMatrix& C) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const DenseMatrix& C) -: Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) +: Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { reset(C); } @@ -67,9 +67,9 @@ void SparseMatrix::_create(INDEX size, INDEX nrows) // assign memory to hold matrix try { - _val = (_size && nrows) ? new T [_size] : NULL; - _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : NULL; - _ja = (_size && nrows) ? new INDEX [_size] : NULL; + _val = (_size && nrows) ? new T [_size] : nullptr; + _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : nullptr; + _ja = (_size && nrows) ? new INDEX [_size] : nullptr; } catch (std::exception &e) { @@ -94,8 +94,8 @@ void SparseMatrix::_delete() if (_ia) delete [] _ia; if (_ja) delete [] _ja; _size = _nRowsCRS = 0; - _val = NULL; - _ia = _ja = NULL; + _val = nullptr; + _ia = _ja = nullptr; } //----------------------------------------------------------------------------- // full memory copy of C into this diff --git a/lib/atc/SparseVector.h b/lib/atc/SparseVector.h index 5cb16af527..d387b45b66 100644 --- a/lib/atc/SparseVector.h +++ b/lib/atc/SparseVector.h @@ -88,7 +88,7 @@ protected: //@{ SparseVector(const Matrix &c); SparseVector& operator=(Matrix &c); - T* ptr() const {return NULL; } + T* ptr() const {return nullptr; } //@} STORE data_; //*> sparse data structure diff --git a/lib/atc/SpeciesTimeIntegrator.cpp b/lib/atc/SpeciesTimeIntegrator.cpp index 3a196e745a..3215b159f8 100644 --- a/lib/atc/SpeciesTimeIntegrator.cpp +++ b/lib/atc/SpeciesTimeIntegrator.cpp @@ -108,9 +108,9 @@ namespace ATC { timeFilter_(speciesTimeIntegrator->time_filter()), massDensity_(atc_->field(MASS_DENSITY)), nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)), - nodalAtomicMassDensity_(NULL), + nodalAtomicMassDensity_(nullptr), speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)), - nodalAtomicSpeciesConcentration_(NULL), + nodalAtomicSpeciesConcentration_(nullptr), nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()), moleculeIds_(moleculeIds) { diff --git a/lib/atc/SpeciesTimeIntegrator.h b/lib/atc/SpeciesTimeIntegrator.h index c8fbe97c5e..64cc07022c 100644 --- a/lib/atc/SpeciesTimeIntegrator.h +++ b/lib/atc/SpeciesTimeIntegrator.h @@ -71,7 +71,7 @@ namespace ATC { const std::map > & moleculeIds); // destructor - virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=NULL;}; + virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=nullptr;}; /** create and get necessary transfer operators */ virtual void construct_transfers(); diff --git a/lib/atc/Stress.cpp b/lib/atc/Stress.cpp index 72656c21ed..a1445bd8ea 100644 --- a/lib/atc/Stress.cpp +++ b/lib/atc/Stress.cpp @@ -299,10 +299,10 @@ void StressCubicElasticDamped::stress(const FIELD_MATS &fields, // cauchy born model //============================================================================== StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb) - : cblattice_(NULL), - potential_(NULL), + : cblattice_(nullptr), + potential_(nullptr), makeLinear_(false), - cubicMat_(NULL), + cubicMat_(nullptr), initialized_(false), fixed_temperature_(0.), cbdata_(cb) diff --git a/lib/atc/Stress.h b/lib/atc/Stress.h index 513cdb2d97..5a7c9e30a3 100644 --- a/lib/atc/Stress.h +++ b/lib/atc/Stress.h @@ -149,7 +149,7 @@ namespace ATC { DENS_VEC elasticity_tensor(const VECTOR &Fv, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; DENS_VEC elasticity_tensor(const MATRIX &F, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; protected: - void linearize(MATRIX *F=NULL); + void linearize(MATRIX *F=nullptr); CBLattice *cblattice_; //*> CbLattice -> makes atom clusters. CbPotential *potential_; //*> CbPotential -> interatomic forces. bool makeLinear_; diff --git a/lib/atc/ThermalTimeIntegrator.cpp b/lib/atc/ThermalTimeIntegrator.cpp index e74d46a20c..8c0b8d6dae 100644 --- a/lib/atc/ThermalTimeIntegrator.cpp +++ b/lib/atc/ThermalTimeIntegrator.cpp @@ -150,7 +150,7 @@ namespace ATC { temperatureRoc_(atc_->field_roc(TEMPERATURE)), temperature2Roc_(atc_->field_2roc(TEMPERATURE)), nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)), - nodalAtomicTemperature_(NULL), + nodalAtomicTemperature_(nullptr), temperatureRhs_(atc_->field_rhs(TEMPERATURE)), nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE)) { @@ -384,7 +384,7 @@ namespace ATC { nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()), nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()), atomicTemperatureDelta_(atc_->num_nodes(),1), - nodalAtomicEnergy_(NULL), + nodalAtomicEnergy_(nullptr), nodalAtomicEnergyOld_(atc_->num_nodes(),1), nodalAtomicTemperatureOld_(atc_->num_nodes(),1) { diff --git a/lib/atc/Thermostat.cpp b/lib/atc/Thermostat.cpp index a602105854..217f2394e2 100644 --- a/lib/atc/Thermostat.cpp +++ b/lib/atc/Thermostat.cpp @@ -367,7 +367,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL) + atomVelocities_(nullptr) { fieldMask_(TEMPERATURE,FLUX) = true; lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1); // data associated with stage 3 in ATC_Method::initialize @@ -425,7 +425,7 @@ namespace ATC { ThermostatRescale::ThermostatRescale(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), nodalTemperature_(atc_->field(TEMPERATURE)), - atomVelocityRescalings_(NULL) + atomVelocityRescalings_(nullptr) { // do nothing } @@ -535,7 +535,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - nodalAtomicFluctuatingPotentialEnergy_(NULL) + nodalAtomicFluctuatingPotentialEnergy_(nullptr) { // do nothing } @@ -607,7 +607,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), lambdaMaxIterations_(lambdaMaxIterations), - rhsLambdaSquared_(NULL), + rhsLambdaSquared_(nullptr), dtFactor_(1.) { fieldMask_(TEMPERATURE,FLUX) = true; @@ -741,21 +741,21 @@ namespace ATC { int /* lambdaMaxIterations */, const string & regulatorPrefix) : RegulatorMethod(thermostat,regulatorPrefix), - lambdaSolver_(NULL), + lambdaSolver_(nullptr), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL), + atomVelocities_(nullptr), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomLambdas_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomLambdas_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), isFirstTimestep_(true), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL) + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1); @@ -1389,7 +1389,7 @@ namespace ATC { int lambdaMaxIterations, const string & regulatorPrefix) : ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix), - atomThermostatForcesPredVel_(NULL), + atomThermostatForcesPredVel_(nullptr), filterCoefficient_(1.) { lambdaSolver_ = new ThermostatSolverFixed(thermostat, @@ -1887,9 +1887,9 @@ namespace ATC { int lambdaMaxIterations, bool constructThermostats) : RegulatorMethod(thermostat), - thermostatFlux_(NULL), - thermostatFixed_(NULL), - thermostatBcs_(NULL) + thermostatFlux_(nullptr), + thermostatFixed_(nullptr), + thermostatBcs_(nullptr) { if (constructThermostats) { thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux"); @@ -2022,10 +2022,10 @@ namespace ATC { ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), timeFilter_(atomicRegulator_->time_filter()), - lambdaPowerFiltered_(NULL), - atomThermostatForces_(NULL), + lambdaPowerFiltered_(nullptr), + atomThermostatForces_(nullptr), prescribedDataMgr_(atc_->prescribed_data_manager()), - atomMasses_(NULL) + atomMasses_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1); @@ -2080,8 +2080,8 @@ namespace ATC { ThermostatGlc(thermostat), nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)), heatSource_(atc_->atomic_source(TEMPERATURE)), - nodalAtomicPower_(NULL), - nodalAtomicLambdaPower_(NULL) + nodalAtomicPower_(nullptr), + nodalAtomicLambdaPower_(nullptr) { // do nothing } @@ -2287,8 +2287,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) : ThermostatPowerVerlet(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // set up data consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1); @@ -2505,8 +2505,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) : ThermostatPowerVerletFiltered(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1); diff --git a/lib/atc/TimeFilter.cpp b/lib/atc/TimeFilter.cpp index 08cb64c8fe..ece3429c86 100644 --- a/lib/atc/TimeFilter.cpp +++ b/lib/atc/TimeFilter.cpp @@ -210,7 +210,7 @@ namespace ATC { } else if (filterType_ == STEP_FILTER) { newTimeFilter = new TimeFilterStep(*this); - } else newTimeFilter = NULL; + } else newTimeFilter = nullptr; } else { // default to return base class newTimeFilter = new TimeFilter(*this); diff --git a/lib/atc/TimeIntegrator.cpp b/lib/atc/TimeIntegrator.cpp index 4e8dec8c62..f370d17170 100644 --- a/lib/atc/TimeIntegrator.cpp +++ b/lib/atc/TimeIntegrator.cpp @@ -17,10 +17,10 @@ namespace ATC { AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) : atc_(atc), atomType_(atomType), - mass_(NULL), - position_(NULL), - velocity_(NULL), - force_(NULL) + mass_(nullptr), + position_(nullptr), + velocity_(nullptr), + force_(nullptr) { // do nothing } @@ -90,9 +90,9 @@ namespace ATC { //-------------------------------------------------------- TimeIntegrator::TimeIntegrator(ATC_Coupling * atc, TimeIntegrationType timeIntegrationType) : - timeIntegrationMethod_(NULL), + timeIntegrationMethod_(nullptr), atc_(atc), - timeFilter_(NULL), + timeFilter_(nullptr), timeFilterManager_(atc_->time_filter_manager()), timeIntegrationType_(timeIntegrationType), needReset_(true) diff --git a/lib/atc/TransferLibrary.cpp b/lib/atc/TransferLibrary.cpp index d0db0076d7..b77a91fd2e 100644 --- a/lib/atc/TransferLibrary.cpp +++ b/lib/atc/TransferLibrary.cpp @@ -816,7 +816,7 @@ namespace ATC { for (unsigned i = 0; i < quantity_.size(); ++i) { if (quantity_[i]) delete quantity_[i]; } - quantity_.resize(source.size(),NULL); + quantity_.resize(source.size(),nullptr); for (unsigned i = 0; i < source.size(); i++) { quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols()); } @@ -1363,7 +1363,7 @@ namespace ATC { { pointToElementMap_->register_dependence(this); pointPositions_->register_dependence(this); - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } @@ -1428,7 +1428,7 @@ namespace ATC { atomPositions_->register_dependence(this); // storage container - matrices_.resize(atc->nsd(),NULL); + matrices_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { matrices_[i] = new AtcAtomSparseMatrix(atc,feEngine_->num_nodes(), feEngine_->num_nodes_per_element(), @@ -1440,7 +1440,7 @@ namespace ATC { matrices_[i]->register_dependence(this); } - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); } //-------------------------------------------------------- @@ -1926,7 +1926,7 @@ namespace ATC { VectorTransfer(), feEngine_(atc->fe_engine()) { - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } diff --git a/lib/atc/TransferLibrary.h b/lib/atc/TransferLibrary.h index 3a0f420f37..d1f27e5e6d 100644 --- a/lib/atc/TransferLibrary.h +++ b/lib/atc/TransferLibrary.h @@ -115,7 +115,7 @@ namespace ATC { // constructor NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction, - PerAtomQuantity * atomElement=NULL); + PerAtomQuantity * atomElement=nullptr); // destructor virtual ~NodalAtomVolumeElement() { @@ -173,7 +173,7 @@ namespace ATC { // constructor AtomTypeElement(ATC_Coupling * atc, - PerAtomQuantity * atomElement = NULL); + PerAtomQuantity * atomElement = nullptr); // destructor virtual ~AtomTypeElement() { @@ -211,8 +211,8 @@ namespace ATC { // constructor ElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~ElementMask() { @@ -251,7 +251,7 @@ namespace ATC { // constructor AtomElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasAtoms = NULL); + MatrixDependencyManager * hasAtoms = nullptr); // destructor virtual ~AtomElementMask() { @@ -287,8 +287,8 @@ namespace ATC { // constructor NodalGeometryType(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~NodalGeometryType() { @@ -338,7 +338,7 @@ namespace ATC { // constructor NodalGeometryTypeElementSet(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL); + MatrixDependencyManager * hasInternal = nullptr); // destructor virtual ~NodalGeometryTypeElementSet() { @@ -659,7 +659,7 @@ namespace ATC { // constructor RegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL); + MatrixDependencyManager * nodalGeometryType = nullptr); // destructor virtual ~RegulatedNodes() { @@ -721,7 +721,7 @@ namespace ATC { // constructor FluxNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -751,7 +751,7 @@ namespace ATC { // constructor BoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -781,7 +781,7 @@ namespace ATC { // constructor FluxBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -811,7 +811,7 @@ namespace ATC { // constructor AllRegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -841,7 +841,7 @@ namespace ATC { // constructor FixedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -871,7 +871,7 @@ namespace ATC { // constructor FixedBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FixedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -1052,8 +1052,8 @@ namespace ATC { // constructor PerAtomShapeFunctionGradient(ATC_Method * atc, - MatrixDependencyManager* atomToElementMap = NULL, - DENS_MAN* atomPositions = NULL, + MatrixDependencyManager* atomToElementMap = nullptr, + DENS_MAN* atomPositions = nullptr, const std::string & tag = "AtomicShapeFunctionGradient", AtomType atomType = INTERNAL); diff --git a/lib/atc/TransferOperator.h b/lib/atc/TransferOperator.h index 5f776d04ca..5cf578b77c 100644 --- a/lib/atc/TransferOperator.h +++ b/lib/atc/TransferOperator.h @@ -542,7 +542,7 @@ namespace ATC { AtfProjection(ATC_Method * atc, PerAtomQuantity * source, SPAR_MAN * accumulant, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjection(); @@ -587,7 +587,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, const double scale, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionScaled(); @@ -620,7 +620,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, DENS_MAN * reference, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionReferenced(); diff --git a/lib/atc/Utility.h b/lib/atc/Utility.h index 2c0ea7270f..6693df9323 100644 --- a/lib/atc/Utility.h +++ b/lib/atc/Utility.h @@ -226,7 +226,7 @@ namespace ATC_Utility { char *endptr; strtod(s.c_str(), &endptr); - if(endptr != NULL && *endptr == '\0') return true; + if(endptr != nullptr && *endptr == '\0') return true; return false; } diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 7bf6125bc6..2eebfcc0ce 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(NULL),next(NULL){ + :descriptor(descriptor_),prev(nullptr),next(nullptr){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=NULL; - prev=NULL; + glogp->next=nullptr; + prev=nullptr; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index c29f72773f..0f79fc4184 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(NULL,1) { + recmatrix(): parr(nullptr,1) { sizey=sizex=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(NULL,1) { + sqmatrix(): parr(nullptr,1) { size=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(NULL){ + sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not NULL, puts the found value there - virtual int Find(long i, long j, T *retval=NULL)=0; - virtual int Find(long i, long j, T **retval=NULL)=0; + //e if retval is not nullptr, puts the found value there + virtual int Find(long i, long j, T *retval=nullptr)=0; + virtual int Find(long i, long j, T **retval=nullptr)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=NULL){ + int Find(long i, long j, T *retval=nullptr){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index a1a4feb0ff..8e5fc7df45 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=NULL, int managed=0){ + void reset(T* ptr=nullptr, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==NULL than p is not managed (as in mngptr) + int *num; //if num==nullptr than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=NULL; + else num=nullptr; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } public: - shptr(T* p=NULL, int managed=1){ + shptr(T* p=nullptr, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=NULL; + num=nullptr; } - p=NULL; + p=nullptr; } } bool valid() const { - return p!=NULL; + return p!=nullptr; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 468abbda99..534cea44aa 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=NULL) const { + T maxcoord(int *ind=nullptr) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 7e82af0f65..6e809dd65c 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=NULL; +message_logger *message_logger::glogp=nullptr; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index e118b76f36..4c65440014 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ + void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=NULL )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); + /// Default (q=nullptr )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=NULL); + virtual int interaction_ii(int flag,Vector_3P fi=nullptr); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 2c58bdaf28..55105066de 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be NULL, \n +/// will not update electronic force arrays, which may be nullptr, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 44fb757576..0ffef2645d 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); + /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be NULL, \n + /// will not update electronic force arrays, which may be nullptr, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index 1002dc35d8..61e83f44ab 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -22,7 +22,7 @@ colvar::colvar() { - runave_os = NULL; + runave_os = nullptr; prev_timestep = -1L; after_restart = false; @@ -62,7 +62,7 @@ int colvar::init(std::string const &conf) get_keyval(conf, "name", this->name, (std::string("colvar")+cvm::to_str(cv->variables()->size()))); - if ((cvm::colvar_by_name(this->name) != NULL) && + if ((cvm::colvar_by_name(this->name) != nullptr) && (cvm::colvar_by_name(this->name) != this)) { cvm::error("Error: this colvar cannot have the same name, \""+this->name+ "\", as another colvar.\n", @@ -744,7 +744,7 @@ template int colvar::init_components_type(std::string c : ".\n")); cvm::increase_depth(); cvc *cvcp = new def_class_name(def_conf); - if (cvcp != NULL) { + if (cvcp != nullptr) { cvcs.push_back(cvcp); cvcp->check_keywords(def_conf, def_config_key); cvcp->config_key = def_config_key; @@ -994,7 +994,7 @@ int colvar::parse_analysis(std::string const &conf) acf_type = acf_vel; enable(f_cv_fdiff_velocity); colvar *cv2 = cvm::colvar_by_name(acf_colvar_name); - if (cv2 == NULL) { + if (cv2 == nullptr) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -1215,14 +1215,14 @@ colvar::~colvar() for (std::vector::iterator cei = value_evaluators.begin(); cei != value_evaluators.end(); ++cei) { - if (*cei != NULL) delete (*cei); + if (*cei != nullptr) delete (*cei); } value_evaluators.clear(); for (std::vector::iterator gei = gradient_evaluators.begin(); gei != gradient_evaluators.end(); ++gei) { - if (*gei != NULL) delete (*gei); + if (*gei != nullptr) delete (*gei); } gradient_evaluators.clear(); #endif @@ -1972,7 +1972,7 @@ void const *colvar::get_cvc_param_ptr(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return NULL; + return nullptr; } @@ -1983,7 +1983,7 @@ colvarvalue const *colvar::get_cvc_param_grad(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param_grad() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return NULL; + return nullptr; } @@ -2422,7 +2422,7 @@ int colvar::calc_acf() // the pointer to each vector is changed at every step colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name); - if (cfcv == NULL) { + if (cfcv == nullptr) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -2660,7 +2660,7 @@ int colvar::calc_runave() if ((*x_history_p).size() >= runave_length-1) { - if (runave_os == NULL) { + if (runave_os == nullptr) { if (runave_outfile.size() == 0) { runave_outfile = std::string(cvm::output_prefix()+"."+ this->name+".runave.traj"); diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index 180fc69a85..2796f3d28b 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -105,7 +105,7 @@ cvm::atom_group::~atom_group() if (fitting_group) { delete fitting_group; - fitting_group = NULL; + fitting_group = nullptr; } cvm::main()->unregister_named_atom_group(this); @@ -217,7 +217,7 @@ int cvm::atom_group::init() b_center = false; b_rotate = false; b_user_defined_fit = false; - fitting_group = NULL; + fitting_group = nullptr; noforce = false; @@ -368,7 +368,7 @@ int cvm::atom_group::parse(std::string const &group_conf) // Optional group name will let other groups reuse atom definition if (get_keyval(group_conf, "name", name)) { - if ((cvm::atom_group_by_name(this->name) != NULL) && + if ((cvm::atom_group_by_name(this->name) != nullptr) && (cvm::atom_group_by_name(this->name) != this)) { cvm::error("Error: this atom group cannot have the same name, \""+this->name+ "\", as another atom group.\n", @@ -395,7 +395,7 @@ int cvm::atom_group::parse(std::string const &group_conf) std::string atoms_of = ""; if (get_keyval(group_conf, "atomsOfGroup", atoms_of)) { atom_group * ag = atom_group_by_name(atoms_of); - if (ag == NULL) { + if (ag == nullptr) { cvm::error("Error: cannot find atom group with name " + atoms_of + ".\n"); return COLVARS_ERROR; } diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index 09bcca01b5..cdbc13699b 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -47,7 +47,7 @@ int colvarbias::init(std::string const &conf) { colvarbias *bias_with_name = cvm::bias_by_name(this->name); - if (bias_with_name != NULL) { + if (bias_with_name != nullptr) { if ((bias_with_name->rank != this->rank) || (bias_with_name->bias_type != this->bias_type)) { cvm::error("Error: this bias cannot have the same name, \""+this->name+ @@ -295,8 +295,8 @@ int colvarbias::update() colvar_values[i] = colvars[i]->value(); } - error_code |= calc_energy(NULL); - error_code |= calc_forces(NULL); + error_code |= calc_energy(nullptr); + error_code |= calc_forces(nullptr); return error_code; } @@ -547,8 +547,8 @@ colvarbias_ti::colvarbias_ti(char const *key) : colvarbias(key) { provide(f_cvb_calc_ti_samples); - ti_avg_forces = NULL; - ti_count = NULL; + ti_avg_forces = nullptr; + ti_count = nullptr; } @@ -560,13 +560,13 @@ colvarbias_ti::~colvarbias_ti() int colvarbias_ti::clear_state_data() { - if (ti_avg_forces != NULL) { + if (ti_avg_forces != nullptr) { delete ti_avg_forces; - ti_avg_forces = NULL; + ti_avg_forces = nullptr; } - if (ti_count != NULL) { + if (ti_count != nullptr) { delete ti_count; - ti_count = NULL; + ti_count = nullptr; } return COLVARS_OK; } @@ -622,7 +622,7 @@ int colvarbias_ti::init(std::string const &conf) int colvarbias_ti::init_grids() { if (is_enabled(f_cvb_calc_ti_samples)) { - if (ti_avg_forces == NULL) { + if (ti_avg_forces == nullptr) { ti_bin.resize(num_variables()); ti_system_forces.resize(num_variables()); for (size_t icv = 0; icv < num_variables(); icv++) { @@ -643,7 +643,7 @@ int colvarbias_ti::init_grids() int colvarbias_ti::update() { - return update_system_forces(NULL); + return update_system_forces(nullptr); } @@ -679,7 +679,7 @@ int colvarbias_ti::update_system_forces(std::vector const ti_system_forces[i] = variables(i)->total_force(); } else { ti_system_forces[i] = variables(i)->total_force() - - ((subtract_forces != NULL) ? + ((subtract_forces != nullptr) ? (*subtract_forces)[i] : previous_colvar_forces[i]); } } @@ -759,7 +759,7 @@ int colvarbias_ti::write_output_files() std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name; - std::ostream *os = NULL; + std::ostream *os = nullptr; if (is_enabled(f_cvb_write_ti_samples)) { std::string const ti_count_file_name(ti_output_prefix+".ti.count"); diff --git a/lib/colvars/colvarbias.h b/lib/colvars/colvarbias.h index 5179c42853..20c346f81c 100644 --- a/lib/colvars/colvarbias.h +++ b/lib/colvars/colvarbias.h @@ -58,12 +58,12 @@ public: virtual int update(); /// Compute the energy of the bias - /// Uses the vector of colvar values provided if not NULL, and the values + /// Uses the vector of colvar values provided if not nullptr, and the values /// currently cached in the bias instance otherwise virtual int calc_energy(std::vector const *values); /// Compute the forces due to the bias - /// Uses the vector of colvar values provided if not NULL, and the values + /// Uses the vector of colvar values provided if not nullptr, and the values /// currently cached in the bias instance otherwise virtual int calc_forces(std::vector const *values); diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index 5382a828f7..9926579a8d 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -18,16 +18,16 @@ colvarbias_abf::colvarbias_abf(char const *key) b_UI_estimator(false), b_CZAR_estimator(false), pabf_freq(0), - system_force(NULL), - gradients(NULL), - samples(NULL), - pmf(NULL), - z_gradients(NULL), - z_samples(NULL), - czar_gradients(NULL), - czar_pmf(NULL), - last_gradients(NULL), - last_samples(NULL) + system_force(nullptr), + gradients(nullptr), + samples(nullptr), + pmf(nullptr), + z_gradients(nullptr), + z_samples(nullptr), + czar_gradients(nullptr), + czar_pmf(nullptr), + last_gradients(nullptr), + last_samples(nullptr) { } @@ -261,37 +261,37 @@ colvarbias_abf::~colvarbias_abf() { if (samples) { delete samples; - samples = NULL; + samples = nullptr; } if (gradients) { delete gradients; - gradients = NULL; + gradients = nullptr; } if (pmf) { delete pmf; - pmf = NULL; + pmf = nullptr; } if (z_samples) { delete z_samples; - z_samples = NULL; + z_samples = nullptr; } if (z_gradients) { delete z_gradients; - z_gradients = NULL; + z_gradients = nullptr; } if (czar_gradients) { delete czar_gradients; - czar_gradients = NULL; + czar_gradients = nullptr; } if (czar_pmf) { delete czar_pmf; - czar_pmf = NULL; + czar_pmf = nullptr; } // shared ABF @@ -299,17 +299,17 @@ colvarbias_abf::~colvarbias_abf() // but now we can call shared externally if (last_samples) { delete last_samples; - last_samples = NULL; + last_samples = nullptr; } if (last_gradients) { delete last_gradients; - last_gradients = NULL; + last_gradients = nullptr; } if (system_force) { delete [] system_force; - system_force = NULL; + system_force = nullptr; } } @@ -488,7 +488,7 @@ int colvarbias_abf::update() } /// Add the bias energy for 1D ABF - bias_energy = calc_energy(NULL); + bias_energy = calc_energy(nullptr); return COLVARS_OK; } diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 92985b0f61..44862ba256 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -15,7 +15,7 @@ colvarbias_histogram::colvarbias_histogram(char const *key) : colvarbias(key), - grid(NULL), out_name("") + grid(nullptr), out_name("") { provide(f_cvb_bypass_ext_lagrangian); // Allow histograms of actual cv for extended-Lagrangian } @@ -105,7 +105,7 @@ colvarbias_histogram::~colvarbias_histogram() { if (grid) { delete grid; - grid = NULL; + grid = nullptr; } } diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 05f293d872..03c1886a8f 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key) : colvarbias(key), colvarbias_ti(key) { new_hills_begin = hills.end(); - hills_traj_os = NULL; + hills_traj_os = nullptr; hill_width = 0.0; @@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key) use_grids = true; grids_freq = 0; rebin_grids = false; - hills_energy = NULL; - hills_energy_gradients = NULL; + hills_energy = nullptr; + hills_energy_gradients = nullptr; dump_fes = true; keep_hills = false; @@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf) get_keyval(conf, "keepHills", keep_hills, keep_hills); get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save); - if (hills_energy == NULL) { + if (hills_energy == nullptr) { hills_energy = new colvar_grid_scalar(colvars); hills_energy_gradients = new colvar_grid_gradient(colvars); } @@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf) int colvarbias_meta::init_ebmeta_params(std::string const &conf) { // for ebmeta - target_dist = NULL; + target_dist = nullptr; get_keyval(conf, "ebMeta", ebmeta, false); if(ebmeta){ if (use_grids && expand_grids) { @@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta() if (hills_traj_os) { proxy->close_output_stream(hills_traj_file_name()); - hills_traj_os = NULL; + hills_traj_os = nullptr; } if (target_dist) { delete target_dist; - target_dist = NULL; + target_dist = nullptr; } } @@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data() { if (hills_energy) { delete hills_energy; - hills_energy = NULL; + hills_energy = nullptr; } if (hills_energy_gradients) { delete hills_energy_gradients; - hills_energy_gradients = NULL; + hills_energy_gradients = nullptr; } hills.clear(); @@ -451,8 +451,8 @@ int colvarbias_meta::update() error_code |= replica_share(); } - error_code |= calc_energy(NULL); - error_code |= calc_forces(NULL); + error_code |= calc_energy(nullptr); + error_code |= calc_forces(nullptr); return error_code; } @@ -593,7 +593,7 @@ int colvarbias_meta::update_bias() std::vector curr_bin = hills_energy->get_colvars_index(); hills_energy_sum_here = hills_energy->value(curr_bin); } else { - calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL); + calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr); } hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann())); } @@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first, std::vector colvar_forces_scalar(num_variables()); std::vector he_ix = he->new_index(); - std::vector hg_ix = (hg != NULL) ? hg->new_index() : std::vector (0); + std::vector hg_ix = (hg != nullptr) ? hg->new_index() : std::vector (0); cvm::real hills_energy_here = 0.0; std::vector hills_forces_here(num_variables(), 0.0); size_t count = 0; size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1))); - if (hg != NULL) { + if (hg != nullptr) { // loop over the points of the grid for ( ; @@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) hills_energy_gradients = new colvar_grid_gradient(colvars); } - colvar_grid_scalar *hills_energy_backup = NULL; - colvar_grid_gradient *hills_energy_gradients_backup = NULL; + colvar_grid_scalar *hills_energy_backup = nullptr; + colvar_grid_gradient *hills_energy_gradients_backup = nullptr; if (has_data) { if (cvm::debug()) @@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_pos = is.tellg(); std::string key; if (!(is >> key)) { - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == NULL) + if (hills_energy_backup == nullptr) cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_gradients_pos = is.tellg(); if (!(is >> key)) { - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_gradients_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == NULL) + if (hills_energy_backup == nullptr) cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n"); - if (hills_energy_backup != NULL) { + if (hills_energy_backup != nullptr) { // now that we have successfully updated the grids, delete the // backup copies if (cvm::debug()) @@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output() // TODO: one may want to specify the path manually for intricated filesystems? char *pwd = new char[3001]; - if (GETCWD(pwd, 3000) == NULL) + if (GETCWD(pwd, 3000) == nullptr) cvm::fatal_error("Error: cannot get the path of the current working directory.\n"); replica_list_file = (std::string(pwd)+std::string(PATHSEP)+ @@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file() { int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; - if (proxy->get_output_stream(replica_hills_file) != NULL) { + if (proxy->get_output_stream(replica_hills_file) != nullptr) { error_code |= proxy->close_output_stream(replica_hills_file); } error_code |= proxy->remove_file(replica_hills_file); diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index 05d1195d58..d45d85111a 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -135,7 +135,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf, char const *group_key, bool optional) { - cvm::atom_group *group = NULL; + cvm::atom_group *group = nullptr; std::string group_conf; if (key_lookup(conf, group_key, &group_conf)) { @@ -298,7 +298,7 @@ colvar::cvc::~cvc() free_children_deps(); remove_all_children(); for (size_t i = 0; i < atom_groups.size(); i++) { - if (atom_groups[i] != NULL) delete atom_groups[i]; + if (atom_groups[i] != nullptr) delete atom_groups[i]; } } @@ -344,7 +344,7 @@ colvarvalue const *colvar::cvc::get_param_grad(std::string const ¶m_name) { colvarvalue const *ptr = reinterpret_cast(get_param_grad_ptr(param_name)); - return ptr != NULL ? ptr : NULL; + return ptr != nullptr ? ptr : nullptr; } @@ -553,7 +553,7 @@ void colvar::cvc::debug_gradients() } } - if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) { + if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != nullptr)) { cvm::atom_group *ref_group = group->fitting_group; group->read_positions(); group->calc_required_properties(); diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index f0fbabfc4f..f36d055528 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -91,7 +91,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0, colvar::coordnum::coordnum(std::string const &conf) - : cvc(conf), b_anisotropic(false), pairlist(NULL) + : cvc(conf), b_anisotropic(false), pairlist(nullptr) { function_type = "coordnum"; @@ -102,7 +102,7 @@ colvar::coordnum::coordnum(std::string const &conf) group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); - if (group1 == NULL || group2 == NULL) { + if (group1 == nullptr || group2 == nullptr) { cvm::error("Error: failed to initialize atom groups.\n", INPUT_ERROR); return; @@ -183,7 +183,7 @@ colvar::coordnum::coordnum(std::string const &conf) colvar::coordnum::~coordnum() { - if (pairlist != NULL) { + if (pairlist != nullptr) { delete [] pairlist; } } @@ -218,11 +218,11 @@ template void colvar::coordnum::main_loop(bool **pairlist_elem) template int colvar::coordnum::compute_coordnum() { - bool const use_pairlist = (pairlist != NULL); - bool const rebuild_pairlist = (pairlist != NULL) && + bool const use_pairlist = (pairlist != nullptr); + bool const rebuild_pairlist = (pairlist != nullptr) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : NULL; + bool *pairlist_elem = use_pairlist ? pairlist : nullptr; if (b_anisotropic) { @@ -239,7 +239,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags | ef_anisotropic; - main_loop(NULL); + main_loop(nullptr); } } else { @@ -257,7 +257,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags; - main_loop(NULL); + main_loop(nullptr); } } @@ -367,7 +367,7 @@ void colvar::h_bond::calc_value() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - NULL, 0.0); + nullptr, 0.0); } @@ -378,7 +378,7 @@ void colvar::h_bond::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - NULL, 0.0); + nullptr, 0.0); } @@ -393,7 +393,7 @@ simple_scalar_dist_functions(h_bond) colvar::selfcoordnum::selfcoordnum(std::string const &conf) - : cvc(conf), pairlist(NULL) + : cvc(conf), pairlist(nullptr) { function_type = "selfcoordnum"; x.type(colvarvalue::type_scalar); @@ -438,7 +438,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf) colvar::selfcoordnum::~selfcoordnum() { - if (pairlist != NULL) { + if (pairlist != nullptr) { delete [] pairlist; } } @@ -448,11 +448,11 @@ template int colvar::selfcoordnum::compute_selfcoordnum() { cvm::rvector const r0_vec(0.0); // TODO enable the flag? - bool const use_pairlist = (pairlist != NULL); - bool const rebuild_pairlist = (pairlist != NULL) && + bool const use_pairlist = (pairlist != nullptr); + bool const rebuild_pairlist = (pairlist != nullptr) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : NULL; + bool *pairlist_elem = use_pairlist ? pairlist : nullptr; size_t i = 0, j = 0; size_t const n = group1->size(); @@ -601,13 +601,13 @@ void colvar::groupcoordnum::calc_value() x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } else { int const flags = coordnum::ef_null; x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } } @@ -624,13 +624,13 @@ void colvar::groupcoordnum::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } else { int const flags = coordnum::ef_gradients; coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - NULL, 0.0); + nullptr, 0.0); } group1->set_weighted_gradient(group1_com_atom.grad); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index c3c1ee55d5..88a5088aaf 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -964,7 +964,7 @@ colvar::rmsd::rmsd(std::string const &conf) } bool b_Jacobian_derivative = true; - if (atoms->fitting_group != NULL && b_Jacobian_derivative) { + if (atoms->fitting_group != nullptr && b_Jacobian_derivative) { cvm::log("The option \"fittingGroup\" (alternative group for fitting) was enabled: " "Jacobian derivatives of the RMSD will not be calculated.\n"); b_Jacobian_derivative = false; diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index f83458b51c..f647211f6e 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -33,7 +33,7 @@ colvardeps::~colvardeps() { // Do not delete features if it's a static object // may change in the future though // for (i=0; i &colvars, {} colvar_grid_scalar::colvar_grid_scalar() - : colvar_grid(), samples(NULL) + : colvar_grid(), samples(nullptr) {} colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g) - : colvar_grid(g), samples(NULL) + : colvar_grid(g), samples(nullptr) { } colvar_grid_scalar::colvar_grid_scalar(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, 1), samples(NULL) + : colvar_grid(nx_i, 0.0, 1), samples(nullptr) { } colvar_grid_scalar::colvar_grid_scalar(std::vector &colvars, bool margin) - : colvar_grid(colvars, 0.0, 1, margin), samples(NULL) + : colvar_grid(colvars, 0.0, 1, margin), samples(nullptr) { } @@ -122,15 +122,15 @@ cvm::real colvar_grid_scalar::entropy() const colvar_grid_gradient::colvar_grid_gradient() - : colvar_grid(), samples(NULL) + : colvar_grid(), samples(nullptr) {} colvar_grid_gradient::colvar_grid_gradient(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, nx_i.size()), samples(NULL) + : colvar_grid(nx_i, 0.0, nx_i.size()), samples(nullptr) {} colvar_grid_gradient::colvar_grid_gradient(std::vector &colvars) - : colvar_grid(colvars, 0.0, colvars.size()), samples(NULL) + : colvar_grid(colvars, 0.0, colvars.size()), samples(nullptr) {} void colvar_grid_gradient::write_1D_integral(std::ostream &os) diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 1d5f75bbca..48a38a6076 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -30,11 +30,11 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) depth_s = 0; log_level_ = 10; - cv_traj_os = NULL; + cv_traj_os = nullptr; xyz_reader_use_count = 0; - if (proxy == NULL) { + if (proxy == nullptr) { proxy = proxy_in; // Pointer to the proxy object parse = new colvarparse(); // Parsing object for global options version_int = proxy->get_version_from_string(COLVARS_VERSION); @@ -573,7 +573,7 @@ colvarbias * colvarmodule::bias_by_name(std::string const &name) return (*bi); } } - return NULL; + return nullptr; } @@ -587,7 +587,7 @@ colvar *colvarmodule::colvar_by_name(std::string const &name) return (*cvi); } } - return NULL; + return nullptr; } @@ -601,7 +601,7 @@ cvm::atom_group *colvarmodule::atom_group_by_name(std::string const &name) return (*agi); } } - return NULL; + return nullptr; } @@ -631,7 +631,7 @@ int colvarmodule::change_configuration(std::string const &bias_name, cvm::increase_depth(); colvarbias *b; b = bias_by_name(bias_name); - if (b == NULL) { + if (b == nullptr) { cvm::error("Error: bias not found: " + bias_name); return COLVARS_ERROR; } @@ -647,7 +647,7 @@ std::string colvarmodule::read_colvar(std::string const &name) colvar *c; std::stringstream ss; c = colvar_by_name(name); - if (c == NULL) { + if (c == nullptr) { cvm::error("Error: colvar not found: " + name); return std::string(); } @@ -663,7 +663,7 @@ cvm::real colvarmodule::energy_difference(std::string const &bias_name, colvarbias *b; cvm::real energy_diff = 0.; b = bias_by_name(bias_name); - if (b == NULL) { + if (b == nullptr) { cvm::error("Error: bias not found: " + bias_name); return 0.; } @@ -678,7 +678,7 @@ int colvarmodule::bias_current_bin(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->current_bin(); } else { cvm::error("Error: bias not found.\n"); @@ -695,7 +695,7 @@ int colvarmodule::bias_bin_num(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->bin_num(); } else { cvm::error("Error: bias not found.\n"); @@ -712,7 +712,7 @@ int colvarmodule::bias_bin_count(std::string const &bias_name, size_t bin_index) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { ret = b->bin_count(bin_index); } else { cvm::error("Error: bias not found.\n"); @@ -729,7 +729,7 @@ int colvarmodule::bias_share(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != NULL) { + if (b != nullptr) { b->replica_share(); ret = COLVARS_OK; } else { @@ -1037,7 +1037,7 @@ int colvarmodule::write_restart_file(std::string const &out_name) int colvarmodule::write_traj_files() { - if (cv_traj_os == NULL) { + if (cv_traj_os == nullptr) { if (open_traj_file(cv_traj_name) != COLVARS_OK) { return cvm::get_error(); } else { @@ -1057,7 +1057,7 @@ int colvarmodule::write_traj_files() write_traj(*cv_traj_os); } - if (restart_out_freq && (cv_traj_os != NULL)) { + if (restart_out_freq && (cv_traj_os != nullptr)) { // flush the trajectory file if we are at the restart frequency if ( (cvm::step_relative() > 0) && ((cvm::step_absolute() % restart_out_freq) == 0) ) { @@ -1151,8 +1151,8 @@ colvarmodule::~colvarmodule() atom_group::delete_features(); delete parse; - parse = NULL; - proxy = NULL; + parse = nullptr; + proxy = nullptr; } } @@ -1184,7 +1184,7 @@ int colvarmodule::reset() proxy->reset(); - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { // Do not close traj file here, as we might not be done with it yet. proxy->flush_output_stream(cv_traj_os); } @@ -1395,7 +1395,7 @@ std::istream & colvarmodule::read_objects_state(std::istream &is) if (static_cast(is.tellg()) == pos) { // This block has not been read by any object: discard it and move on // to the next one - is >> colvarparse::read_block(word, NULL); + is >> colvarparse::read_block(word, nullptr); } if (!is) break; @@ -1456,7 +1456,7 @@ int colvarmodule::write_output_files() } cvm::decrease_depth(); - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { // do not close, there may be another run command proxy->flush_output_stream(cv_traj_os); } @@ -1575,7 +1575,7 @@ std::ostream & colvarmodule::write_restart(std::ostream &os) int colvarmodule::open_traj_file(std::string const &file_name) { - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { return COLVARS_OK; } @@ -1591,7 +1591,7 @@ int colvarmodule::open_traj_file(std::string const &file_name) cv_traj_os = (cvm::proxy)->output_stream(file_name); } - if (cv_traj_os == NULL) { + if (cv_traj_os == nullptr) { cvm::error("Error: cannot write to file \""+file_name+"\".\n", FILE_ERROR); } @@ -1602,9 +1602,9 @@ int colvarmodule::open_traj_file(std::string const &file_name) int colvarmodule::close_traj_file() { - if (cv_traj_os != NULL) { + if (cv_traj_os != nullptr) { proxy->close_output_stream(cv_traj_name); - cv_traj_os = NULL; + cv_traj_os = nullptr; } return cvm::get_error(); } @@ -1672,7 +1672,7 @@ void cvm::log(std::string const &message, int min_log_level) { if (cvm::log_level() < min_log_level) return; // allow logging when the module is not fully initialized - size_t const d = (cvm::main() != NULL) ? depth() : 0; + size_t const d = (cvm::main() != nullptr) ? depth() : 0; if (d > 0) { proxy->log((std::string(2*d, ' '))+message); } else { @@ -1780,7 +1780,7 @@ int cvm::read_index_file(char const *filename) } if (index_of_group < 0) { index_group_names.push_back(group_name); - index_groups.push_back(NULL); + index_groups.push_back(nullptr); index_of_group = index_groups.size()-1; } } else { @@ -1799,7 +1799,7 @@ int cvm::read_index_file(char const *filename) pos = is.tellg(); } - if (old_index_group != NULL) { + if (old_index_group != nullptr) { bool equal = false; if (new_index_group->size() == old_index_group->size()) { if (std::equal(new_index_group->begin(), new_index_group->end(), @@ -1810,13 +1810,13 @@ int cvm::read_index_file(char const *filename) if (! equal) { new_index_group->clear(); delete new_index_group; - new_index_group = NULL; + new_index_group = nullptr; return cvm::error("Error: the index group \""+group_name+ "\" was redefined.\n", INPUT_ERROR); } else { old_index_group->clear(); delete old_index_group; - old_index_group = NULL; + old_index_group = nullptr; } } @@ -1850,7 +1850,7 @@ int colvarmodule::reset_index_groups() size_t i = 0; for ( ; i < index_groups.size(); i++) { delete index_groups[i]; - index_groups[i] = NULL; + index_groups[i] = nullptr; } index_group_names.clear(); index_groups.clear(); @@ -2179,7 +2179,7 @@ std::string cvm::wrap_string(std::string const &s, size_t nchars) // shared pointer to the proxy object -colvarproxy *colvarmodule::proxy = NULL; +colvarproxy *colvarmodule::proxy = nullptr; // static runtime data cvm::real colvarmodule::debug_gradients_step_size = 1.0e-07; diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index 9346e8e1d6..e06f05aca0 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -459,13 +459,13 @@ public: /// Backup a file before writing it static int backup_file(char const *filename); - /// Look up a bias by name; returns NULL if not found + /// Look up a bias by name; returns nullptr if not found static colvarbias * bias_by_name(std::string const &name); - /// Look up a colvar by name; returns NULL if not found + /// Look up a colvar by name; returns nullptr if not found static colvar * colvar_by_name(std::string const &name); - /// Look up a named atom group by name; returns NULL if not found + /// Look up a named atom group by name; returns nullptr if not found static atom_group * atom_group_by_name(std::string const &name); /// Load new configuration for the given bias - diff --git a/lib/colvars/colvarparams.cpp b/lib/colvars/colvarparams.cpp index e957a1841d..ea45c01104 100644 --- a/lib/colvars/colvarparams.cpp +++ b/lib/colvars/colvarparams.cpp @@ -76,7 +76,7 @@ void const *colvarparams::get_param_ptr(std::string const ¶m_name) return param_map[param_name]; } cvm::error("Error: parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return NULL; + return nullptr; } @@ -87,7 +87,7 @@ void const *colvarparams::get_param_grad_ptr(std::string const ¶m_name) } cvm::error("Error: gradient of parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return NULL; + return nullptr; } @@ -95,7 +95,7 @@ cvm::real colvarparams::get_param(std::string const ¶m_name) { cvm::real const *ptr = reinterpret_cast(get_param_ptr(param_name)); - return ptr != NULL ? *ptr : 0.0; + return ptr != nullptr ? *ptr : 0.0; } diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index a09d6be9ef..e61ebf355f 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -674,12 +674,12 @@ bool colvarparse::key_lookup(std::string const &conf, std::string const conf_lower(to_lower_cppstr(conf)); // by default, there is no value, unless we found one - if (data != NULL) { + if (data != nullptr) { data->clear(); } // start from the first occurrence of key - size_t pos = conf_lower.find(key, (save_pos != NULL) ? *save_pos : 0); + size_t pos = conf_lower.find(key, (save_pos != nullptr) ? *save_pos : 0); // iterate over all instances of the substring until it finds it as isolated keyword while (true) { @@ -727,7 +727,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != NULL) { + if (save_pos != nullptr) { // save the pointer for a future call (when iterating over multiple // valid instances of the same keyword) *save_pos = pos + key.size(); @@ -820,7 +820,7 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != NULL) { + if (data != nullptr) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) { @@ -834,7 +834,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != NULL) *save_pos = line_end; + if (save_pos != nullptr) *save_pos = line_end; return true; } diff --git a/lib/colvars/colvarparse.h b/lib/colvars/colvarparse.h index b7d42fdffa..fc1362b2b1 100644 --- a/lib/colvars/colvarparse.h +++ b/lib/colvars/colvarparse.h @@ -275,12 +275,12 @@ public: /// The keyword that identifies the block std::string const key; - /// Where to keep the data (may be NULL) + /// Where to keep the data (may be nullptr) std::string * const data; public: - read_block(std::string const &key_in, std::string *data_in = NULL); + read_block(std::string const &key_in, std::string *data_in = nullptr); ~read_block(); @@ -300,8 +300,8 @@ public: /// within "conf", useful when doing multiple calls bool key_lookup(std::string const &conf, char const *key, - std::string *data = NULL, - size_t *save_pos = NULL); + std::string *data = nullptr, + size_t *save_pos = nullptr); /// \brief Reads a configuration line, adds it to config_string, and returns /// the stream \param is Input stream \param line String that will hold the diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 63ae07a57c..7eb0b22cb5 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -296,7 +296,7 @@ void colvarproxy_atom_groups::clear_atom_group(int index) colvarproxy_smp::colvarproxy_smp() { b_smp_active = true; // May be disabled by user option - omp_lock_state = NULL; + omp_lock_state = nullptr; #if defined(_OPENMP) if (smp_thread_id() == 0) { omp_lock_state = reinterpret_cast(new omp_lock_t); @@ -459,7 +459,7 @@ int colvarproxy_smp::smp_unlock() colvarproxy_script::colvarproxy_script() { - script = NULL; + script = nullptr; } @@ -507,7 +507,7 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name colvarproxy_tcl::colvarproxy_tcl() { - tcl_interp_ = NULL; + tcl_interp_ = nullptr; } @@ -528,7 +528,7 @@ char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj) #if defined(COLVARS_TCL) return Tcl_GetString(reinterpret_cast(obj)); #else - return NULL; + return nullptr; #endif } @@ -666,7 +666,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, } std::ostream *os = get_output_stream(output_name); - if (os != NULL) return os; + if (os != nullptr) return os; if (!(mode & (std::ios_base::app | std::ios_base::ate))) { backup_file(output_name); @@ -675,7 +675,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, if (!osf->is_open()) { cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n", FILE_ERROR); - return NULL; + return nullptr; } output_stream_names.push_back(output_name); output_files.push_back(osf); @@ -692,7 +692,7 @@ std::ostream *colvarproxy_io::get_output_stream(std::string const &output_name) return *osi; } } - return NULL; + return nullptr; } @@ -794,7 +794,7 @@ int colvarproxy_io::rename_file(char const *filename, char const *newfilename) colvarproxy::colvarproxy() { - colvars = NULL; + colvars = nullptr; b_simulation_running = true; b_delete_requested = false; } diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index ba91afb40e..a46589a526 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -607,7 +607,7 @@ public: std::ios_base::openmode mode = std::ios_base::out); - /// Returns a reference to output_name if it exists, NULL otherwise + /// Returns a reference to output_name if it exists, nullptr otherwise virtual std::ostream *get_output_stream(std::string const &output_name); /// \brief Flushes the given output channel diff --git a/lib/colvars/colvarscript.cpp b/lib/colvars/colvarscript.cpp index 10b276c89e..a8b5d6ab2f 100644 --- a/lib/colvars/colvarscript.cpp +++ b/lib/colvars/colvarscript.cpp @@ -97,7 +97,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvar *cv = cvm::colvar_by_name(name); - if (cv == NULL) { + if (cv == nullptr) { result = "Colvar not found: " + name; return COLVARSCRIPT_ERROR; } @@ -111,7 +111,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvarbias *b = cvm::bias_by_name(name); - if (b == NULL) { + if (b == nullptr) { result = "Bias not found: " + name; return COLVARSCRIPT_ERROR; } @@ -186,7 +186,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) /// Parse config from string if (cmd == "config") { - return exec_command(cv_config, NULL, objc, objv); + return exec_command(cv_config, nullptr, objc, objv); } /// Load an input state file @@ -247,7 +247,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } else if (objc == 3) { // Failure of this function does not trigger an error, but // returns nonzero, to let scripts detect available frames - int error = proxy->set_frame(strtol(obj_to_str(objv[2]), NULL, 10)); + int error = proxy->set_frame(strtol(obj_to_str(objv[2]), nullptr, 10)); result = cvm::to_str(error == COLVARS_OK ? 0 : -1); return COLVARS_OK; } else { @@ -258,7 +258,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) if (cmd == "addenergy") { if (objc == 3) { - colvars->total_bias_energy += strtod(obj_to_str(objv[2]), NULL); + colvars->total_bias_energy += strtod(obj_to_str(objv[2]), nullptr); return COLVARS_OK; } else { result = "Wrong arguments to command \"addenergy\"\n" + help_string(); @@ -267,7 +267,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } if (cmd == "help") { - return exec_command(cv_help, NULL, objc, objv); + return exec_command(cv_help, nullptr, objc, objv); } result = "Syntax error\n" + help_string(); @@ -320,7 +320,7 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[]) // colvar destructor is tasked with the cleanup delete cv; // TODO this could be done by the destructors - if (colvars->cv_traj_os != NULL) { + if (colvars->cv_traj_os != nullptr) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -513,7 +513,7 @@ int colvarscript::proc_bias(colvarbias *b, int objc, unsigned char *const objv[] // the bias destructor takes care of the cleanup at cvm level delete b; // TODO this could be done by the destructors - if (colvars->cv_traj_os != NULL) { + if (colvars->cv_traj_os != nullptr) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -564,7 +564,7 @@ int colvarscript::proc_features(colvardeps *obj, if ((subcmd == "get") || (subcmd == "set")) { std::vector const &features = obj->features(); std::string const req_feature(obj_to_str(objv[3])); - colvardeps::feature *f = NULL; + colvardeps::feature *f = nullptr; int fid = 0; for (fid = 0; fid < int(features.size()); fid++) { if (features[fid]->description == @@ -574,7 +574,7 @@ int colvarscript::proc_features(colvardeps *obj, } } - if (f == NULL) { + if (f == nullptr) { result = "Error: feature \""+req_feature+"\" does not exist.\n"; return COLVARSCRIPT_ERROR; diff --git a/lib/colvars/colvarscript.h b/lib/colvars/colvarscript.h index 69d52cbb51..04679b37ad 100644 --- a/lib/colvars/colvarscript.h +++ b/lib/colvars/colvarscript.h @@ -278,7 +278,7 @@ extern "C" { 1, 1, { "E (float) - Amount of energy to add" }, cvm::main()->total_bias_energy += - strtod(script->obj_to_str(objv[2]), NULL); + strtod(script->obj_to_str(objv[2]), nullptr); return COLVARS_OK; ) diff --git a/lib/colvars/colvartypes.h b/lib/colvars/colvartypes.h index e5f12154e6..55401576b1 100644 --- a/lib/colvars/colvartypes.h +++ b/lib/colvars/colvartypes.h @@ -59,7 +59,7 @@ public: if (data.size() > 0) { return &(data[0]); } else { - return NULL; + return nullptr; } } @@ -520,7 +520,7 @@ public: if (rows.size() > 0) { return &(pointers[0]); } else { - return NULL; + return nullptr; } } diff --git a/lib/colvars/lepton/include/lepton/Operation.h b/lib/colvars/lepton/include/lepton/Operation.h index 1ddde0b8c0..68474137f1 100644 --- a/lib/colvars/lepton/include/lepton/Operation.h +++ b/lib/colvars/lepton/include/lepton/Operation.h @@ -186,7 +186,7 @@ public: } bool operator!=(const Operation& op) const { const Constant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -217,7 +217,7 @@ public: ExpressionTreeNode differentiate(const std::vector& children, const std::vector& childDerivs, const std::string& variable) const; bool operator!=(const Operation& op) const { const Variable* o = dynamic_cast(&op); - return (o == NULL || o->name != name); + return (o == nullptr || o->name != name); } private: std::string name; @@ -264,7 +264,7 @@ public: } bool operator!=(const Operation& op) const { const Custom* o = dynamic_cast(&op); - return (o == NULL || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); + return (o == nullptr || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); } private: std::string name; @@ -955,7 +955,7 @@ public: } bool operator!=(const Operation& op) const { const AddConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -988,7 +988,7 @@ public: } bool operator!=(const Operation& op) const { const MultiplyConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } private: double value; @@ -1042,7 +1042,7 @@ public: } bool operator!=(const Operation& op) const { const PowerConstant* o = dynamic_cast(&op); - return (o == NULL || o->value != value); + return (o == nullptr || o->value != value); } bool isInfixOperator() const { return true; diff --git a/lib/colvars/lepton/src/CompiledExpression.cpp b/lib/colvars/lepton/src/CompiledExpression.cpp index 1ad348b47d..6abcad2de2 100644 --- a/lib/colvars/lepton/src/CompiledExpression.cpp +++ b/lib/colvars/lepton/src/CompiledExpression.cpp @@ -40,10 +40,10 @@ using namespace std; using namespace asmjit; #endif -CompiledExpression::CompiledExpression() : jitCode(NULL) { +CompiledExpression::CompiledExpression() : jitCode(nullptr) { } -CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(NULL) { +CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(nullptr) { ParsedExpression expr = expression.optimize(); // Just in case it wasn't already optimized. vector > temps; compileExpression(expr.getRootNode(), temps); @@ -59,11 +59,11 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit CompiledExpression::~CompiledExpression() { for (int i = 0; i < (int) operation.size(); i++) - if (operation[i] != NULL) + if (operation[i] != nullptr) delete operation[i]; } -CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(NULL) { +CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(nullptr) { *this = expression; } diff --git a/lib/colvars/lepton/src/ExpressionTreeNode.cpp b/lib/colvars/lepton/src/ExpressionTreeNode.cpp index 8519878262..09c5352d20 100644 --- a/lib/colvars/lepton/src/ExpressionTreeNode.cpp +++ b/lib/colvars/lepton/src/ExpressionTreeNode.cpp @@ -59,14 +59,14 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati throw Exception("wrong number of arguments to function: "+operation->getName()); } -ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) { +ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == nullptr ? nullptr : node.operation->clone()), children(node.getChildren()) { } -ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) { +ExpressionTreeNode::ExpressionTreeNode() : operation(nullptr) { } ExpressionTreeNode::~ExpressionTreeNode() { - if (operation != NULL) + if (operation != nullptr) delete operation; } @@ -91,7 +91,7 @@ bool ExpressionTreeNode::operator==(const ExpressionTreeNode& node) const { } ExpressionTreeNode& ExpressionTreeNode::operator=(const ExpressionTreeNode& node) { - if (operation != NULL) + if (operation != nullptr) delete operation; operation = node.getOperation().clone(); children = node.getChildren(); diff --git a/lib/colvars/lepton/src/ParsedExpression.cpp b/lib/colvars/lepton/src/ParsedExpression.cpp index fd3b091d3c..c259756346 100644 --- a/lib/colvars/lepton/src/ParsedExpression.cpp +++ b/lib/colvars/lepton/src/ParsedExpression.cpp @@ -46,7 +46,7 @@ ParsedExpression::ParsedExpression(const ExpressionTreeNode& rootNode) : rootNod } const ExpressionTreeNode& ParsedExpression::getRootNode() const { - if (&rootNode.getOperation() == NULL) + if (&rootNode.getOperation() == nullptr) throw Exception("Illegal call to an initialized ParsedExpression"); return rootNode; } diff --git a/lib/gpu/cudpp_mini/cudpp.cpp b/lib/gpu/cudpp_mini/cudpp.cpp index e2cd4621a4..9506320748 100644 --- a/lib/gpu/cudpp_mini/cudpp.cpp +++ b/lib/gpu/cudpp_mini/cudpp.cpp @@ -95,7 +95,7 @@ CUDPPResult cudppScan(CUDPPHandle planHandle, size_t numElements) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, 1, plan); return CUDPP_SUCCESS; @@ -159,7 +159,7 @@ CUDPPResult cudppSegmentedScan(CUDPPHandle planHandle, { CUDPPSegmentedScanPlan *plan = (CUDPPSegmentedScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSegmentedScanDispatch(d_out, d_idata, d_iflags, numElements, plan); return CUDPP_SUCCESS; @@ -200,7 +200,7 @@ CUDPPResult cudppMultiScan(CUDPPHandle planHandle, size_t numRows) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, numRows, plan); return CUDPP_SUCCESS; @@ -255,7 +255,7 @@ CUDPPResult cudppCompact(CUDPPHandle planHandle, size_t numElements) { CUDPPCompactPlan *plan = (CUDPPCompactPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppCompactDispatch(d_out, d_numValidElements, d_in, d_isValid, numElements, plan); @@ -300,7 +300,7 @@ CUDPPResult cudppSort(CUDPPHandle planHandle, size_t numElements) { CUDPPRadixSortPlan *plan = (CUDPPRadixSortPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppRadixSortDispatch(d_keys, d_values, numElements, keyBits, plan); return CUDPP_SUCCESS; @@ -331,7 +331,7 @@ CUDPPResult cudppSparseMatrixVectorMultiply(CUDPPHandle sparseMatrixHandl CUDPPSparseMatrixVectorMultiplyPlan *plan = (CUDPPSparseMatrixVectorMultiplyPlan*)CUDPPPlanManager::GetPlan(sparseMatrixHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSparseMatrixVectorMultiplyDispatch(d_y, d_x, plan); return CUDPP_SUCCESS; @@ -366,7 +366,7 @@ CUDPP_DLL CUDPPResult cudppRand(CUDPPHandle planHandle,void * d_out, size_t numElements) { CUDPPRandPlan * plan = (CUDPPRandPlan *) CUDPPPlanManager::GetPlan(planHandle); - if(plan != NULL) + if(plan != nullptr) { //dispatch the rand algorithm here cudppRandDispatch(d_out, numElements, plan); diff --git a/lib/gpu/cudpp_mini/cudpp_plan.cpp b/lib/gpu/cudpp_mini/cudpp_plan.cpp index e92a857dd1..8ea99a23fe 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan.cpp @@ -18,7 +18,7 @@ #include -CUDPPPlanManager* CUDPPPlanManager::m_instance = NULL; +CUDPPPlanManager* CUDPPPlanManager::m_instance = nullptr; CUDPPResult validateOptions(CUDPPConfiguration config, size_t /*numElements*/, size_t numRows, size_t /*rowPitch*/) { diff --git a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp index dd9d6eb9db..33c8621d29 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp @@ -26,17 +26,17 @@ extern "C" void compNumCTAs(KernelPointer kernel, size_t bytesDynamicSharedMem, //! @internal Instantiate the plan manager singleton object void CUDPPPlanManager::Instantiate() { - if (NULL == m_instance) + if (nullptr == m_instance) m_instance = new CUDPPPlanManager; } //! @internal Destroy the plan manager singleton object void CUDPPPlanManager::Destroy() { - if (NULL != m_instance) + if (nullptr != m_instance) { delete m_instance; - m_instance = NULL; + m_instance = nullptr; } } @@ -51,7 +51,7 @@ CUDPPPlanManager::~CUDPPPlanManager() { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; } m_instance->plans.clear(); @@ -85,7 +85,7 @@ CUDPPHandle CUDPPPlanManager::AddPlan(CUDPPPlan* plan) */ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { return false; } @@ -97,7 +97,7 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; m_instance->plans.erase(it); if (0 == m_instance->plans.size()) @@ -115,14 +115,14 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) /** @brief Get a plan from the plan manager by handle * -* @returns A pointer to the plan if found, or NULL otherwise +* @returns A pointer to the plan if found, or nullptr otherwise * @param handle The handle to the requested plan */ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { - return NULL; + return nullptr; } std::map::iterator it; @@ -133,13 +133,13 @@ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) } else { - return NULL; + return nullptr; } } size_t CUDPPPlanManager::numCTAs(KernelPointer kernel) { - if (m_instance == NULL) + if (m_instance == nullptr) { return 0; } diff --git a/lib/gpu/cudpp_mini/cutil.h b/lib/gpu/cudpp_mini/cutil.h index 7d1fcc17ee..54f29f498e 100644 --- a/lib/gpu/cudpp_mini/cutil.h +++ b/lib/gpu/cudpp_mini/cutil.h @@ -136,7 +136,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -152,7 +152,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -168,7 +168,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -215,7 +215,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -307,7 +307,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -350,7 +350,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -366,7 +366,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -381,7 +381,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// diff --git a/lib/gpu/geryon/hip_device.h b/lib/gpu/geryon/hip_device.h index 93f38d28bb..d2fb1919b7 100644 --- a/lib/gpu/geryon/hip_device.h +++ b/lib/gpu/geryon/hip_device.h @@ -261,7 +261,7 @@ class UCL_Device { /// Select the platform that has accelerators (for compatibility with OpenCL) inline int set_platform_accelerator(int pid=-1) { return UCL_SUCCESS; } - inline int load_module(const void* program, hipModule_t& module, std::string *log=NULL){ + inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){ auto it = _loaded_modules.emplace(program, hipModule_t()); if(!it.second){ module = it.first->second; @@ -281,7 +281,7 @@ class UCL_Device { hipError_t err=hipModuleLoadDataEx(&module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != hipSuccess) { diff --git a/lib/gpu/geryon/hip_kernel.h b/lib/gpu/geryon/hip_kernel.h index 654eb44772..c5014b52e7 100644 --- a/lib/gpu/geryon/hip_kernel.h +++ b/lib/gpu/geryon/hip_kernel.h @@ -30,7 +30,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _device_ptr = &device; _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _device_ptr = &device; _cq=device.cq(); init(device); load_string(program,flags,log); @@ -46,7 +46,7 @@ class UCL_Program { inline void clear() { } /// Load a program from a file and compile with flags - inline int load(const char *filename, const char *flags="", std::string *log=NULL) { + inline int load(const char *filename, const char *flags="", std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -64,7 +64,7 @@ class UCL_Program { } /// Load a program from a string and compile with flags - inline int load_string(const void *program, const char *flags="", std::string *log=NULL) { + inline int load_string(const void *program, const char *flags="", std::string *log=nullptr) { return _device_ptr->load_module(program, _module, log); } @@ -263,7 +263,7 @@ class UCL_Kernel { }; const auto res = hipModuleLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq, NULL, config); + _block_size[2],0,_cq, nullptr, config); CU_SAFE_CALL(res); //#endif } diff --git a/lib/gpu/geryon/hip_memory.h b/lib/gpu/geryon/hip_memory.h index 13f60ad939..a983ba3227 100644 --- a/lib/gpu/geryon/hip_memory.h +++ b/lib/gpu/geryon/hip_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/hip_texture.h b/lib/gpu/geryon/hip_texture.h index e7aa4e1461..ae16bee900 100644 --- a/lib/gpu/geryon/hip_texture.h +++ b/lib/gpu/geryon/hip_texture.h @@ -99,7 +99,7 @@ class UCL_Texture { else CU_SAFE_CALL(hipTexRefSetFormat(_tex,HIP_AD_FORMAT_SIGNED_INT32,numel*2)); } - CU_SAFE_CALL(hipTexRefSetAddress(NULL, _tex, vec.cbegin(), vec.numel()*vec.element_size())); + CU_SAFE_CALL(hipTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); #else void* data_ptr = (void*)vec.cbegin(); CU_SAFE_CALL(hipMemcpyHtoD(hipDeviceptr_t(_device_ptr_to_global_var), &data_ptr, sizeof(void*))); diff --git a/lib/gpu/geryon/nvd_kernel.h b/lib/gpu/geryon/nvd_kernel.h index 9293db2fe4..d74b0e2dc1 100644 --- a/lib/gpu/geryon/nvd_kernel.h +++ b/lib/gpu/geryon/nvd_kernel.h @@ -41,7 +41,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _cq=device.cq(); init(device); load_string(program,flags,log); @@ -58,7 +58,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -77,7 +77,7 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { if (std::string(flags)=="BINARY") return load_binary((const char *)program); const unsigned int num_opts=2; @@ -95,7 +95,7 @@ class UCL_Program { CUresult err=cuModuleLoadDataEx(&_module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != CUDA_SUCCESS) { @@ -361,7 +361,7 @@ class UCL_Kernel { #if CUDA_VERSION >= 4000 CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq,_kernel_args,NULL)); + _block_size[2],0,_cq,_kernel_args,nullptr)); #else CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size)); CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq)); diff --git a/lib/gpu/geryon/nvd_memory.h b/lib/gpu/geryon/nvd_memory.h index 0484e33de6..bcfc055ac2 100644 --- a/lib/gpu/geryon/nvd_memory.h +++ b/lib/gpu/geryon/nvd_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/nvd_texture.h b/lib/gpu/geryon/nvd_texture.h index 965595a448..c766af826c 100644 --- a/lib/gpu/geryon/nvd_texture.h +++ b/lib/gpu/geryon/nvd_texture.h @@ -80,7 +80,7 @@ class UCL_Texture { #ifdef UCL_DEBUG assert(numel!=0 && numel<5); #endif - CU_SAFE_CALL(cuTexRefSetAddress(NULL, _tex, vec.cbegin(), + CU_SAFE_CALL(cuTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); if (vec.element_size()==sizeof(float)) CU_SAFE_CALL(cuTexRefSetFormat(_tex, CU_AD_FORMAT_FLOAT, numel)); diff --git a/lib/gpu/geryon/ocl_device.h b/lib/gpu/geryon/ocl_device.h index 10e84a436a..de4def0bc1 100644 --- a/lib/gpu/geryon/ocl_device.h +++ b/lib/gpu/geryon/ocl_device.h @@ -360,7 +360,7 @@ int UCL_Device::set_platform(int pid) { // --- Get Number of Devices cl_uint n; - errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,NULL,&n); + errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,nullptr,&n); _num_devices=n; if (errorv!=CL_SUCCESS || _num_devices==0) { _num_devices=0; @@ -385,7 +385,7 @@ int UCL_Device::create_context() { props[0]=CL_CONTEXT_PLATFORM; props[1]=_platform; props[2]=0; - _context=clCreateContext(0,1,&_cl_device,NULL,NULL,&errorv); + _context=clCreateContext(0,1,&_cl_device,nullptr,nullptr,&errorv); if (errorv!=CL_SUCCESS) { #ifndef UCL_NO_EXIT std::cerr << "UCL Error: Could not access accelerator number " << _device @@ -404,36 +404,36 @@ void UCL_Device::add_properties(cl_device_id device_list) { char buffer[1024]; cl_bool ans_bool; - CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,NULL)); + CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,nullptr)); op.name=buffer; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_GLOBAL_MEM_SIZE, - sizeof(op.global_mem),&op.global_mem,NULL)); + sizeof(op.global_mem),&op.global_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_LOCAL_MEM_SIZE, - sizeof(op.shared_mem),&op.shared_mem,NULL)); + sizeof(op.shared_mem),&op.shared_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, - sizeof(op.const_mem),&op.const_mem,NULL)); + sizeof(op.const_mem),&op.const_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_TYPE, - sizeof(op.device_type),&op.device_type,NULL)); + sizeof(op.device_type),&op.device_type,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(op.compute_units),&op.compute_units, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CLOCK_FREQUENCY, - sizeof(op.clock),&op.clock,NULL)); + sizeof(op.clock),&op.clock,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(op.work_group_size),&op.work_group_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_ITEM_SIZES, 3*sizeof(op.work_item_size[0]),op.work_item_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MEM_BASE_ADDR_ALIGN, - sizeof(cl_uint),&op.alignment,NULL)); + sizeof(cl_uint),&op.alignment,nullptr)); op.alignment/=8; // Determine if double precision is supported cl_uint double_width; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, - sizeof(double_width),&double_width,NULL)); + sizeof(double_width),&double_width,nullptr)); if (double_width==0) op.double_precision=false; else @@ -441,13 +441,13 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PROFILING_TIMER_RESOLUTION, - sizeof(size_t),&op.timer_resolution,NULL)); + sizeof(size_t),&op.timer_resolution,nullptr)); op.ecc_support=false; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_ERROR_CORRECTION_SUPPORT, - sizeof(ans_bool),&ans_bool,NULL)); + sizeof(ans_bool),&ans_bool,nullptr)); if (ans_bool==CL_TRUE) op.ecc_support=true; @@ -459,7 +459,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { #ifdef CL_VERSION_1_2 size_t return_bytes; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_OPENCL_C_VERSION,1024, - buffer,NULL)); + buffer,nullptr)); op.c_version=buffer; cl_device_partition_property pinfo[4]; @@ -479,7 +479,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, - sizeof(cl_uint),&op.max_sub_devices,NULL)); + sizeof(cl_uint),&op.max_sub_devices,nullptr)); #endif _properties.push_back(op); @@ -489,15 +489,15 @@ std::string UCL_Device::platform_name() { char info[1024]; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VENDOR,1024,info, - NULL)); + nullptr)); std::string ans=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_NAME,1024,info, - NULL)); + nullptr)); ans+=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VERSION,1024,info, - NULL)); + nullptr)); ans+=std::string(info); return ans; diff --git a/lib/gpu/geryon/ocl_kernel.h b/lib/gpu/geryon/ocl_kernel.h index b65049b9e6..77593f4515 100644 --- a/lib/gpu/geryon/ocl_kernel.h +++ b/lib/gpu/geryon/ocl_kernel.h @@ -42,7 +42,7 @@ class UCL_Program { inline UCL_Program() : _init_done(false) {} inline UCL_Program(UCL_Device &device) : _init_done(false) { init(device); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) : + const char *flags="", std::string *log=nullptr) : _init_done(false) { init(device); load_string(program,flags,log); @@ -74,7 +74,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -93,29 +93,29 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { cl_int error_flag; const char *prog=(const char *)program; - _program=clCreateProgramWithSource(_context,1,&prog,NULL,&error_flag); + _program=clCreateProgramWithSource(_context,1,&prog,nullptr,&error_flag); CL_CHECK_ERR(error_flag); - error_flag = clBuildProgram(_program,1,&_device,flags,NULL,NULL); + error_flag = clBuildProgram(_program,1,&_device,flags,nullptr,nullptr); if (error_flag!=-11) CL_CHECK_ERR(error_flag); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); - if (build_status != CL_SUCCESS || log!=NULL) { + if (build_status != CL_SUCCESS || log!=nullptr) { size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); - if (log!=NULL) + if (log!=nullptr) *log=std::string(build_log); if (build_status != CL_SUCCESS) { @@ -363,7 +363,7 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) _kernel_info_name=function; cl_uint nargs; CL_SAFE_CALL(clGetKernelInfo(_kernel,CL_KERNEL_NUM_ARGS,sizeof(cl_uint), - &nargs,NULL)); + &nargs,nullptr)); _kernel_info_nargs=nargs; #ifdef NOT_TEST_CL_VERSION_1_2 char tname[256]; @@ -380,8 +380,8 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) } void UCL_Kernel::run() { - CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,NULL, - _num_blocks,_block_size,0,NULL,NULL)); + CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,nullptr, + _num_blocks,_block_size,0,nullptr,nullptr)); } } // namespace diff --git a/lib/gpu/geryon/ocl_memory.h b/lib/gpu/geryon/ocl_memory.h index 9692f4dd7b..740020ab18 100644 --- a/lib/gpu/geryon/ocl_memory.h +++ b/lib/gpu/geryon/ocl_memory.h @@ -58,7 +58,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; cl_map_flags map_perm; @@ -103,12 +103,12 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, map_perm=CL_MAP_READ | CL_MAP_WRITE; } - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(cm.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=cm.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); @@ -120,10 +120,10 @@ inline int _host_view(mat_type &mat, copy_type &cm, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags orig_flags; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_FLAGS,sizeof(orig_flags), - &orig_flags,NULL)); + &orig_flags,nullptr)); orig_flags=orig_flags & ~CL_MEM_ALLOC_HOST_PTR; mat.cbegin()=clCreateBuffer(context, CL_MEM_USE_HOST_PTR | orig_flags, n, @@ -159,13 +159,13 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, } cl_int error_flag; - mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(dev.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=dev.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); return UCL_SUCCESS; @@ -194,10 +194,10 @@ inline int _host_resize(mat_type &mat, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_FLAGS,sizeof(buffer_perm), - &buffer_perm,NULL)); + &buffer_perm,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); @@ -209,12 +209,12 @@ inline int _host_resize(mat_type &mat, const size_t n) { else map_perm=CL_MAP_READ | CL_MAP_WRITE; - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(mat.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); return UCL_SUCCESS; } @@ -229,7 +229,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags flag; if (kind==UCL_READ_WRITE) flag=CL_MEM_READ_WRITE; @@ -247,7 +247,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); @@ -276,7 +276,7 @@ inline int _device_alloc(mat_type &mat, UCL_Device &dev, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(dev.context(),flag,n,NULL, + mat.cbegin()=clCreateBuffer(dev.context(),flag,n,nullptr, &error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; @@ -321,7 +321,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -341,7 +341,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -359,7 +359,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -379,7 +379,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -395,21 +395,21 @@ inline void _host_zero(void *ptr, const size_t n) { inline void _ocl_build(cl_program &program, cl_device_id &device, const char* options = "") { - clBuildProgram(program,1,&device,options,NULL,NULL); + clBuildProgram(program,1,&device,options,nullptr,nullptr); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); if (build_status == CL_SUCCESS) return; size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(program, device,CL_PROGRAM_BUILD_LOG, 0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(program,device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); std::cerr << std::endl << "----------------------------------------------------------\n" @@ -426,7 +426,7 @@ inline void _ocl_kernel_from_source(cl_context &context, cl_device_id &device, cl_int error_flag; cl_program program=clCreateProgramWithSource(context,lines,source, - NULL,&error_flag); + nullptr,&error_flag); CL_CHECK_ERR(error_flag); _ocl_build(program,device,options); kernel=clCreateKernel(program,function,&error_flag); @@ -444,15 +444,15 @@ inline void _device_zero(mat_type &mat, const size_t n, command_queue &cq) { #ifdef UCL_CL_ZERO cl_int zeroint=0; CL_SAFE_CALL(clEnqueueFillBuffer(cq,mat.begin(),&zeroint,sizeof(cl_int), - mat.byteoff(),n,0,NULL,NULL)); + mat.byteoff(),n,0,nullptr,nullptr)); #else cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_device_id device; CL_SAFE_CALL(clGetContextInfo(context,CL_CONTEXT_DEVICES, - sizeof(cl_device_id),&device,NULL)); + sizeof(cl_device_id),&device,nullptr)); const char * szero[3]={ "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", @@ -585,7 +585,7 @@ template <> struct _ucl_memcpy<1,0> { std::cerr << "UCL_COPY 1NS\n"; #endif CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,n, - dst.begin(),0,NULL,NULL)); + dst.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -607,13 +607,13 @@ template <> struct _ucl_memcpy<1,0> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset, spitch*rows, - (char *)dst.begin()+dst_offset,0,NULL, - NULL)); + (char *)dst.begin()+dst_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy<0,1> { std::cerr << "UCL_COPY 3NS\n"; #endif CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,n, - src.begin(),0,NULL,NULL)); + src.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -659,13 +659,13 @@ template <> struct _ucl_memcpy<0,1> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset, spitch*rows, - (char *)src.begin()+src_offset,0,NULL, - NULL)); + (char *)src.begin()+src_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy { const size_t dst_offset, const size_t src_offset) { if (src.cbegin()!=dst.cbegin() || src_offset!=dst_offset) { CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,n,0,NULL,NULL)); + dst_offset,n,0,nullptr,nullptr)); #ifdef UCL_DBG_MEM_TRACE std::cerr << "UCL_COPY 6NS\n"; #endif @@ -704,13 +704,13 @@ template struct _ucl_memcpy { if (spitch==dpitch && dst.cols()==src.cols() && src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,spitch*rows,0,NULL,NULL)); + dst_offset,spitch*rows,0,nullptr,nullptr)); else for (size_t i=0; i AnswerT::Answer() : _allocated(false),_eflag(false),_vflag(false), - _inum(0),_ilist(NULL),_newton(false) { + _inum(0),_ilist(nullptr),_newton(false) { } template @@ -119,7 +119,7 @@ void AnswerT::clear() { engv.clear(); time_answer.clear(); _inum=0; - _ilist=NULL; + _ilist=nullptr; _eflag=false; _vflag=false; } @@ -180,7 +180,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=0; i<_inum; i++) evdwl+=engv[i]; if (_ef_atom) { - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) eatom[i]+=engv[i]; } else { @@ -196,7 +196,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=vstart; i void AnswerT::get_answers(double **f, double **tor) { int fl=0; - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) { f[i][0]+=force[fl]; f[i][1]+=force[fl+1]; diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index eb0eab87b6..42925aaeec 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -25,8 +25,8 @@ BaseAtomicT::BaseAtomic() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -135,7 +135,7 @@ int * BaseAtomicT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -231,7 +231,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -244,7 +244,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_charge.cpp b/lib/gpu/lal_base_charge.cpp index 52e8ae2d89..d5a6e06222 100644 --- a/lib/gpu/lal_base_charge.cpp +++ b/lib/gpu/lal_base_charge.cpp @@ -25,8 +25,8 @@ BaseChargeT::BaseCharge() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -137,7 +137,7 @@ int * BaseChargeT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -240,7 +240,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -253,7 +253,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_dipole.cpp b/lib/gpu/lal_base_dipole.cpp index ed71029e68..57773a3b80 100644 --- a/lib/gpu/lal_base_dipole.cpp +++ b/lib/gpu/lal_base_dipole.cpp @@ -25,8 +25,8 @@ BaseDipoleT::BaseDipole() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -139,7 +139,7 @@ int * BaseDipoleT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); atom->cast_quat_data(host_mu[0]); hd_balancer.start_timer(); diff --git a/lib/gpu/lal_base_dpd.cpp b/lib/gpu/lal_base_dpd.cpp index c0d7ad47bc..e4fd80fcc3 100644 --- a/lib/gpu/lal_base_dpd.cpp +++ b/lib/gpu/lal_base_dpd.cpp @@ -25,8 +25,8 @@ BaseDPDT::BaseDPD() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -138,7 +138,7 @@ int * BaseDPDT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_v_data(host_v,tag); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index abc8807a8b..524705ed41 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -33,10 +33,10 @@ BaseEllipsoidT::BaseEllipsoid() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - nbor_program=NULL; - ellipsoid_program=NULL; - lj_program=NULL; - ucl_device=NULL; + nbor_program=nullptr; + ellipsoid_program=nullptr; + lj_program=nullptr; + ucl_device=nullptr; } template @@ -356,7 +356,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } int ago=hd_balancer.ago_first(f_ago); @@ -369,7 +369,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, reset_nbors(nall, inum, inum_full, ilist, numj, host_type, firstneigh, success); if (!success) - return NULL; + return nullptr; } int *list; if (_multiple_forms) @@ -406,7 +406,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -420,7 +420,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_quat_data(host_quat[0]); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_three.cpp b/lib/gpu/lal_base_three.cpp index 0b4dbdc89a..cfc138aea2 100644 --- a/lib/gpu/lal_base_three.cpp +++ b/lib/gpu/lal_base_three.cpp @@ -27,8 +27,8 @@ BaseThreeT::BaseThree() : _compiled(false), _max_bytes(0) { #ifdef THREE_CONCURRENT ans2=new Answer(); #endif - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -176,7 +176,7 @@ int * BaseThreeT::reset_nbors(const int nall, const int inum, const int nlist, resize_atom(inum,nall,success); resize_local(nall,mn,success); if (!success) - return NULL; + return nullptr; _nall = nall; @@ -310,7 +310,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -326,7 +326,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, _max_nbors = build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_three.h b/lib/gpu/lal_base_three.h index 38af78b78e..36129e6168 100644 --- a/lib/gpu/lal_base_three.h +++ b/lib/gpu/lal_base_three.h @@ -59,7 +59,7 @@ class BaseThree { const double gpu_split, FILE *screen, const void *pair_program, const char *k_two, const char *k_three_center, const char *k_three_end, - const char *k_short_nbor=NULL); + const char *k_short_nbor=nullptr); /// Estimate the overhead for GPU context changes and CPU driver void estimate_gpu_overhead(); diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index aaf74ed28c..6c6a206307 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -72,7 +72,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int first_gpu, // "0:generic" will select platform 0 and tune for generic device // "1:fermi" will select platform 1 and tune for Nvidia Fermi gpu if (ocl_vendor) { - char *sep = NULL; + char *sep = nullptr; if ((sep = strstr(ocl_vendor,":"))) { *sep = '\0'; _platform_id = atoi(ocl_vendor); @@ -182,7 +182,7 @@ template int DeviceT::set_ocl_params(char *ocl_vendor) { #ifdef USE_OPENCL std::string s_vendor=OCL_DEFAULT_VENDOR; - if (ocl_vendor!=NULL) + if (ocl_vendor!=nullptr) s_vendor=ocl_vendor; if (s_vendor=="none") s_vendor="generic"; @@ -215,14 +215,14 @@ int DeviceT::set_ocl_params(char *ocl_vendor) { int token_count=0; std::string params[13]; char *pch = strtok(ocl_vendor,","); - pch = strtok(NULL,","); - if (pch == NULL) return -11; - while (pch != NULL) { + pch = strtok(nullptr,","); + if (pch == nullptr) return -11; + while (pch != nullptr) { if (token_count==13) return -11; params[token_count]=pch; token_count++; - pch = strtok(NULL,","); + pch = strtok(nullptr,","); } _ocl_vendor_string+=" -DMEM_THREADS="+params[0]+ " -DTHREADS_PER_ATOM="+params[1]+ @@ -430,9 +430,9 @@ template void DeviceT::estimate_gpu_overhead(const int kernel_calls, double &gpu_overhead, double &gpu_driver_overhead) { - UCL_H_Vec *host_data_in=NULL, *host_data_out=NULL; - UCL_D_Vec *dev_data_in=NULL, *dev_data_out=NULL, *kernel_data=NULL; - UCL_Timer *timers_in=NULL, *timers_out=NULL, *timers_kernel=NULL; + UCL_H_Vec *host_data_in=nullptr, *host_data_out=nullptr; + UCL_D_Vec *dev_data_in=nullptr, *dev_data_out=nullptr, *kernel_data=nullptr; + UCL_Timer *timers_in=nullptr, *timers_out=nullptr, *timers_kernel=nullptr; UCL_Timer over_timer(*gpu); if (_data_in_estimate>0) { diff --git a/lib/gpu/lal_eam.cpp b/lib/gpu/lal_eam.cpp index 8c81353f36..03479cd16a 100644 --- a/lib/gpu/lal_eam.cpp +++ b/lib/gpu/lal_eam.cpp @@ -380,7 +380,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -394,7 +394,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; } else { this->atom->cast_x_data(host_x,host_type); this->atom->add_x_data(host_x,host_type); @@ -429,7 +429,7 @@ void EAMT::compute2(int *ilist, const bool eflag, const bool vflag, time_fp2.stop(); loop2(eflag,vflag); - if (ilist == NULL) + if (ilist == nullptr) this->ans->copy_answers(eflag,vflag,eatom,vatom); else this->ans->copy_answers(eflag,vflag,eatom,vatom, ilist); diff --git a/lib/gpu/lal_lj_tip4p_long.cpp b/lib/gpu/lal_lj_tip4p_long.cpp index bb848ad5c3..1f3b32248c 100644 --- a/lib/gpu/lal_lj_tip4p_long.cpp +++ b/lib/gpu/lal_lj_tip4p_long.cpp @@ -340,7 +340,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } this->hd_balancer.balance(cpu_time); @@ -353,7 +353,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->atom->cast_q_data(host_q); this->hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_neighbor.cpp b/lib/gpu/lal_neighbor.cpp index 3e128bcf57..6c4890ef47 100644 --- a/lib/gpu/lal_neighbor.cpp +++ b/lib/gpu/lal_neighbor.cpp @@ -158,7 +158,7 @@ void Neighbor::alloc(bool &success) { } _c_bytes+=nbor_host.device.row_bytes()+dev_numj_host.row_bytes(); } else { - // Some OpenCL implementations return errors for NULL pointers as args + // Some OpenCL implementations return errors for nullptr pointers as args nbor_host.device.view(dev_nbor); dev_numj_host.view(dev_nbor); } diff --git a/lib/gpu/lal_pppm.cpp b/lib/gpu/lal_pppm.cpp index 84d6c16e14..6b5bf88ea5 100644 --- a/lib/gpu/lal_pppm.cpp +++ b/lib/gpu/lal_pppm.cpp @@ -35,7 +35,7 @@ PPPMT::PPPM() : _allocated(false), _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); - pppm_program=NULL; + pppm_program=nullptr; } template diff --git a/lib/gpu/lal_pppm_ext.cpp b/lib/gpu/lal_pppm_ext.cpp index a75536eb19..b826881392 100644 --- a/lib/gpu/lal_pppm_ext.cpp +++ b/lib/gpu/lal_pppm_ext.cpp @@ -56,7 +56,7 @@ grdtyp * pppm_gpu_init(memtyp &pppm, const int nlocal, const int nall, } success=0; - grdtyp * host_brick=NULL; + grdtyp * host_brick=nullptr; if (world_me==0) host_brick=pppm.init(nlocal,nall,screen,order,nxlo_out,nylo_out,nzlo_out, nxhi_out,nyhi_out,nzhi_out,rho_coeff,vd_brick, @@ -129,7 +129,7 @@ double pppm_gpu_bytes_f() { void pppm_gpu_forces_f(double **f) { double etmp; PPPMF.atom->data_unavail(); - PPPMF.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMF.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } double * pppm_gpu_init_d(const int nlocal, const int nall, FILE *screen, @@ -173,6 +173,6 @@ double pppm_gpu_bytes_d() { void pppm_gpu_forces_d(double **f) { double etmp; PPPMD.atom->data_unavail(); - PPPMD.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMD.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } diff --git a/lib/gpu/lal_yukawa_colloid.cpp b/lib/gpu/lal_yukawa_colloid.cpp index e71e962ffd..46d4d64328 100644 --- a/lib/gpu/lal_yukawa_colloid.cpp +++ b/lib/gpu/lal_yukawa_colloid.cpp @@ -213,7 +213,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -227,7 +227,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->cast_rad_data(rad); this->hd_balancer.start_timer(); } else { diff --git a/lib/kokkos/cmake/compile_tests/pthread.cpp b/lib/kokkos/cmake/compile_tests/pthread.cpp index 92310da029..7fa98611be 100644 --- a/lib/kokkos/cmake/compile_tests/pthread.cpp +++ b/lib/kokkos/cmake/compile_tests/pthread.cpp @@ -4,11 +4,11 @@ void* kokkos_test(void* args) { return args; } int main(void) { pthread_t thread; - /* Use NULL to avoid C++11. Some compilers + /* Use nullptr to avoid C++11. Some compilers do not have C++11 by default. Forcing C++11 in the compile tests can be done, but is unnecessary */ - pthread_create(&thread, NULL, kokkos_test, NULL); - pthread_join(thread, NULL); + pthread_create(&thread, nullptr, kokkos_test, nullptr); + pthread_join(thread, nullptr); return 0; } diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index a97fb2f7cc..d4db2c538d 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -640,7 +640,7 @@ void SharedAllocationRecord:: /*--------------------------------------------------------------------------*/ void* hip_resize_scratch_space(size_t bytes, bool force_shrink) { - static void* ptr = NULL; + static void* ptr = nullptr; static size_t current_size = 0; if (current_size == 0) { current_size = bytes; diff --git a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp index fad36c02f1..613793fc60 100644 --- a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp @@ -139,7 +139,7 @@ void *HBWSpace::allocate(const char *arg_label, const size_t arg_alloc_size, } msg << " ]( " << arg_alloc_size << " ) FAILED"; if (ptr == nullptr) { - msg << " nullptr"; + msg << " NULL"; } else { msg << " NOT ALIGNED " << ptr; } diff --git a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp index a9a2778813..2b11adbf6d 100644 --- a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp @@ -215,7 +215,7 @@ SharedAllocationRecord::SharedAllocationRecord( } else { Kokkos::Impl::throw_runtime_exception( - "Kokkos::Impl::SharedAllocationRecord given nullptr allocation"); + "Kokkos::Impl::SharedAllocationRecord given NULL allocation"); } } diff --git a/lib/kokkos/core/unit_test/TestCTestDevice.cpp b/lib/kokkos/core/unit_test/TestCTestDevice.cpp index b2ee79b856..c54c75f94b 100644 --- a/lib/kokkos/core/unit_test/TestCTestDevice.cpp +++ b/lib/kokkos/core/unit_test/TestCTestDevice.cpp @@ -13,7 +13,7 @@ int setenv(const char *name, const char *value, int overwrite) { int errcode = 0; if (!overwrite) { size_t envsize = 0; - errcode = getenv_s(&envsize, NULL, 0, name); + errcode = getenv_s(&envsize, nullptr, 0, name); if (errcode || envsize) return errcode; } return _putenv_s(name, value); diff --git a/lib/message/cslib/src/STUBS_ZMQ/zmq.h b/lib/message/cslib/src/STUBS_ZMQ/zmq.h index a335ee5e01..98cb937ed1 100644 --- a/lib/message/cslib/src/STUBS_ZMQ/zmq.h +++ b/lib/message/cslib/src/STUBS_ZMQ/zmq.h @@ -24,10 +24,10 @@ namespace CSLIB_NS { #define ZMQ_REQ 0 #define ZMQ_REP 0 -static void *zmq_ctx_new() {return NULL;} -static void *zmq_connect(void *, char *) {return NULL;} +static void *zmq_ctx_new() {return nullptr;} +static void *zmq_connect(void *, char *) {return nullptr;} static int zmq_bind(void *, char *) {return 0;} -static void *zmq_socket(void *,int) {return NULL;} +static void *zmq_socket(void *,int) {return nullptr;} static void zmq_close(void *) {} static void zmq_ctx_destroy(void *) {} static void zmq_send(void *, void *, int, int) {} diff --git a/lib/message/cslib/src/cslib.cpp b/lib/message/cslib/src/cslib.cpp index 7c75a39929..20292329ac 100644 --- a/lib/message/cslib/src/cslib.cpp +++ b/lib/message/cslib/src/cslib.cpp @@ -57,7 +57,7 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) else if (csflag == 1) server = 1; else error_all("constructor(): Invalid client/server arg"); - if (pcomm == NULL) { + if (pcomm == nullptr) { me = 0; nprocs = 1; @@ -82,19 +82,19 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) } maxfield = 0; - fieldID = fieldtype = fieldlen = fieldoffset = NULL; + fieldID = fieldtype = fieldlen = fieldoffset = nullptr; maxheader = 0; - header = NULL; + header = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; - recvcounts = displs = NULL; + recvcounts = displs = nullptr; maxglobal = 0; - allids = NULL; + allids = nullptr; maxfieldbytes = 0; - fielddata = NULL; + fielddata = nullptr; - pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing NULL + pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing nullptr nsend = nrecv = 0; } @@ -218,7 +218,7 @@ void CSlib::pack_parallel(int id, int ftype, // nlocal datums, each of nper length, from all procs // final data in buf = datums for all natoms, ordered by ids - if (recvcounts == NULL) { + if (recvcounts == nullptr) { recvcounts = (int *) smalloc(nprocs*sizeof(int)); displs = (int *) smalloc(nprocs*sizeof(int)); } @@ -706,9 +706,9 @@ void CSlib::deallocate_fields() void *CSlib::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"malloc(): Failed to allocate %d bytes",nbytes); error_one(str); @@ -722,11 +722,11 @@ void *CSlib::srealloc(void *ptr, int nbytes) { if (nbytes == 0) { sfree(ptr); - return NULL; + return nullptr; } ptr = realloc(ptr,nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"realloc(): Failed to reallocate %d bytes",nbytes); error_one(str); @@ -738,7 +738,7 @@ void *CSlib::srealloc(void *ptr, int nbytes) void CSlib::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/cslib_wrap.cpp b/lib/message/cslib/src/cslib_wrap.cpp index 64b4d53b25..cb132c2382 100644 --- a/lib/message/cslib/src/cslib_wrap.cpp +++ b/lib/message/cslib/src/cslib_wrap.cpp @@ -44,7 +44,7 @@ void cslib_open_fortran(int csflag, const char *mode, const char *str, const void *pcomm, void **csptr) { MPI_Comm ccomm; - void *pccomm = NULL; + void *pccomm = nullptr; if (pcomm) { MPI_Fint *fcomm = (MPI_Fint *) pcomm; diff --git a/lib/message/cslib/src/msg.cpp b/lib/message/cslib/src/msg.cpp index ff654ecbcf..dcd78fb739 100644 --- a/lib/message/cslib/src/msg.cpp +++ b/lib/message/cslib/src/msg.cpp @@ -80,9 +80,9 @@ void Msg::allocate(int nheader, int &maxheader, int *&header, void *Msg::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = (void *) malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"Failed to allocate %d bytes",nbytes); } @@ -93,7 +93,7 @@ void *Msg::smalloc(int nbytes) void Msg::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/msg_mpi_two.cpp b/lib/message/cslib/src/msg_mpi_two.cpp index 2a4fa65ff7..d365e20849 100644 --- a/lib/message/cslib/src/msg_mpi_two.cpp +++ b/lib/message/cslib/src/msg_mpi_two.cpp @@ -52,7 +52,7 @@ void MsgMPITwo::init(char *filename) { if (client) { if (me == 0) { - FILE *fp = NULL; + FILE *fp = nullptr; while (!fp) { fp = fopen(filename,"r"); if (!fp) sleep(1); diff --git a/lib/message/cslib/src/msg_zmq.cpp b/lib/message/cslib/src/msg_zmq.cpp index 8bee3aebde..07920c6b5c 100644 --- a/lib/message/cslib/src/msg_zmq.cpp +++ b/lib/message/cslib/src/msg_zmq.cpp @@ -99,12 +99,12 @@ void MsgZMQ::send(int nheader, int *header, int nbuf, char *buf) if (me == 0) { zmq_send(socket,lengths,2*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) { zmq_send(socket,header,nheader*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) zmq_send(socket,buf,nbuf,0); @@ -125,7 +125,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) { if (me == 0) { zmq_recv(socket,lengths,2*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(lengths,2,MPI_INT,0,world); @@ -135,7 +135,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) if (me == 0) { zmq_recv(socket,header,nheader*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(header,nheader,MPI_INT,0,world); diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 057c403369..2b7c57b840 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -193,7 +193,7 @@ typedef struct molfile_timestep_metadata { typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ float *velocities; /**< space for velocities of all atoms; same layout */ - /**< NULL unless has_velocities is set */ + /**< nullptr unless has_velocities is set */ /*@{*/ /** @@ -517,7 +517,7 @@ typedef struct { * form {orbital1(c1),orbital1(c2),.....,orbitalM(cN)} */ float *orbital_energies; /**< list of orbital energies for wavefunction */ float *occupancies; /**< orbital occupancies */ - int *orbital_ids; /**< orbital ID numbers; If NULL then VMD will + int *orbital_ids; /**< orbital ID numbers; If nullptr then VMD will * assume 1,2,3,...num_orbs. */ } molfile_qm_wavefunction_t; @@ -588,7 +588,7 @@ color r, g, b /** - * Main file reader API. Any function in this struct may be NULL + * Main file reader API. Any function in this struct may be nullptr * if not implemented by the plugin; the application checks this to determine * what functionality is present in the plugin. */ @@ -599,7 +599,7 @@ typedef struct { vmdplugin_HEAD /** - * Filename extension for this file type. May be NULL if no filename + * Filename extension for this file type. May be nullptr if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" @@ -611,7 +611,7 @@ typedef struct { const char *filename_extension; /** - * Try to open the file for reading. Return an opaque handle, or NULL on + * Try to open the file for reading. Return an opaque handle, or nullptr on * failure. Set the number of atoms; if the number of atoms cannot be * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; @@ -638,20 +638,20 @@ typedef struct { * the caller. * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be - * set to 0 and from/to should be set to NULL to indicate that no bond + * set to 0 and from/to should be set to nullptr to indicate that no bond * information was actually present, and automatic bond search should be * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to NULL, in which case the caller will provide a + * pointer should be set to nullptr, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array * will contain the bond type index for each from/to pair. These numbers * are consecutive integers starting from 0. * the bondtypenames list, contains the corresponding names, if available, - * as a NULL string terminated list. nbondtypes is provided for convenience + * as a nullptr string terminated list. nbondtypes is provided for convenience * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. @@ -666,7 +666,7 @@ typedef struct { * new QM-capable version named read_timestep(), when finished. * * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is nullptr, then * the frame should be skipped. Otherwise, the application must prepare * molfile_timestep_t by allocating space in coords for the corresponding * number of coordinates. @@ -684,7 +684,7 @@ typedef struct { /** * Open a coordinate file for writing using the given header information. - * Return an opaque handle, or NULL on failure. The application must + * Return an opaque handle, or nullptr on failure. The application must * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ @@ -757,7 +757,7 @@ typedef struct { * from/to and to/from versions of each. * This function must be called before write_structure(). * - * Like the read_bonds() routine, the bondorder pointer is set to NULL + * Like the read_bonds() routine, the bondorder pointer is set to nullptr * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. @@ -767,7 +767,7 @@ typedef struct { * index (consecutive integers starting from 0) and bondtypenames * contain the corresponding strings, in case the naming/numbering * scheme is different from the index numbers. - * if the pointers are set to NULL, then this information is not available. + * if the pointers are set to nullptr, then this information is not available. * bondtypenames can only be used of bondtypes is also given. * Return MOLFILE_SUCCESS if no errors occur. */ @@ -842,13 +842,13 @@ typedef struct { /** * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are NULL, then the coordinate or qm data should be skipped. + * arguments are nullptr, then the coordinate or qm data should be skipped. * Otherwise, the application must prepare molfile_timestep_t and * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or NULL pointers for the molfile_timestep_t and + * valid, or nullptr pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. * The natoms and qm metadata parameters exist because some file formats @@ -886,9 +886,9 @@ typedef struct { * caller the ability to prioritize, buffer, and redirect console messages * to an appropriate output channel, window, etc. This enables the use of * graphical consoles like TkCon without losing console output from plugins. - * If the function pointer is NULL, no console output service is provided + * If the function pointer is nullptr, no console output service is provided * by the calling application, and the output should default to stdout - * stream. If the function pointer is non-NULL, all output will be + * stream. If the function pointer is non-nullptr, all output will be * subsequently dealt with by the calling application. * * XXX this should really be put into a separate block of diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index 4fc8785dd7..c1c45a86a7 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != NULL) + if(currentNode != nullptr) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != NULL); //repeat this until all chains have been added + while(currentNode != nullptr); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null + if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null { - return NULL; + return nullptr; } int * tmp; - POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = NULL; //temporary variable to hold data - while(tempNode != NULL) //when we have followed all links, stop + POEMSChain * tempChain = nullptr; //temporary variable to hold data + while(tempNode != nullptr) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == NULL) + if(aNode == nullptr) { - return NULL; + return nullptr; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == NULL) //and if we find nothing... + if(returnVal == nullptr) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == NULL) //if we could not find any chains + if(returnVal == nullptr) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be NULL if no new chains are + return returnVal; //return what we find (will be nullptr if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists + while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != NULL || tmp2->value != NULL) //go through the list + while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 446fa2013f..04f0f4b79b 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); +TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value NULL +// The pointers have default value nullptr TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == NULL) + if (p == nullptr) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=NULL) + if(t !=nullptr) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == NULL && t->Right() == NULL) + if (t->Left() == nullptr && t->Right() == nullptr) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == NULL) + if (t == nullptr) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=NULL - if (t != NULL) + //print tree with root t, as long as t!=nullptr + if (t != nullptr) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index ee07a33255..14f5fd4008 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = NULL); + void Insert(const int& item, const int& data, void * AuxData = nullptr); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = NULL; + DeleteAuxData = nullptr; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return NULL +// address and a pointer to its parent; otherwise, return nullptr TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is NULL - parent = NULL; + // the parent of the root is nullptr + parent = nullptr; // terminate on empty subtree - while(t != NULL) + while(t != nullptr) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; NULL if not found + // return pointer to node; nullptr if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != NULL) + if (current != nullptr) { item = current->data; return current->GetAuxData(); } else // item not found in the tree. return False - return NULL; + return nullptr; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,NULL,NULL); + newNode = GetTreeNode(item,nullptr,nullptr); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == NULL) + if (tree == nullptr) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) + if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) return; - // If D has NULL pointer, the + // If D has nullptr pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == NULL) + if (DNodePtr->right == nullptr) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == NULL) + else if (DNodePtr->left == nullptr) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-NULL + // Both pointers of DNodePtr are non-nullptr else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != NULL) + while (RNodePtr->right != nullptr) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == NULL) + if (PNodePtr == nullptr) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=NULL && current->data == item) + if (current !=nullptr && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == NULL) - return NULL; + if (t == nullptr) + return nullptr; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns NULL. + // present it makes a copy of left child or returns nullptr. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=NULL) + if (t->Left() !=nullptr) newlptr = CopyTree(t->Left()); else - newlptr = NULL; + newlptr = nullptr; - if (t->Right() !=NULL) + if (t->Right() !=nullptr) newrptr = CopyTree(t->Right()); else - newrptr = NULL; + newrptr = nullptr; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != NULL) { + if (t != nullptr) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != NULL) { - if (DeleteAuxData != NULL) { + if (aux != nullptr) { + if (DeleteAuxData != nullptr) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to NULL +// set the root pointer back to nullptr void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = NULL; // root now NULL + t = nullptr; // root now nullptr } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 051e13d6e0..52905fc40f 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value NULL assigns a empty subtree +// The pointer value nullptr assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/poemstreenode.h b/lib/poems/poemstreenode.h index a1835ba025..e5673344a9 100644 --- a/lib/poems/poemstreenode.h +++ b/lib/poems/poemstreenode.h @@ -18,7 +18,7 @@ #ifndef TREENODE_H #define TREENODE_H -//#define NULL 0 +//#define nullptr 0 //Tree depends on TreeNode diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 67f5b607e3..7b1e718b93 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return NULL; + default: return nullptr; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 369213f7d0..23554f4117 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = NULL; + mappings = nullptr; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 2b3257b0dd..21819d4c02 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = NULL; + system = nullptr; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != NULL) { + while(NodeValue != nullptr) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return NULL; + return nullptr; } } diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 889563f617..2242fba026 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -38,7 +38,7 @@ enum{ROTATE,ALL}; ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL), tbias(NULL), avec(NULL) + id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/asphere command"); @@ -49,7 +49,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 89350dd00f..3878f7e4de 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -461,20 +461,20 @@ void PairGayBerne::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -506,12 +506,12 @@ void PairGayBerne::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&gamma,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&gamma,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&gamma,1,MPI_DOUBLE,0,world); MPI_Bcast(&upsilon,1,MPI_DOUBLE,0,world); diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 6397e77f5b..ba565c5922 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; PairLineLJ::PairLineLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index 81fb4d4b6c..c234ce27bf 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -439,20 +439,20 @@ void PairRESquared::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -480,8 +480,8 @@ void PairRESquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index cf89cf9d33..79253140c0 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; PairTriLJ::PairTriLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index e63d50f814..2619f0cf1b 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -30,7 +30,7 @@ enum{SPHERE,LINE,TRI}; // also in DumpImage /* ---------------------------------------------------------------------- */ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : - Body(lmp, narg, arg), imflag(NULL), imdata(NULL) + Body(lmp, narg, arg), imflag(nullptr), imdata(nullptr) { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); @@ -194,7 +194,7 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index c43484dca2..f2e798c93c 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -321,7 +321,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolygon::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index 18fd65c1dd..b647c7e541 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -122,7 +122,7 @@ int BodyRoundedPolyhedron::nfaces(AtomVecBody::Bonus *bonus) double *BodyRoundedPolyhedron::faces(AtomVecBody::Bonus *bonus) { int nvertices = bonus->ivalue[0]; - if (nvertices == 1 || nvertices == 2) return NULL; + if (nvertices == 1 || nvertices == 2) return nullptr; return bonus->dvalue+3*nsub(bonus)+2*nedges(bonus); } @@ -373,7 +373,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolyhedron::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index cf570d71a3..940250d160 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,INDEX}; /* ---------------------------------------------------------------------- */ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), which(NULL), index(NULL), avec(NULL), bptr(NULL) + Compute(lmp, narg, arg), which(nullptr), index(nullptr), avec(nullptr), bptr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute body/local command"); @@ -66,8 +66,8 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index 18c301678a..6903f7a25c 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -36,7 +36,7 @@ enum{ROTATE,ALL}; /* ---------------------------------------------------------------------- */ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_bias(NULL), tbias(NULL), avec(NULL) + Compute(lmp, narg, arg), id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/body command"); @@ -47,7 +47,7 @@ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index ccfd37bbb2..99ae8ed094 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -133,15 +133,15 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -226,7 +226,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 161f8d6d6d..2507b94d25 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -132,19 +132,19 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -233,7 +233,7 @@ void FixWallBodyPolyhedron::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index ece23d9522..92ae392cd7 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; PairBodyNparticle::PairBodyNparticle(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index fa5a8e57da..b7fa88b740 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -53,16 +53,16 @@ enum {INVALID=0,NONE=1,VERTEXI=2,VERTEXJ=3,EDGE=4}; PairBodyRoundedPolygon::PairBodyRoundedPolygon(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -458,7 +458,7 @@ void PairBodyRoundedPolygon::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index d376ac759e..1d7461199d 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -58,20 +58,20 @@ enum {EF_INVALID=0,EF_NONE,EF_PARALLEL,EF_SAME_SIDE_OF_FACE, PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -81,8 +81,8 @@ PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) mu = 0.0; A_ua = 1.0; - k_n = NULL; - k_na = NULL; + k_n = nullptr; + k_na = nullptr; } /* ---------------------------------------------------------------------- */ @@ -440,7 +440,7 @@ void PairBodyRoundedPolyhedron::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = facnum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; @@ -884,7 +884,7 @@ void PairBodyRoundedPolyhedron::sphere_against_face(int ibody, int jbody, project_pt_plane(x[jbody], xi1, xi2, xi3, h, d, inside); - inside_polygon(ibody, ni, x[ibody], h, NULL, inside, tmp); + inside_polygon(ibody, ni, x[ibody], h, nullptr, inside, tmp); if (inside == 0) continue; delx = h[0] - x[jbody][0]; @@ -1880,7 +1880,7 @@ void PairBodyRoundedPolyhedron::project_pt_plane(const double* q, face_index = face index of the body xmi = atom i's coordinates q1 = tested point on the face (e.g. the projection of a point) - q2 = another point (can be NULL) for face-edge intersection + q2 = another point (can be nullptr) for face-edge intersection Output: inside1 = 1 if q1 is inside the polygon, 0 otherwise inside2 = 1 if q2 is inside the polygon, 0 otherwise @@ -1929,7 +1929,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, anglesum1 += acos(costheta); } - if (q2 != NULL) { + if (q2 != nullptr) { MathExtra::sub3(xi1,q2,u); MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); @@ -1945,7 +1945,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, if (fabs(anglesum1 - MY_2PI) < EPSILON) inside1 = 1; else inside1 = 0; - if (q2 != NULL) { + if (q2 != nullptr) { if (fabs(anglesum2 - MY_2PI) < EPSILON) inside2 = 1; else inside2 = 0; } diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index eea43480e1..28d081c5c9 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -373,19 +373,19 @@ void AngleClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index a97b06a3c7..8a84717228 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -184,10 +184,10 @@ void BondClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -228,5 +228,5 @@ void *BondClass2::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 5be522f2c9..5a0300359d 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -834,45 +834,45 @@ void DihedralClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 0b07a7d60c..801c21c3b4 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -598,15 +598,15 @@ void ImproperClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - - utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + + utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index bb1dfe0ab3..fdfaf158ef 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -509,7 +509,7 @@ void PairLJClass2::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -612,13 +612,13 @@ void PairLJClass2::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -647,10 +647,10 @@ void PairLJClass2::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -707,5 +707,5 @@ void *PairLJClass2::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 8375043ed8..df0019c251 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -364,14 +364,14 @@ void PairLJClass2CoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairLJClass2CoulCut::write_restart_settings(FILE *fp) void PairLJClass2CoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -478,6 +478,6 @@ void *PairLJClass2CoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 3b9ef8deaf..68a5bd2171 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -47,8 +47,8 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - cut_respa = NULL; + ftable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -691,11 +691,11 @@ void PairLJClass2CoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -807,13 +807,13 @@ void PairLJClass2CoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -844,13 +844,13 @@ void PairLJClass2CoulLong::write_restart_settings(FILE *fp) void PairLJClass2CoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -956,5 +956,5 @@ void *PairLJClass2CoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index 786be66c70..9ec25eeccd 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -51,7 +51,7 @@ enum{EDGE,CONSTANT,VARIABLE}; PairBrownian::PairBrownian(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -497,7 +497,7 @@ void PairBrownian::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); @@ -603,12 +603,12 @@ void PairBrownian::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -643,17 +643,17 @@ void PairBrownian::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_target, sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed, sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_target, sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed, sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index 9c2593ffb1..c71c0aa3ef 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -358,7 +358,7 @@ void PairBrownianPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index f95645c613..3ac4d8f2b1 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -395,15 +395,15 @@ void PairColloid::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (comm->me == 0) { - utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -433,9 +433,9 @@ void PairColloid::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index 867bb91979..4e0bf33442 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -566,7 +566,7 @@ void PairLubricate::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair lubricate"); @@ -683,12 +683,12 @@ void PairLubricate::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -721,15 +721,15 @@ void PairLubricate::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 2df1ecaaa6..b3420154fb 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -58,10 +58,10 @@ PairLubricateU::PairLubricateU(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nmax = 0; - fl = Tl = xl = NULL; + fl = Tl = xl = nullptr; cgmax = 0; - bcg = xcg = rcg = rcg1 = pcg = RU = NULL; + bcg = xcg = rcg = rcg1 = pcg = RU = nullptr; // set comm size needed by this Pair @@ -1794,7 +1794,7 @@ void PairLubricateU::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -1909,12 +1909,12 @@ void PairLubricateU::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -1946,14 +1946,14 @@ void PairLubricateU::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 8483bb0f51..501977187b 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -1158,7 +1158,7 @@ void PairLubricateUPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL){ + else if (strstr(modify->fix[i]->style,"wall") != nullptr){ if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index 351757e09b..244b37457b 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -468,7 +468,7 @@ void PairLubricatePoly::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -478,7 +478,7 @@ void PairLubricatePoly::init_style() if (wallfix->xflag) flagwall = 2; // Moving walls exist } - if (strstr(modify->fix[i]->style,"wall") != NULL){ + if (strstr(modify->fix[i]->style,"wall") != nullptr){ flagwall = 1; // Walls exist if (((FixWall *) modify->fix[i])->xflag ) { flagwall = 2; // Moving walls exist diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 484175762e..9cc1439e66 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtomGZ::~DumpAtomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -102,8 +102,8 @@ void DumpAtomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpAtomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 18f0fa56d7..b6a94e587d 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -41,8 +41,8 @@ DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFGGZ::~DumpCFGGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -106,8 +106,8 @@ void DumpCFGGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -163,7 +163,7 @@ void DumpCFGGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index fb2b121f7f..af37ff0a1d 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustomGZ::~DumpCustomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpCustomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpCustomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 49a3c3bef2..fc7b534727 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocalGZ::~DumpLocalGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpLocalGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -170,7 +170,7 @@ void DumpLocalGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index cc07b1ce61..24b4a7a070 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZGZ::~DumpXYZGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -103,8 +103,8 @@ void DumpXYZGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -134,7 +134,7 @@ void DumpXYZGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 1b7eb1e43f..06754003f6 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), vint(NULL), id_fix(NULL), fix(NULL) + Compute(lmp, narg, arg), vint(nullptr), id_fix(nullptr), fix(nullptr) { if (narg != 5) error->all(FLERR,"Illegal compute temp/cs command"); @@ -94,7 +94,7 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : vector = new double[size_vector]; maxatom = 0; - vint = NULL; + vint = nullptr; // set comm size needed by this Compute diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index d50138145a..58f58db1bf 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairBornCoulLongCS::PairBornCoulLongCS(LAMMPS *lmp) : PairBornCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; writedata = 1; } diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index dd43f7f4bd..f8a00a3489 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -43,7 +43,7 @@ PairBuckCoulLongCS::PairBuckCoulLongCS(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 1; writedata = 1; single_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index ee03780a02..6a2117149f 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairCoulLongCS::PairCoulLongCS(LAMMPS *lmp) : PairCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp index 75e3f5ed17..81336e6810 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongCS::PairLJClass2CoulLongCS(LAMMPS *lmp) : PairLJClass2CoulLo respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index 9d60dfdbf6..89523032a0 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -44,7 +44,7 @@ PairLJCutCoulLongCS::PairLJCutCoulLongCS(LAMMPS *lmp) : PairLJCutCoulLong(lmp) respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 25fed599db..d7f3201805 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -438,14 +438,14 @@ void PairLJCutDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -474,10 +474,10 @@ void PairLJCutDipoleCut::write_restart_settings(FILE *fp) void PairLJCutDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 67d2e0aa3c..e6fe0e8dca 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -446,7 +446,7 @@ void PairLJCutDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -490,13 +490,13 @@ void PairLJCutDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,10 +524,10 @@ void PairLJCutDipoleLong::write_restart_settings(FILE *fp) void PairLJCutDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -552,5 +552,5 @@ void *PairLJCutDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 86e143626d..33ee57b83d 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -58,7 +58,7 @@ PairLJLongDipoleLong::PairLJLongDipoleLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongDipoleLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/dipole/long command"); @@ -168,10 +168,10 @@ void *PairLJLongDipoleLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_vdwl", NULL}; + "cut_coul", "cut_vdwl", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, &cut_coul, - &cut_lj_global, NULL}; + &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -220,8 +220,8 @@ void PairLJLongDipoleLong::coeff(int narg, char **arg) void PairLJLongDipoleLong::init_style() { - const char *style3[] = {"ewald/disp", NULL}; - const char *style6[] = {"ewald/disp", NULL}; + const char *style3[] = {"ewald/disp", nullptr}; + const char *style6[] = {"ewald/disp", nullptr}; int i; if (strcmp(update->unit_style,"electron") == 0) @@ -242,14 +242,14 @@ void PairLJLongDipoleLong::init_style() // ensure use of KSpace long-range solver, set g_ewald if (ewald_order&(1<<3)) { // r^-1 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style3[i]&&strcmp(force->kspace_style, style3[i]); ++i); if (!style3[i]) error->all(FLERR,"Pair style requires use of kspace_style ewald/disp"); } if (ewald_order&(1<<6)) { // r^-6 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style6[i]&&strcmp(force->kspace_style, style6[i]); ++i); if (!style6[i]) @@ -343,13 +343,13 @@ void PairLJLongDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -378,11 +378,11 @@ void PairLJLongDipoleLong::write_restart_settings(FILE *fp) void PairLJLongDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 15bc42c37e..c33b496150 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -118,7 +118,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : int newtonflag = 0; int threads_per_atom = -1; double binsize = 0.0; - char *opencl_flags = NULL; + char *opencl_flags = nullptr; int block_pair = -1; int iarg = 4; @@ -232,7 +232,7 @@ void FixGPU::init() // make sure fdotr virial is not accumulated multiple times - if (force->pair_match("^hybrid",0) != NULL) { + if (force->pair_match("^hybrid",0) != nullptr) { PairHybrid *hybrid = (PairHybrid *) force->pair; for (int i = 0; i < hybrid->nstyles; i++) if (!utils::strmatch(hybrid->keywords[i],"/gpu$")) diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index c27c670f2a..dbcb3bcf3f 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -189,7 +189,7 @@ void PairBornCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index a2524909e5..3a6808d43c 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -184,7 +184,7 @@ void PairBornCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index 41823fc27e..aa25fb4cbb 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -180,7 +180,7 @@ void PairBuckCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index 39737ab183..0ced57d285 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -158,7 +158,7 @@ void PairColloidGPU::init_style() } double cell_size = sqrt(maxcut) + neighbor->skin; - int **_form = NULL; + int **_form = nullptr; int n=atom->ntypes; memory->create(_form,n+1,n+1,"colloid/gpu:_form"); for (int i = 1; i <= n; i++) { diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index da59873dd2..3eb678fc79 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -154,7 +154,7 @@ void PairCoulLongCSGPU::compute(int eflag, int vflag) void PairCoulLongCSGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/cs/gpu requires atom attribute q"); @@ -175,7 +175,7 @@ void PairCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index 185d3a7f94..7eb5029558 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -149,7 +149,7 @@ void PairCoulLongGPU::compute(int eflag, int vflag) void PairCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/gpu requires atom attribute q"); @@ -170,7 +170,7 @@ void PairCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 4939537770..9dd5c85c49 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMAlloyGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_alloy_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_alloy_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_alloy_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_alloy_gpu.h b/src/GPU/pair_eam_alloy_gpu.h index 14d9a95c30..3cd78ea511 100644 --- a/src/GPU/pair_eam_alloy_gpu.h +++ b/src/GPU/pair_eam_alloy_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index eb028bc778..10f6b4ebe9 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMFSGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_fs_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_fs_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_fs_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMFSGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_fs_gpu.h b/src/GPU/pair_eam_fs_gpu.h index 70edf2164e..53825f2e8a 100644 --- a/src/GPU/pair_eam_fs_gpu.h +++ b/src/GPU/pair_eam_fs_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 3965f27c67..d8058f11ae 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -145,7 +145,7 @@ void PairEAMGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index e4742a3bef..09566f7de9 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -33,7 +33,7 @@ class PairEAMGPU : public PairEAM { void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 451799027b..58414f4e30 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -74,7 +74,7 @@ PairGayBerneGPU::PairGayBerneGPU(LAMMPS *lmp) : PairGayBerne(lmp), { quat_nmax = 0; reinitflag = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 215998bc88..e4d20e23ad 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -135,7 +135,7 @@ void PairLJ96CutGPU::compute(int eflag, int vflag) void PairLJ96CutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj96/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index 09ed178200..9210188539 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag) void PairLJCharmmCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/charmm/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCharmmCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index f6d671d95a..264ada0fd3 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -177,7 +177,7 @@ void PairLJClass2CoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 2a9d431a42..135a2a7dd9 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag) void PairLJCutCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCutCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index f5987c0ddf..f8f4af5dee 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -143,7 +143,7 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) void PairLJCutCoulMSMGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/coul/msm/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp index 7de9ae2aa6..896a0b9d4d 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp @@ -185,13 +185,13 @@ void PairLJCutDipoleLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 5656c2e18d..3fc727a4f7 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -139,7 +139,7 @@ void PairLJCutGPU::compute(int eflag, int vflag) void PairLJCutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp index 2bd7420e72..8e08075bcd 100644 --- a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp @@ -168,15 +168,15 @@ void PairLJCutTIP4PLongGPU::compute(int eflag, int vflag) void PairLJCutTIP4PLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (atom->tag_enable == 0) error->all(FLERR,"Pair style lj/cut/tip4p/long/gpu requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/gpu requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); if (atom->map_style == 2) @@ -202,7 +202,7 @@ void PairLJCutTIP4PLongGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index f13eea51e7..86ff980c7e 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJExpandCoulLongGPU::compute(int eflag, int vflag) void PairLJExpandCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJExpandCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index 4054f08523..d04a490caf 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -186,13 +186,13 @@ void PairLJSDKCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style is incompatible with KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index 60e6e935e8..70e8752918 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -136,7 +136,7 @@ void PairMIECutGPU::compute(int eflag, int vflag) void PairMIECutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with mie/cut/gpu pair style"); diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index ca70e3c337..4ce9730e0c 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -76,7 +76,7 @@ PairRESquaredGPU::PairRESquaredGPU(LAMMPS *lmp) : PairRESquared(lmp), if (!avec) error->all(FLERR,"Pair resquared/gpu requires atom style ellipsoid"); quat_nmax = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index d544534c9d..54312e4115 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -76,7 +76,7 @@ PairSWGPU::PairSWGPU(LAMMPS *lmp) : PairSW(lmp), gpu_mode(GPU_FORCE) suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -162,9 +162,9 @@ void PairSWGPU::init_style() double *epsilon, *sigma, *lambda, *gamma; double *biga, *bigb, *powerp, *powerq; double *_cut, *_cutsq, *costheta; - epsilon = sigma = lambda = gamma = NULL; - biga = bigb = powerp = powerq = NULL; - _cut = _cutsq = costheta = NULL; + epsilon = sigma = lambda = gamma = nullptr; + biga = bigb = powerp = powerq = nullptr; + _cut = _cutsq = costheta = nullptr; memory->create(epsilon,nparams,"pair:epsilon"); memory->create(sigma,nparams,"pair:sigma"); diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index 4ac674aa94..20d21615a9 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -165,8 +165,8 @@ void PairTableGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // pack tables and send them to device - double ***table_coeffs = NULL; - double **table_data = NULL; + double ***table_coeffs = nullptr; + double **table_data = nullptr; memory->create(table_coeffs, ntypes+1, ntypes+1, 6, "table:coeffs"); Table *tb; diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 885dd73d9e..b76bf99d5d 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -80,7 +80,7 @@ PairTersoffGPU::PairTersoffGPU(LAMMPS *lmp) : PairTersoff(lmp), gpu_mode(GPU_FOR suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -168,11 +168,11 @@ void PairTersoffGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index 35edd9ea22..57e13bb299 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -73,7 +73,7 @@ PairTersoffMODGPU::PairTersoffMODGPU(LAMMPS *lmp) : PairTersoffMOD(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -160,11 +160,11 @@ void PairTersoffMODGPU::init_style() double *biga, *bigb, *bigr, *bigd; double *c1, *c2, *c3, *c4, *c5, *h; double *beta, *powern, *ca1, *powern_del, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - powern_del = ca1 = NULL; - c1 = c2 = c3 = c4 = c5 = h = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + powern_del = ca1 = nullptr; + c1 = c2 = c3 = c4 = c5 = h = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index 73251ee726..5facd86254 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -81,7 +81,7 @@ PairTersoffZBLGPU::PairTersoffZBLGPU(LAMMPS *lmp) : PairTersoffZBL(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairTersoffZBLGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *Z_i, *Z_j, *ZBLcut, *ZBLexpscale, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index fe6adfef12..f462e579c5 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -141,7 +141,7 @@ void PairUFMGPU::compute(int eflag, int vflag) void PairUFMGPU::init_style() { -// cut_respa = NULL; +// cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with ufm/gpu pair style"); diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index 868b8de0c0..99a763bfbc 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -77,7 +77,7 @@ PairVashishtaGPU::PairVashishtaGPU(LAMMPS *lmp) : PairVashishta(lmp), gpu_mode(G suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairVashishtaGPU::init_style() double *bigw, *c0, *costheta, *bigb; double *big2b, *bigc; - cutsq = r0 = gamma = eta = NULL; - lam1inv = lam4inv = zizj = mbigd = NULL; - dvrc = big6w = heta = bigh = NULL; - bigw = c0 = costheta = bigb = NULL; - big2b = bigc = NULL; + cutsq = r0 = gamma = eta = nullptr; + lam1inv = lam4inv = zizj = mbigd = nullptr; + dvrc = big6w = heta = bigh = nullptr; + bigw = c0 = costheta = bigb = nullptr; + big2b = bigc = nullptr; memory->create(cutsq,nparams,"pair:cutsq"); memory->create(r0,nparams,"pair:r0"); diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index cb5e08a46d..9b753edd68 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -91,7 +91,7 @@ void PPPM_GPU_API(forces)(double **f); PPPMGPU::PPPMGPU(LAMMPS *lmp) : PPPM(lmp) { - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; kspace_split = false; im_real_space = false; @@ -117,11 +117,11 @@ void PPPMGPU::init() // thru its deallocate(), allocate() // NOTE: could free density_brick and vdxyz_brick after PPPM allocates them, // before allocating db_gpu and vd_brick down below, if don't need, - // if do this, make sure to set them to NULL + // if do this, make sure to set them to nullptr destroy_3d_offset(density_brick_gpu,nzlo_out,nylo_out); destroy_3d_offset(vd_brick,nzlo_out,nylo_out); - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; PPPM::init(); @@ -707,7 +707,7 @@ FFT_SCALAR ***PPPMGPU::create_3d_offset(int n1lo, int n1hi, int n2lo, int n2hi, void PPPMGPU::destroy_3d_offset(FFT_SCALAR ***array, int n1_offset, int n2_offset) { - if (array == NULL) return; + if (array == nullptr) return; memory->sfree(&array[n1_offset][n2_offset]); memory->sfree(array + n1_offset); } @@ -797,7 +797,7 @@ void PPPMGPU::compute_group_group(int groupbit_A, int groupbit_B, int AA_flag) // extend size of per-atom arrays if necessary // part2grid needs to be allocated - if (atom->nmax > nmax || part2grid == NULL) { + if (atom->nmax > nmax || part2grid == nullptr) { memory->destroy(part2grid); nmax = atom->nmax; memory->create(part2grid,nmax,3,"pppm:part2grid"); diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index d449bb5614..0bf900729c 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -48,10 +48,10 @@ enum{CONSTANT,EQUAL}; // same as FixGravity /* ---------------------------------------------------------------------- */ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), radius_poly(NULL), frac_poly(NULL), - idrigid(NULL), idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), - imageflags(NULL), fixrigid(NULL), fixshake(NULL), recvcounts(NULL), - displs(NULL), random(NULL), random2(NULL) + Fix(lmp, narg, arg), radius_poly(nullptr), frac_poly(nullptr), + idrigid(nullptr), idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), + imageflags(nullptr), fixrigid(nullptr), fixshake(nullptr), recvcounts(nullptr), + displs(nullptr), random(nullptr), random2(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix pour command"); @@ -344,7 +344,7 @@ void FixPour::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix pour rigid fix does not exist"); @@ -359,7 +359,7 @@ void FixPour::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix pour shake fix does not exist"); @@ -456,7 +456,7 @@ void FixPour::pre_exchange() // perform allgatherv to acquire list of nearby particles on all procs - double *ptr = NULL; + double *ptr = nullptr; if (ncount) ptr = xmine[0]; MPI_Allgatherv(ptr,4*ncount,MPI_DOUBLE, xnear[0],recvcounts,displs,MPI_DOUBLE,world); @@ -889,16 +889,16 @@ void FixPour::options(int narg, char **arg) iregion = -1; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; ignoreflag = ignoreline = ignoretri = 0; dstyle = ONE; radius_max = radius_one = 0.5; - radius_poly = frac_poly = NULL; + radius_poly = frac_poly = nullptr; density_lo = density_hi = 1.0; volfrac = 0.25; maxattempt = 50; @@ -1091,5 +1091,5 @@ void *FixPour::extract(const char *str, int &itype) itype = 0; return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 9ec76b88f1..25d271be9d 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -63,8 +63,8 @@ enum {ROLL_NONE, ROLL_SDS}; /* ---------------------------------------------------------------------- */ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), history_one(NULL), - fix_rigid(NULL), mass_rigid(NULL) + Fix(lmp, narg, arg), idregion(nullptr), history_one(nullptr), + fix_rigid(nullptr), mass_rigid(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command"); @@ -303,7 +303,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wallstyle args - idregion = NULL; + idregion = nullptr; if (strcmp(arg[iarg],"xplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); @@ -407,16 +407,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - history_one = NULL; + history_one = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // initialize history as if particle is not touching region - // history_one will be NULL for wallstyle = REGION + // history_one will be nullptr for wallstyle = REGION if (use_history && history_one) { int nlocal = atom->nlocal; @@ -471,7 +471,7 @@ void FixWallGran::init() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -576,7 +576,7 @@ void FixWallGran::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to nullptr, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential // set history if pair potential stores history @@ -681,7 +681,7 @@ void FixWallGran::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 3aa518209a..1b3be22e7f 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -103,7 +103,7 @@ class FixWallGran : public Fix { // rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 543df02fc2..f91bac2c9b 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -39,9 +39,9 @@ enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; /* ---------------------------------------------------------------------- */ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : - FixWallGran(lmp, narg, arg), region(NULL), region_style(NULL), - ncontact(NULL), - walls(NULL), history_many(NULL), c2r(NULL) + FixWallGran(lmp, narg, arg), region(nullptr), region_style(nullptr), + ncontact(nullptr), + walls(nullptr), history_many(nullptr), c2r(nullptr) { restart_global = 1; motion_resetflag = 0; @@ -61,11 +61,11 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : // do not register with Atom class, since parent class did that memory->destroy(history_one); - history_one = NULL; + history_one = nullptr; - ncontact = NULL; - walls = NULL; - history_many = NULL; + ncontact = nullptr; + walls = nullptr; + history_many = nullptr; grow_arrays(atom->nmax); // initialize shear history as if particle is not touching region @@ -262,7 +262,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 68a7803f4b..b296f84657 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -52,7 +52,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // set comm size needed by this Pair if used with fix rigid @@ -65,7 +65,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_HH_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -426,7 +426,7 @@ void PairGranHookeHistory::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -450,7 +450,7 @@ void PairGranHookeHistory::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -554,7 +554,7 @@ void PairGranHookeHistory::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -580,12 +580,12 @@ void PairGranHookeHistory::write_restart_settings(FILE *fp) void PairGranHookeHistory::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kn,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kt,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamman,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gammat,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&xmu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kn,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kt,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamman,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gammat,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&xmu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kn,1,MPI_DOUBLE,0,world); MPI_Bcast(&kt,1,MPI_DOUBLE,0,world); diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index 309af54ee6..dd9a843142 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -61,7 +61,7 @@ class PairGranHookeHistory : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index ee0eb2ad77..5edc656a67 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -73,14 +73,14 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; - onerad_dynamic = NULL; - onerad_frozen = NULL; - maxrad_dynamic = NULL; - maxrad_frozen = NULL; + onerad_dynamic = nullptr; + onerad_frozen = nullptr; + maxrad_dynamic = nullptr; + maxrad_frozen = nullptr; - history_transfer_factors = NULL; + history_transfer_factors = nullptr; dt = update->dt; @@ -97,7 +97,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -1101,7 +1101,7 @@ void PairGranular::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (use_history && fix_history == NULL) { + if (use_history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -1125,7 +1125,7 @@ void PairGranular::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -1330,20 +1330,20 @@ void PairGranular::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,NULL,error); - utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); + utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index e9ba629b49..ce417812de 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -56,7 +56,7 @@ class PairGranular : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 776d8aab98..5428b75093 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -67,8 +67,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixStoreKIM::FixStoreKIM(LAMMPS *lmp, int narg, char **arg) - : Fix(lmp, narg, arg), simulator_model(NULL), model_name(NULL), - model_units(NULL), user_units(NULL) + : Fix(lmp, narg, arg), simulator_model(nullptr), model_name(nullptr), + model_units(nullptr), user_units(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix STORE/KIM command"); } @@ -82,25 +82,25 @@ FixStoreKIM::~FixStoreKIM() if (simulator_model) { KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); - simulator_model = NULL; + simulator_model = nullptr; } if (model_name) { char *mn = (char *)model_name; delete[] mn; - model_name = NULL; + model_name = nullptr; } if (model_units) { char *mu = (char *)model_units; delete[] mu; - model_units = NULL; + model_units = nullptr; } if (user_units) { char *uu = (char *)user_units; delete[] uu; - user_units = NULL; + user_units = nullptr; } } @@ -151,5 +151,5 @@ void *FixStoreKIM::getptr(const char *name) else if (strcmp(name,"model_name") == 0) return model_name; else if (strcmp(name,"model_units") == 0) return model_units; else if (strcmp(name,"user_units") == 0) return user_units; - else return NULL; + else return nullptr; } diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 6baf480993..4e4890ea6e 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -79,8 +79,8 @@ class FixStoreKIM : public Fix { private: void *simulator_model; // pointer to KIM simulator model class void *model_name; // string of KIM model name - void *model_units; // string of unit conversion origin or NULL - void *user_units; // string of unit conversion target or NULL + void *model_units; // string of unit conversion origin or nullptr + void *user_units; // string of unit conversion target or nullptr }; } diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 684108be71..bbeffe2d82 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -96,7 +96,7 @@ void KimInit::command(int narg, char **arg) } else unit_conversion_mode = false; char *model_units; - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; if (universe->me == 0) std::remove("kim.log"); @@ -366,8 +366,8 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM if (numberOfParameters) { KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; mesg += std::to_string(numberOfParameters) + " mutable parameters. \n"; @@ -486,7 +486,7 @@ void KimInit::write_log_cite(char *model_name) int availableAsString; char const * fileString; err = KIM_Collections_GetItemMetadataFile( - coll,i,&fileName,NULL,NULL,&availableAsString,&fileString); + coll,i,&fileName,nullptr,nullptr,&availableAsString,&fileString); if (err) continue; if (0 == strncmp("kimcite",fileName,7)) { diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 5f45dd34dc..7551216072 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -103,12 +103,12 @@ void KimInteractions::do_setup(int narg, char **arg) fixed_types = false; } - char *model_name = NULL; - KIM_SimulatorModel *simulatorModel(NULL); + char *model_name = nullptr; + KIM_SimulatorModel *simulatorModel(nullptr); // check if we had a kim_init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. - // validate model name if not given as NULL. + // validate model name if not given as nullptr. int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { @@ -256,7 +256,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con FILE *fp; fp = fopen(filename.c_str(),"r"); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR,"Parameter file not found"); } @@ -266,7 +266,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 6f4ac5cc21..121f167ab6 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -185,7 +185,7 @@ void KimParam::command(int narg, char **arg) input->write_echo(fmt::format("#=== BEGIN kim-param {} ===================" "==================\n",kim_param_get_set)); - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; std::string atom_type_list; @@ -251,9 +251,9 @@ void KimParam::command(int narg, char **arg) // Get the parameters if (kim_param_get_set == "get") { // Parameter name - char *paramname = NULL; + char *paramname = nullptr; // Variable name - char *varname = NULL; + char *varname = nullptr; // Loop over all the arguments for (int i = 1; i < narg;) { @@ -267,8 +267,8 @@ void KimParam::command(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kim_error = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -344,7 +344,7 @@ void KimParam::command(int narg, char **arg) } int const nvars = nubound - nlbound + 1; - char **varsname = NULL; + char **varsname = nullptr; if (i < narg) { // Get the variable/variable_base name diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 95a1274859..4a381fb8da 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -112,7 +112,7 @@ void kimProperty::command(int narg, char **arg) PyGILState_STATE gstate = PyGILState_Ensure(); // kim_property module - PyObject *kim_property = NULL; + PyObject *kim_property = nullptr; // import kim_property { @@ -438,7 +438,7 @@ void kimProperty::command(int narg, char **arg) "evaluation failed!"); } } else - pValue = NULL; + pValue = nullptr; // Destroy the variable input->variable->set("kim_property_str delete"); diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7ed70972c5..30b5e6cbb2 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -78,9 +78,9 @@ PairKIM::PairKIM(LAMMPS *lmp) : Pair(lmp), settings_call_count(0), init_style_call_count(0), - kim_modelname(NULL), - lmps_map_species_to_unique(NULL), - lmps_unique_elements(NULL), + kim_modelname(nullptr), + lmps_map_species_to_unique(nullptr), + lmps_unique_elements(nullptr), lmps_num_unique_elements(0), lmps_units(METAL), lengthUnit(KIM_LENGTH_UNIT_unused), @@ -88,8 +88,8 @@ PairKIM::PairKIM(LAMMPS *lmp) : chargeUnit(KIM_CHARGE_UNIT_unused), temperatureUnit(KIM_TEMPERATURE_UNIT_unused), timeUnit(KIM_TIME_UNIT_unused), - pkim(NULL), - pargs(NULL), + pkim(nullptr), + pargs(nullptr), kim_model_support_for_energy(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_forces(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_particleEnergy(KIM_SUPPORT_STATUS_notSupported), @@ -97,15 +97,15 @@ PairKIM::PairKIM(LAMMPS *lmp) : lmps_local_tot_num_atoms(0), kim_global_influence_distance(0.0), kim_number_of_neighbor_lists(0), - kim_cutoff_values(NULL), - modelWillNotRequestNeighborsOfNoncontributingParticles(NULL), - neighborLists(NULL), - kim_particle_codes(NULL), + kim_cutoff_values(nullptr), + modelWillNotRequestNeighborsOfNoncontributingParticles(nullptr), + neighborLists(nullptr), + kim_particle_codes(nullptr), lmps_maxalloc(0), - kim_particleSpecies(NULL), - kim_particleContributing(NULL), - lmps_stripped_neigh_list(NULL), - lmps_stripped_neigh_ptr(NULL) + kim_particleSpecies(nullptr), + kim_particleContributing(nullptr), + lmps_stripped_neigh_list(nullptr), + lmps_stripped_neigh_ptr(nullptr) { // Initialize Pair data members to appropriate values single_enable = 0; // We do not provide the Single() function @@ -137,7 +137,7 @@ PairKIM::~PairKIM() if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } @@ -393,7 +393,7 @@ void PairKIM::coeff(int narg, char **arg) // setup mapping between LAMMPS unique elements and KIM species codes if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } kim_particle_codes = new int[lmps_num_unique_elements]; @@ -430,7 +430,7 @@ void PairKIM::coeff(int narg, char **arg) int kimerror; // Parameter name - char *paramname = NULL; + char *paramname = nullptr; for (int i = 2 + atom->ntypes; i < narg;) { // Parameter name @@ -443,8 +443,8 @@ void PairKIM::coeff(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kimerror = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -903,7 +903,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs,KIM_COMPUTE_ARGUMENT_NAME_partialEnergy, - static_cast(NULL)); + static_cast(nullptr)); } } @@ -924,7 +924,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleEnergy, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( @@ -937,7 +937,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, - static_cast(NULL)); + static_cast(nullptr)); } else { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, &(atom->f[0][0])); @@ -960,7 +960,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleVirial, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index e826a7c392..ed0cfccd43 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -87,7 +87,7 @@ AtomKokkos::~AtomKokkos() memoryKK->destroy_kokkos(k_duChem,duChem); memoryKK->destroy_kokkos(k_dvector,dvector); - dvector = NULL; + dvector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -282,7 +282,7 @@ int AtomKokkos::add_custom(const char *name, int flag) /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to NULL + free memory for vector and name and set ptrs to nullptr ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ @@ -290,14 +290,14 @@ void AtomKokkos::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { //memoryKK->destroy_kokkos(dvector); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index 662f09fe5a..3090a62d11 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -48,7 +48,7 @@ AtomVecAngleKokkos::AtomVecAngleKokkos(LAMMPS *lmp) : AtomVecKokkos(lmp) k_count = DAT::tdual_int_1d("atom::k_count",1); atomKK = (AtomKokkos *) atom; commKK = (CommKokkos *) comm; - buffer = NULL; + buffer = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index 9e39f53733..f2dca9bebc 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; AtomVecKokkos::AtomVecKokkos(LAMMPS *lmp) : AtomVec(lmp) { kokkosable = 1; - buffer = NULL; + buffer = nullptr; buffer_size = 0; no_comm_vel_flag = 0; diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 51ba6bbdb2..9e1bfcbc5c 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -45,7 +45,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) { if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]); memory->sfree(sendlist); - sendlist = NULL; + sendlist = nullptr; k_sendlist = DAT::tdual_int_2d(); k_total_send = DAT::tdual_int_scalar("comm::k_total_send"); @@ -54,9 +54,9 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) // initialize comm buffers & exchange memory memory->destroy(buf_send); - buf_send = NULL; + buf_send = nullptr; memory->destroy(buf_recv); - buf_recv = NULL; + buf_recv = nullptr; k_exchange_lists = DAT::tdual_int_2d("comm:k_exchange_lists",2,100); k_exchange_sendlist = Kokkos::subview(k_exchange_lists,0,Kokkos::ALL); @@ -65,7 +65,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) k_sendflag = DAT::tdual_int_1d("comm:k_sendflag",100); memory->destroy(maxsendlist); - maxsendlist = NULL; + maxsendlist = nullptr; memory->create(maxsendlist,maxswap,"comm:maxsendlist"); for (int i = 0; i < maxswap; i++) { maxsendlist[i] = BUFMIN; @@ -82,11 +82,11 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) CommKokkos::~CommKokkos() { memoryKK->destroy_kokkos(k_sendlist,sendlist); - sendlist = NULL; + sendlist = nullptr; memoryKK->destroy_kokkos(k_buf_send,buf_send); - buf_send = NULL; + buf_send = nullptr; memoryKK->destroy_kokkos(k_buf_recv,buf_recv); - buf_recv = NULL; + buf_recv = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fft3d_kokkos.cpp b/src/KOKKOS/fft3d_kokkos.cpp index ff95998e4e..d7f556cf87 100644 --- a/src/KOKKOS/fft3d_kokkos.cpp +++ b/src/KOKKOS/fft3d_kokkos.cpp @@ -69,7 +69,7 @@ FFT3dKokkos::FFT3dKokkos(LAMMPS *lmp, MPI_Comm comm, int nfast, int in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective,nthreads,usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ @@ -403,7 +403,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan = new struct fft_plan_3d_kokkos; remapKK = new RemapKokkos(lmp); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -422,7 +422,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; @@ -436,7 +436,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -461,7 +461,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -502,7 +502,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -521,7 +521,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remapKK->remap_3d_create_plan_kokkos(comm, @@ -530,7 +530,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -648,39 +648,39 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #elif defined(FFT_CUFFT) @@ -704,16 +704,16 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl kissfftKK = new KissFFTKokkos(); - plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,NULL,NULL); - plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,NULL,NULL); + plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,NULL,NULL); - plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,NULL,NULL); + plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -725,8 +725,8 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,NULL,NULL); - plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,NULL,NULL); + plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index dadf9e4c8b..8761b54d49 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -735,7 +735,7 @@ void FixLangevinKokkos::reset_dt() template double FixLangevinKokkos::compute_scalar() { - if (!tallyflag || flangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr) return 0.0; v = atomKK->k_v.template view(); mask = atomKK->k_mask.template view(); @@ -893,19 +893,19 @@ void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) template void FixLangevinKokkos::cleanup_copy() { - random = NULL; - tstr = NULL; - gfactor1 = NULL; - gfactor2 = NULL; - ratio = NULL; - id_temp = NULL; - flangevin = NULL; - tforce = NULL; + random = nullptr; + tstr = nullptr; + gfactor1 = nullptr; + gfactor2 = nullptr; + ratio = nullptr; + id_temp = nullptr; + flangevin = nullptr; + tforce = nullptr; gjfflag = 0; - franprev = NULL; - lv = NULL; - id = style = NULL; - vatom = NULL; + franprev = nullptr; + lv = nullptr; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index 13b9cb02a7..f123a663d2 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -34,7 +34,7 @@ FixMinimizeKokkos::FixMinimizeKokkos(LAMMPS *lmp, int narg, char **arg) : FixMinimizeKokkos::~FixMinimizeKokkos() { memoryKK->destroy_kokkos(k_vectors,vectors); - vectors = NULL; + vectors = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index d1f3f66327..56a37c8d1b 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -35,9 +35,9 @@ FixNeighHistoryKokkos::FixNeighHistoryKokkos(LAMMPS *lmp, int narg, memory->destroy(npartner); memory->sfree(partner); memory->sfree(valuepartner); - npartner = NULL; - partner = NULL; - valuepartner = NULL; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; maxpartner = 8; grow_arrays(atom->nmax); diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index beabc55727..fe6aeaccff 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -163,8 +163,8 @@ void FixNVEKokkos::final_integrate_rmass_item(int i) const template void FixNVEKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.cpp b/src/KOKKOS/fix_nve_sphere_kokkos.cpp index 64298748db..f292f30d3f 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.cpp +++ b/src/KOKKOS/fix_nve_sphere_kokkos.cpp @@ -39,8 +39,8 @@ FixNVESphereKokkos::FixNVESphereKokkos(LAMMPS *lmp, int narg, char * template void FixNVESphereKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index a71b52e0f1..0f4ab850ae 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -1423,7 +1423,7 @@ void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double template void FixQEqReaxKokkos::cleanup_copy() { - id = style = NULL; + id = style = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp index f98ab0314c..faa5a98315 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp @@ -51,7 +51,7 @@ FixReaxCBondsKokkos::~FixReaxCBondsKokkos() void FixReaxCBondsKokkos::init() { Pair *pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c/kk"); FixReaxCBonds::init(); diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxc_species_kokkos.cpp index f3bce2f9c0..4674389ed4 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_species_kokkos.cpp @@ -58,7 +58,7 @@ FixReaxCSpeciesKokkos::~FixReaxCSpeciesKokkos() void FixReaxCSpeciesKokkos::init() { Pair* pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/species/kk without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/species/kk without " "pair_style reax/c/kk"); FixReaxCSpecies::init(); diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 18bc4225a7..1ba227d539 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -62,7 +62,7 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; template FixRxKokkos::FixRxKokkos(LAMMPS *lmp, int narg, char **arg) : FixRX(lmp, narg, arg), - pairDPDEKK(NULL), + pairDPDEKK(nullptr), update_kinetics_data(true) { kokkosable = 1; @@ -117,14 +117,14 @@ void FixRxKokkos::init() //FixRX::init(); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); pairDPDEKK = dynamic_cast(pairDPDE); - if (pairDPDEKK == NULL) + if (pairDPDEKK == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy/kk with fix rx/kk"); bool eos_flag = false; @@ -964,7 +964,7 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d //const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) @@ -1111,7 +1111,7 @@ KOKKOS_INLINE_FUNCTION int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, VectorType& dydt, UserDataType& userData) const { #define kFor (userData.kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData.rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 26c6ae4ae5..0033e69649 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -121,7 +121,7 @@ class FixRxKokkos : public FixRX { value_type *m_data; KOKKOS_INLINE_FUNCTION - StridedArrayType() : m_data(NULL) {} + StridedArrayType() : m_data(nullptr) {} KOKKOS_INLINE_FUNCTION StridedArrayType(value_type *ptr) : m_data(ptr) {} diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index a11e8b4bd4..00d717c915 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -57,7 +57,7 @@ FixSetForceKokkos::~FixSetForceKokkos() if (copymode) return; memoryKK->destroy_kokkos(k_sforce,sforce); - sforce = NULL; + sforce = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void FixSetForceKokkos::post_force(int /*vflag*/) // update region if necessary - region = NULL; + region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 9be4321ff2..1779ebc855 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -63,7 +63,7 @@ using namespace random_external_state; template FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **arg) : - FixShardlow(lmp, narg, arg), k_pairDPDE(NULL), ghostmax(0), nlocal(0) , nghost(0) + FixShardlow(lmp, narg, arg), k_pairDPDE(nullptr), ghostmax(0), nlocal(0) , nghost(0) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -74,8 +74,8 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); -// k_pairDPD = NULL; - k_pairDPDE = NULL; +// k_pairDPD = nullptr; + k_pairDPDE = nullptr; // k_pairDPD = (PairDPDfdtKokkos *) force->pair_match("dpd/fdt",1); k_pairDPDE = dynamic_cast *>(force->pair_match("dpd/fdt/energy",0)); @@ -88,7 +88,7 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a // } - if(/* k_pairDPD == NULL &&*/ k_pairDPDE == NULL) + if(/* k_pairDPD == nullptr &&*/ k_pairDPDE == nullptr) error->all(FLERR,"Must use pair_style "/*"dpd/fdt/kk or "*/"dpd/fdt/energy/kk with fix shardlow/kk"); #ifdef DEBUG_SSA_PAIR_CT diff --git a/src/KOKKOS/gridcomm_kokkos.cpp b/src/KOKKOS/gridcomm_kokkos.cpp index 909e3c8544..0a175343c3 100644 --- a/src/KOKKOS/gridcomm_kokkos.cpp +++ b/src/KOKKOS/gridcomm_kokkos.cpp @@ -91,21 +91,21 @@ GridCommKokkos::~GridCommKokkos() // regular comm data struct for (int i = 0; i < nswap; i++) { - swap[i].packlist = NULL; - swap[i].unpacklist = NULL; + swap[i].packlist = nullptr; + swap[i].unpacklist = nullptr; } // tiled comm data structs for (int i = 0; i < nsend; i++) - send[i].packlist = NULL; + send[i].packlist = nullptr; for (int i = 0; i < nrecv; i++) - recv[i].unpacklist = NULL; + recv[i].unpacklist = nullptr; for (int i = 0; i < ncopy; i++) { - copy[i].packlist = NULL; - copy[i].unpacklist = NULL; + copy[i].packlist = nullptr; + copy[i].unpacklist = nullptr; } } @@ -459,7 +459,7 @@ void GridCommKokkos::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 79fd0685b0..16d906ba3c 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -226,7 +226,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int len; char mpi_version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI_Get_library_version(mpi_version, &len); - if (strstr(&mpi_version[0], "Spectrum") != NULL) { + if (strstr(&mpi_version[0], "Spectrum") != nullptr) { cuda_aware_flag = 0; char* str; if (str = getenv("OMPI_MCA_pml_pami_enable_cuda")) diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 83e8b9ec7c..df85f72c65 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -78,7 +78,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); array = data.h_view.data(); @@ -88,9 +88,9 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -100,7 +100,7 @@ void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) template TYPE destroy_kokkos(TYPE &data) { - /*if(data.data()!=NULL) + /*if(data.data()!=nullptr) free(data.data());*/ data = TYPE(); return data; @@ -186,7 +186,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); n += n2; @@ -211,7 +211,7 @@ template bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &h_data(i,0); n += n2; @@ -228,14 +228,14 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, int n2, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,n2,name); + if (array == nullptr) return create_kokkos(data,array,n1,n2,name); data.resize(n1,n2); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type**) srealloc(array,nbytes,name); for (int i = 0; i < n1; i++) if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -252,7 +252,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -263,7 +263,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); @@ -272,7 +272,7 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -286,10 +286,10 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type** &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); sfree(array); - array = NULL; + array = nullptr; } }; diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index 032538fe60..759b00976f 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -49,7 +49,7 @@ using namespace LAMMPS_NS; MinKokkos::MinKokkos(LAMMPS *lmp) : Min(lmp) { atomKK = (AtomKokkos *) atom; - fix_minimize_kk = NULL; + fix_minimize_kk = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index b21a7cb1ee..cadfccfa6b 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -41,10 +41,10 @@ NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp), neighbond_host(lmp),neighbond_device(lmp) { device_flag = 0; - bondlist = NULL; - anglelist = NULL; - dihedrallist = NULL; - improperlist = NULL; + bondlist = nullptr; + anglelist = nullptr; + dihedrallist = nullptr; + improperlist = nullptr; } /* ---------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ NeighborKokkos::~NeighborKokkos() { if (!copymode) { memoryKK->destroy_kokkos(k_cutneighsq,cutneighsq); - cutneighsq = NULL; + cutneighsq = nullptr; memoryKK->destroy_kokkos(k_ex_type,ex_type); memoryKK->destroy_kokkos(k_ex1_type,ex1_type); diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index afa8bd649a..8f874b9feb 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -48,9 +48,9 @@ PairBuckCoulCutKokkos::PairBuckCoulCutKokkos(LAMMPS *lmp):PairBuckCo execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -69,11 +69,11 @@ PairBuckCoulCutKokkos::~PairBuckCoulCutKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } } diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index a77ef291fa..6a13254e8a 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -55,8 +55,8 @@ PairBuckCoulLongKokkos::PairBuckCoulLongKokkos(LAMMPS *lmp):PairBuck execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -75,11 +75,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } } @@ -88,11 +88,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() template void PairBuckCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 71f63a9f92..efddb43a99 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -46,7 +46,7 @@ PairBuckKokkos::PairBuckKokkos(LAMMPS *lmp) : PairBuck(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -59,9 +59,9 @@ PairBuckKokkos::~PairBuckKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 8fae09e1eb..a77f738a5f 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -37,7 +37,7 @@ PairCoulCutKokkos::PairCoulCutKokkos(LAMMPS *lmp) : PairCoulCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -55,9 +55,9 @@ template void PairCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index e3326f3056..b469a2b8c1 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -46,7 +46,7 @@ PairCoulDebyeKokkos::PairCoulDebyeKokkos(LAMMPS *lmp):PairCoulDebye( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } @@ -66,9 +66,9 @@ template void PairCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 780d57d921..aeba50c0ad 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairCoulLongKokkos::PairCoulLongKokkos(LAMMPS *lmp):PairCoulLong(lmp execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_coulsq = 0.0; } @@ -71,9 +71,9 @@ PairCoulLongKokkos::~PairCoulLongKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_coulsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -82,10 +82,10 @@ PairCoulLongKokkos::~PairCoulLongKokkos() template void PairCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 280e47b771..4e0c44acba 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMAlloyKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index aee94471cf..2c4e4fdf93 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMAlloyKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index a4828c00aa..2714da9cae 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMFSKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 5f1a912f54..104ecf1a0b 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMFSKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 5992b7ed6d..99719bbe5a 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -59,7 +59,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 035bf87cec..811589972f 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -1715,16 +1715,16 @@ void PairExp6rxKokkos::read_file(char *file) char **words = new char*[params_per_line+1]; memoryKK->destroy_kokkos(k_params,params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -1741,7 +1741,7 @@ void PairExp6rxKokkos::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1763,7 +1763,7 @@ void PairExp6rxKokkos::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1783,7 +1783,7 @@ void PairExp6rxKokkos::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index a442a987f6..a1c376cdfa 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -48,8 +48,8 @@ PairGranHookeHistoryKokkos::~PairGranHookeHistoryKokkos() if (allocated) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } @@ -64,7 +64,7 @@ void PairGranHookeHistoryKokkos::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",3); char **fixarg = new char*[4]; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index b5b0a9d02b..23b8401fe8 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -87,7 +87,7 @@ void PairHybridKokkos::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 396a5f2d48..1eaf20eadb 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -94,7 +94,7 @@ struct PairComputeFunctor { dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); }; - // Call cleanup_copy which sets allocations NULL which are destructed by the PairStyle + // Call cleanup_copy which sets allocations nullptr which are destructed by the PairStyle ~PairComputeFunctor() {c.cleanup_copy();list.copymode = 1;}; KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const { diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index 2ce0569383..adfe095dc5 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -54,7 +54,7 @@ PairLJCharmmCoulCharmmImplicitKokkos::PairLJCharmmCoulCharmmImplicit execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -74,9 +74,9 @@ PairLJCharmmCoulCharmmImplicitKokkos::~PairLJCharmmCoulCharmmImplici memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -88,11 +88,11 @@ template void PairLJCharmmCoulCharmmImplicitKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index e59da8d298..a20a6242c3 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulCharmmKokkos::PairLJCharmmCoulCharmmKokkos(LAMMPS *l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulCharmmKokkos::~PairLJCharmmCoulCharmmKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulCharmmKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index a06e569ebe..2f4a03e9b0 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulLongKokkos::PairLJCharmmCoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulLongKokkos::~PairLJCharmmCoulLongKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index b45ff6d31a..799f1a2789 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -43,9 +43,9 @@ PairLJClass2CoulCutKokkos::PairLJClass2CoulCutKokkos(LAMMPS *lmp):Pa execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -67,11 +67,11 @@ template void PairLJClass2CoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index fc97c3491f..7fafd865c0 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -51,8 +51,8 @@ PairLJClass2CoulLongKokkos::PairLJClass2CoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -74,11 +74,11 @@ template void PairLJClass2CoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index a0d2fba581..6a66a8861d 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -46,7 +46,7 @@ PairLJClass2Kokkos::PairLJClass2Kokkos(LAMMPS *lmp) : PairLJClass2(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJClass2Kokkos::~PairLJClass2Kokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJClass2Kokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index d269de45e4..3749690b79 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -42,9 +42,9 @@ PairLJCutCoulCutKokkos::PairLJCutCoulCutKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -66,11 +66,11 @@ template void PairLJCutCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 05e0d15dbf..bd4530cf32 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -46,9 +46,9 @@ PairLJCutCoulDebyeKokkos::PairLJCutCoulDebyeKokkos(LAMMPS *lmp):Pair execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -70,11 +70,11 @@ template void PairLJCutCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index bdd167a299..47fa5cf114 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -56,9 +56,9 @@ PairLJCutCoulDSFKokkos::PairLJCutCoulDSFKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } @@ -80,11 +80,11 @@ template void PairLJCutCoulDSFKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index b6ea969d86..6f31a816d2 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -53,8 +53,8 @@ PairLJCutCoulLongKokkos::PairLJCutCoulLongKokkos(LAMMPS *lmp):PairLJ execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -66,8 +66,8 @@ PairLJCutCoulLongKokkos::~PairLJCutCoulLongKokkos() { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; if (allocated){ memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); @@ -80,11 +80,11 @@ template void PairLJCutCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 8294d62f68..674c54fa4c 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -41,7 +41,7 @@ PairLJCutKokkos::PairLJCutKokkos(LAMMPS *lmp) : PairLJCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,9 +54,9 @@ PairLJCutKokkos::~PairLJCutKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -66,9 +66,9 @@ template void PairLJCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index f17703e2d1..5d47e5dabe 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -46,7 +46,7 @@ PairLJExpandKokkos::PairLJExpandKokkos(LAMMPS *lmp) : PairLJExpand(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJExpandKokkos::~PairLJExpandKokkos() if (!copymode) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJExpandKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 60d18519b2..04d018257e 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -46,7 +46,7 @@ PairLJGromacsCoulGromacsKokkos::PairLJGromacsCoulGromacsKokkos(LAMMP execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -66,9 +66,9 @@ PairLJGromacsCoulGromacsKokkos::~PairLJGromacsCoulGromacsKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -80,11 +80,11 @@ template void PairLJGromacsCoulGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index d27b9e1ec6..dacf4d977e 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -46,9 +46,9 @@ PairLJGromacsKokkos::PairLJGromacsKokkos(LAMMPS *lmp):PairLJGromacs( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } @@ -63,11 +63,11 @@ PairLJGromacsKokkos::~PairLJGromacsKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_inner_sq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } } @@ -77,11 +77,11 @@ template void PairLJGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index 8b228f2c01..ddf4b4efd7 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -46,7 +46,7 @@ PairLJSDKKokkos::PairLJSDKKokkos(LAMMPS *lmp) : PairLJSDK(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJSDKKokkos::~PairLJSDKKokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJSDKKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index ba6e9ba97d..b6cf4ed8d6 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -48,7 +48,7 @@ PairMorseKokkos::PairMorseKokkos(LAMMPS *lmp) : PairMorse(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -61,9 +61,9 @@ PairMorseKokkos::~PairMorseKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -73,9 +73,9 @@ template void PairMorseKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index c4e1ae38cb..f620d194a0 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -83,7 +83,7 @@ PairMultiLucyRXKokkos::~PairMultiLucyRXKokkos() delete h_table; delete d_table; - tabindex = NULL; + tabindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -980,7 +980,7 @@ void PairMultiLucyRXKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 3a7359df93..d76cb98ec3 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -79,9 +79,9 @@ PairReaxCKokkos::~PairReaxCKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->destroy_kokkos(k_tmpid,tmpid); - tmpid = NULL; + tmpid = nullptr; memoryKK->destroy_kokkos(k_tmpbo,tmpbo); - tmpbo = NULL; + tmpbo = nullptr; // deallocate views of views in serial to prevent race condition in profiling tools @@ -137,7 +137,7 @@ void PairReaxCKokkos::init_style() { PairReaxC::init_style(); if (fix_reax) modify->delete_fix(fix_id); // not needed in the Kokkos version - fix_reax = NULL; + fix_reax = nullptr; // irequest = neigh request made by parent class diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 7a567e846b..a8a79f968f 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -61,8 +61,8 @@ PairSWKokkos::~PairSWKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index b5b59dc456..996dae5c1b 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -462,7 +462,7 @@ void PairTableKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -522,10 +522,10 @@ template void PairTableKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 09e38e6387..b2b8a7d60e 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -995,7 +995,7 @@ void PairTableRXKokkos::settings(int narg, char **arg) for (int m = 0; m < ntables; m++) free_table(&tables[m]); memory->sfree(tables); ntables = 0; - tables = NULL; + tables = nullptr; if (allocated) { memory->destroy(setflag); @@ -1289,10 +1289,10 @@ template void PairTableRXKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index b5dd43f12a..106422a234 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -61,8 +61,8 @@ PairVashishtaKokkos::~PairVashishtaKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 71236c807c..03deb1ecf8 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -45,7 +45,7 @@ PairYukawaKokkos::PairYukawaKokkos(LAMMPS *lmp) : PairYukawa(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -58,9 +58,9 @@ PairYukawaKokkos::~PairYukawaKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -70,9 +70,9 @@ template void PairYukawaKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index 8b583a75f7..796dd52116 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -60,9 +60,9 @@ PairZBLKokkos::~PairZBLKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -416,9 +416,9 @@ template void PairZBLKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index 4a795833fb..f4e3955f3c 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -77,25 +77,25 @@ PPPMKokkos::PPPMKokkos(LAMMPS *lmp) : PPPM(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = NULL; - //d_density_fft = NULL; - //d_u_brick = NULL; - //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = NULL; - //greensfn = NULL; - //d_work1 = d_work2 = NULL; - //vg = NULL; - //d_fkx = d_fky = d_fkz = NULL; + //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = nullptr; + //d_density_fft = nullptr; + //d_u_brick = nullptr; + //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = nullptr; + //greensfn = nullptr; + //d_work1 = d_work2 = nullptr; + //vg = nullptr; + //d_fkx = d_fky = d_fkz = nullptr; - //gf_b = NULL; - //rho1d = rho_coeff = drho1d = drho_coeff = NULL; + //gf_b = nullptr; + //rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; nmax = 0; - //part2grid = NULL; + //part2grid = nullptr; peratom_allocate_flag = 0; @@ -160,8 +160,8 @@ PPPMKokkos::~PPPMKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- @@ -212,7 +212,7 @@ void PPPMKokkos::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -247,7 +247,7 @@ void PPPMKokkos::init() // or overlap is allowed, then done // else reduce order and try again - GridCommKokkos *gctmp = NULL; + GridCommKokkos *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -851,22 +851,22 @@ template void PPPMKokkos::deallocate() { memoryKK->destroy_kokkos(d_density_fft,density_fft); - density_fft = NULL; + density_fft = nullptr; memoryKK->destroy_kokkos(d_greensfn,greensfn); - greensfn = NULL; + greensfn = nullptr; memoryKK->destroy_kokkos(d_work1,work1); - work1 = NULL; + work1 = nullptr; memoryKK->destroy_kokkos(d_work2,work2); - work2 = NULL; + work2 = nullptr; delete fft1; - fft1 = NULL; + fft1 = nullptr; delete fft2; - fft2 = NULL; + fft2 = nullptr; delete remap; - remap = NULL; + remap = nullptr; delete gc; - gc = NULL; + gc = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.cpp b/src/KOKKOS/rand_pool_wrap_kokkos.cpp index 2d8865feb0..51ea45e83a 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.cpp +++ b/src/KOKKOS/rand_pool_wrap_kokkos.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; RandPoolWrap::RandPoolWrap(int, LAMMPS *lmp) : Pointers(lmp) { - random_thr = NULL; + random_thr = nullptr; nthreads = lmp->kokkos->nthreads; } @@ -42,7 +42,7 @@ void RandPoolWrap::destroy() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.h b/src/KOKKOS/rand_pool_wrap_kokkos.h index 9124d8e9e7..8ae90011ab 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.h +++ b/src/KOKKOS/rand_pool_wrap_kokkos.h @@ -26,7 +26,7 @@ struct RandWrap { KOKKOS_INLINE_FUNCTION RandWrap() { - rng = NULL; + rng = nullptr; } KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/remap_kokkos.cpp b/src/KOKKOS/remap_kokkos.cpp index af87ba3644..1c72c9edc5 100644 --- a/src/KOKKOS/remap_kokkos.cpp +++ b/src/KOKKOS/remap_kokkos.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; template RemapKokkos::RemapKokkos(LAMMPS *lmp) : Pointers(lmp) { - plan = NULL; + plan = nullptr; } template @@ -44,7 +44,7 @@ RemapKokkos::RemapKokkos(LAMMPS *lmp, MPI_Comm comm, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective, usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ @@ -235,7 +235,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // allocate memory for plan data struct plan = new struct remap_plan_3d_kokkos; - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; plan->usecuda_aware = usecuda_aware; @@ -268,10 +268,10 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -297,8 +297,8 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -379,9 +379,9 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -465,7 +465,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (size) { plan->d_sendbuf = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:sendbuf",size); - if (!plan->d_sendbuf.data()) return NULL; + if (!plan->d_sendbuf.data()) return nullptr; } // if requested, allocate internal scratch space for recvs, @@ -475,7 +475,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (nrecv > 0) { plan->d_scratch = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:scratch",nqty*out.isize*out.jsize*out.ksize); - if (!plan->d_scratch.data()) return NULL; + if (!plan->d_scratch.data()) return nullptr; } } @@ -495,7 +495,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat template void RemapKokkos::remap_3d_destroy_plan_kokkos(struct remap_plan_3d_kokkos *plan) { - if (plan == NULL) return; + if (plan == nullptr) return; // free MPI communicator diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 6133df398f..51e19f7637 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -39,11 +39,11 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), - kxvecs(NULL), kyvecs(NULL), kzvecs(NULL), ug(NULL), eg(NULL), vg(NULL), - ek(NULL), sfacrl(NULL), sfacim(NULL), sfacrl_all(NULL), sfacim_all(NULL), - cs(NULL), sn(NULL), sfacrl_A(NULL), sfacim_A(NULL), sfacrl_A_all(NULL), - sfacim_A_all(NULL), sfacrl_B(NULL), sfacim_B(NULL), sfacrl_B_all(NULL), - sfacim_B_all(NULL) + kxvecs(nullptr), kyvecs(nullptr), kzvecs(nullptr), ug(nullptr), eg(nullptr), vg(nullptr), + ek(nullptr), sfacrl(nullptr), sfacim(nullptr), sfacrl_all(nullptr), sfacim_all(nullptr), + cs(nullptr), sn(nullptr), sfacrl_A(nullptr), sfacim_A(nullptr), sfacrl_A_all(nullptr), + sfacim_A_all(nullptr), sfacrl_B(nullptr), sfacim_B(nullptr), sfacrl_B_all(nullptr), + sfacim_B_all(nullptr) { group_allocate_flag = 0; kmax_created = 0; @@ -53,14 +53,14 @@ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), accuracy_relative = 0.0; kmax = 0; - kxvecs = kyvecs = kzvecs = NULL; - ug = NULL; - eg = vg = NULL; - sfacrl = sfacim = sfacrl_all = sfacim_all = NULL; + kxvecs = kyvecs = kzvecs = nullptr; + ug = nullptr; + eg = vg = nullptr; + sfacrl = sfacim = sfacrl_all = sfacim_all = nullptr; nmax = 0; - ek = NULL; - cs = sn = NULL; + ek = nullptr; + cs = sn = nullptr; kcount = 0; } @@ -121,7 +121,7 @@ void Ewald::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 33d21b416e..ae2596ffee 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -40,12 +40,12 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDipole::EwaldDipole(LAMMPS *lmp) : Ewald(lmp), - tk(NULL), vc(NULL) + tk(nullptr), vc(nullptr) { ewaldflag = dipoleflag = 1; group_group_enable = 0; - tk = NULL; - vc = NULL; + tk = nullptr; + vc = nullptr; } /* ---------------------------------------------------------------------- @@ -112,7 +112,7 @@ void EwaldDipole::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 94cacd3a75..67f49f87cf 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -102,7 +102,7 @@ void EwaldDipoleSpin::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 546ac472c9..4de393c8f6 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -43,21 +43,21 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDisp::EwaldDisp(LAMMPS *lmp) : KSpace(lmp), - kenergy(NULL), kvirial(NULL), energy_self_peratom(NULL), virial_self_peratom(NULL), - ekr_local(NULL), hvec(NULL), kvec(NULL), B(NULL), cek_local(NULL), cek_global(NULL) + kenergy(nullptr), kvirial(nullptr), energy_self_peratom(nullptr), virial_self_peratom(nullptr), + ekr_local(nullptr), hvec(nullptr), kvec(nullptr), B(nullptr), cek_local(nullptr), cek_global(nullptr) { ewaldflag = dispersionflag = dipoleflag = 1; memset(function, 0, EWALD_NFUNCS*sizeof(int)); - kenergy = kvirial = NULL; - cek_local = cek_global = NULL; - ekr_local = NULL; - hvec = NULL; - kvec = NULL; - B = NULL; + kenergy = kvirial = nullptr; + cek_local = cek_global = nullptr; + ekr_local = nullptr; + hvec = nullptr; + kvec = nullptr; + B = nullptr; first_output = 0; - energy_self_peratom = NULL; - virial_self_peratom = NULL; + energy_self_peratom = nullptr; + virial_self_peratom = nullptr; nmax = 0; q2 = 0; b2 = 0; @@ -109,8 +109,8 @@ void EwaldDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; if (!(ptr||cutoff)) error->all(FLERR,"KSpace style is incompatible with Pair style"); int ewald_order = ptr ? *((int *) ptr) : 1<<1; @@ -423,12 +423,12 @@ void EwaldDisp::deallocate_peratom() // free memory { if (energy_self_peratom) { memory->destroy(energy_self_peratom); - energy_self_peratom = NULL; + energy_self_peratom = nullptr; } if (virial_self_peratom) { memory->destroy(virial_self_peratom); - virial_self_peratom = NULL; + virial_self_peratom = nullptr; } } @@ -436,12 +436,12 @@ void EwaldDisp::deallocate_peratom() // free memory void EwaldDisp::deallocate() // free memory { - delete [] hvec; hvec = NULL; - delete [] kvec; kvec = NULL; - delete [] kenergy; kenergy = NULL; - delete [] kvirial; kvirial = NULL; - delete [] cek_local; cek_local = NULL; - delete [] cek_global; cek_global = NULL; + delete [] hvec; hvec = nullptr; + delete [] kvec; kvec = nullptr; + delete [] kenergy; kenergy = nullptr; + delete [] kvirial; kvirial = nullptr; + delete [] cek_local; cek_local = nullptr; + delete [] cek_global; cek_global = nullptr; } /* ---------------------------------------------------------------------- */ @@ -726,7 +726,7 @@ void EwaldDisp::compute_ek() { cvector *ekr = ekr_local; int lbytes = (2*nbox+1)*sizeof(cvector); - hvector *h = NULL; + hvector *h = nullptr; kvector *k, *nk = kvec+nkvec; cvector *z = new cvector[2*nbox+1]; cvector z1, *zx, *zy, *zz, *zn = z+2*nbox; @@ -734,7 +734,7 @@ void EwaldDisp::compute_ek() vector mui; double *x = atom->x[0], *xn = x+3*atom->nlocal, *q = atom->q, qi = 0.0; double bi = 0.0, ci[7]; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; int i, kx, ky, n = nkvec*nsums, *type = atom->type, tri = domain->triclinic; int func[EWALD_NFUNCS]; @@ -806,8 +806,8 @@ void EwaldDisp::compute_force() vector sum[EWALD_MAX_NSUMS], mui = COMPLEX_NULL; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { 8.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(12.0*volume), @@ -1002,7 +1002,7 @@ void EwaldDisp::compute_energy_peratom() complex *cek_coul; double *q = atom->q; double *eatomj = eatom; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke = kenergy; double c[EWALD_NFUNCS] = { @@ -1159,8 +1159,8 @@ void EwaldDisp::compute_virial_dipole() double sum_total[6]; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *mu = atom->mu ? atom->mu[0] : NULL; - double *vatomj = NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; + double *vatomj = nullptr; if (vflag_atom && vatom) vatomj = vatom[0]; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { @@ -1255,8 +1255,8 @@ void EwaldDisp::compute_virial_peratom() complex *cek_coul; double *kv; double *q = atom->q; - double *vatomj = vatom ? vatom[0] : NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *vatomj = vatom ? vatom[0] : nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double c[EWALD_NFUNCS] = { 4.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(24.0*volume), diff --git a/src/KSPACE/fft3d.cpp b/src/KSPACE/fft3d.cpp index 477f8c759e..d5ca88c0df 100644 --- a/src/KSPACE/fft3d.cpp +++ b/src/KSPACE/fft3d.cpp @@ -279,7 +279,7 @@ struct fft_plan_3d *fft_3d_create_plan( // allocate memory for plan data struct plan = (struct fft_plan_3d *) malloc(sizeof(struct fft_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -299,7 +299,7 @@ struct fft_plan_3d *fft_3d_create_plan( first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; first_ihi = nfast - 1; @@ -311,7 +311,7 @@ struct fft_plan_3d *fft_3d_create_plan( remap_3d_create_plan(comm,in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION,0); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -336,7 +336,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -377,7 +377,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi, third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION,usecollective); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -398,7 +398,7 @@ struct fft_plan_3d *fft_3d_create_plan( MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remap_3d_create_plan(comm, @@ -406,7 +406,7 @@ struct fft_plan_3d *fft_3d_create_plan( third_jlo,third_jhi, out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION,0); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -467,15 +467,15 @@ struct fft_plan_3d *fft_3d_create_plan( if (copy_size) { plan->copy = (FFT_DATA *) malloc(copy_size*sizeof(FFT_DATA)); - if (plan->copy == NULL) return NULL; + if (plan->copy == nullptr) return nullptr; } - else plan->copy = NULL; + else plan->copy = nullptr; if (scratch_size) { plan->scratch = (FFT_DATA *) malloc(scratch_size*sizeof(FFT_DATA)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } - else plan->scratch = NULL; + else plan->scratch = nullptr; // system specific pre-computation of 1d FFT coeffs // and scaling normalization @@ -527,47 +527,47 @@ struct fft_plan_3d *fft_3d_create_plan( plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #else /* FFT_KISS */ - plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,NULL,NULL); - plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,NULL,NULL); + plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,NULL,NULL); - plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,NULL,NULL); + plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -579,8 +579,8 @@ struct fft_plan_3d *fft_3d_create_plan( plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,NULL,NULL); - plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,NULL,NULL); + plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index d0e3a2b50c..28af7aabbd 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -30,7 +30,7 @@ FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/gridcomm.cpp b/src/KSPACE/gridcomm.cpp index 0f899d31cf..1c013716ca 100644 --- a/src/KSPACE/gridcomm.cpp +++ b/src/KSPACE/gridcomm.cpp @@ -211,13 +211,13 @@ void GridComm::initialize(MPI_Comm gcomm, // internal data initializations nswap = maxswap = 0; - swap = NULL; + swap = nullptr; nsend = nrecv = ncopy = 0; - send = NULL; - recv = NULL; - copy = NULL; - requests = NULL; + send = nullptr; + recv = nullptr; + copy = nullptr; + requests = nullptr; } /* ---------------------------------------------------------------------- */ @@ -575,7 +575,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KSPACE/kissfft.h b/src/KSPACE/kissfft.h index c95b648dcb..119dc17f66 100644 --- a/src/KSPACE/kissfft.h +++ b/src/KSPACE/kissfft.h @@ -420,14 +420,14 @@ static void kf_factor(int n, int *facbuf) */ static kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem) { - kiss_fft_cfg st=NULL; + kiss_fft_cfg st=nullptr; size_t memneeded = sizeof(struct kiss_fft_state) + sizeof(FFT_DATA)*(nfft-1); /* twiddle factors */ - if (lenmem==NULL) { + if (lenmem==nullptr) { st=(kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); } else { - if (mem != NULL && *lenmem >= memneeded) + if (mem != nullptr && *lenmem >= memneeded) st = (kiss_fft_cfg)mem; *lenmem = memneeded; } diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index d0f4d38686..4c5b615a10 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -45,19 +45,19 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; MSM::MSM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), delxinv(NULL), delyinv(NULL), delzinv(NULL), nx_msm(NULL), - ny_msm(NULL), nz_msm(NULL), nxlo_in(NULL), nylo_in(NULL), nzlo_in(NULL), - nxhi_in(NULL), nyhi_in(NULL), nzhi_in(NULL), nxlo_out(NULL), nylo_out(NULL), - nzlo_out(NULL), nxhi_out(NULL), nyhi_out(NULL), nzhi_out(NULL), ngrid(NULL), - active_flag(NULL), alpha(NULL), betax(NULL), betay(NULL), betaz(NULL), - peratom_allocate_flag(0),levels(0),world_levels(NULL),qgrid(NULL),egrid(NULL), - v0grid(NULL), v1grid(NULL),v2grid(NULL),v3grid(NULL),v4grid(NULL),v5grid(NULL), - g_direct(NULL),v0_direct(NULL),v1_direct(NULL),v2_direct(NULL),v3_direct(NULL), - v4_direct(NULL),v5_direct(NULL),g_direct_top(NULL),v0_direct_top(NULL), - v1_direct_top(NULL),v2_direct_top(NULL),v3_direct_top(NULL),v4_direct_top(NULL), - v5_direct_top(NULL),phi1d(NULL),dphi1d(NULL),procneigh_levels(NULL),gcall(NULL), - gc(NULL),gcall_buf1(NULL),gcall_buf2(NULL),gc_buf1(NULL),gc_buf2(NULL), - ngc_buf1(NULL),ngc_buf2(NULL),part2grid(NULL),boxlo(NULL) + factors(nullptr), delxinv(nullptr), delyinv(nullptr), delzinv(nullptr), nx_msm(nullptr), + ny_msm(nullptr), nz_msm(nullptr), nxlo_in(nullptr), nylo_in(nullptr), nzlo_in(nullptr), + nxhi_in(nullptr), nyhi_in(nullptr), nzhi_in(nullptr), nxlo_out(nullptr), nylo_out(nullptr), + nzlo_out(nullptr), nxhi_out(nullptr), nyhi_out(nullptr), nzhi_out(nullptr), ngrid(nullptr), + active_flag(nullptr), alpha(nullptr), betax(nullptr), betay(nullptr), betaz(nullptr), + peratom_allocate_flag(0),levels(0),world_levels(nullptr),qgrid(nullptr),egrid(nullptr), + v0grid(nullptr), v1grid(nullptr),v2grid(nullptr),v3grid(nullptr),v4grid(nullptr),v5grid(nullptr), + g_direct(nullptr),v0_direct(nullptr),v1_direct(nullptr),v2_direct(nullptr),v3_direct(nullptr), + v4_direct(nullptr),v5_direct(nullptr),g_direct_top(nullptr),v0_direct_top(nullptr), + v1_direct_top(nullptr),v2_direct_top(nullptr),v3_direct_top(nullptr),v4_direct_top(nullptr), + v5_direct_top(nullptr),phi1d(nullptr),dphi1d(nullptr),procneigh_levels(nullptr),gcall(nullptr), + gc(nullptr),gcall_buf1(nullptr),gcall_buf2(nullptr),gc_buf1(nullptr),gc_buf2(nullptr), + ngc_buf1(nullptr),ngc_buf2(nullptr),part2grid(nullptr),boxlo(nullptr) { msmflag = 1; @@ -67,32 +67,32 @@ MSM::MSM(LAMMPS *lmp) MPI_Comm_rank(world,&me); - phi1d = dphi1d = NULL; + phi1d = dphi1d = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; - g_direct = NULL; - g_direct_top = NULL; + g_direct = nullptr; + g_direct_top = nullptr; - v0_direct = v1_direct = v2_direct = NULL; - v3_direct = v4_direct = v5_direct = NULL; + v0_direct = v1_direct = v2_direct = nullptr; + v3_direct = v4_direct = v5_direct = nullptr; - v0_direct_top = v1_direct_top = v2_direct_top = NULL; - v3_direct_top = v4_direct_top = v5_direct_top = NULL; + v0_direct_top = v1_direct_top = v2_direct_top = nullptr; + v3_direct_top = v4_direct_top = v5_direct_top = nullptr; - ngrid = NULL; + ngrid = nullptr; - alpha = betax = betay = betaz = NULL; - nx_msm = ny_msm = nz_msm = NULL; - nxlo_in = nylo_in = nzlo_in = NULL; - nxhi_in = nyhi_in = nzhi_in = NULL; - nxlo_out = nylo_out = nzlo_out = NULL; - nxhi_out = nyhi_out = nzhi_out = NULL; - delxinv = delyinv = delzinv = NULL; - qgrid = NULL; - egrid = NULL; - v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = NULL; + alpha = betax = betay = betaz = nullptr; + nx_msm = ny_msm = nz_msm = nullptr; + nxlo_in = nylo_in = nzlo_in = nullptr; + nxhi_in = nyhi_in = nzhi_in = nullptr; + nxlo_out = nylo_out = nzlo_out = nullptr; + nxhi_out = nyhi_out = nzhi_out = nullptr; + delxinv = delyinv = delzinv = nullptr; + qgrid = nullptr; + egrid = nullptr; + v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = nullptr; peratom_allocate_flag = 0; scalar_pressure_flag = 1; @@ -176,7 +176,7 @@ void MSM::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -825,18 +825,18 @@ void MSM::allocate_levels() v5grid = new double***[levels]; for (int n=0; nkspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -383,7 +383,7 @@ void PairBornCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -423,16 +423,16 @@ void PairBornCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -466,13 +466,13 @@ void PairBornCoulLong::write_restart_settings(FILE *fp) void PairBornCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -577,5 +577,5 @@ void *PairBornCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_born_coul_msm.cpp b/src/KSPACE/pair_born_coul_msm.cpp index 7300cd92e0..707f7f7959 100644 --- a/src/KSPACE/pair_born_coul_msm.cpp +++ b/src/KSPACE/pair_born_coul_msm.cpp @@ -34,7 +34,7 @@ PairBornCoulMSM::PairBornCoulMSM(LAMMPS *lmp) : PairBornCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -251,5 +251,5 @@ void *PairBornCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 8d15a6480a..2733bc31cd 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -364,7 +364,7 @@ void PairBuckCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -372,7 +372,7 @@ void PairBuckCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -410,14 +410,14 @@ void PairBuckCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -449,13 +449,13 @@ void PairBuckCoulLong::write_restart_settings(FILE *fp) void PairBuckCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -558,5 +558,5 @@ void *PairBuckCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_msm.cpp b/src/KSPACE/pair_buck_coul_msm.cpp index 1355a2f13a..87c852b5aa 100644 --- a/src/KSPACE/pair_buck_coul_msm.cpp +++ b/src/KSPACE/pair_buck_coul_msm.cpp @@ -31,7 +31,7 @@ PairBuckCoulMSM::PairBuckCoulMSM(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,5 +246,5 @@ void *PairBuckCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index a845ddd1d2..744232dd8e 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -50,9 +50,9 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; - cut_respa = NULL; + ftable = nullptr; + fdisptable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairBuckLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style buck/long/coul/long command"); @@ -177,10 +177,10 @@ void PairBuckLongCoulLong::allocate() void *PairBuckLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { - "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", NULL}; + "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_buck_global, - NULL}; + nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -240,7 +240,7 @@ void PairBuckLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -250,7 +250,7 @@ void PairBuckLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -359,14 +359,14 @@ void PairBuckLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck_a_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck_rho_read[i][j],1,MPI_DOUBLE,0,world); @@ -399,14 +399,14 @@ void PairBuckLongCoulLong::write_restart_settings(FILE *fp) void PairBuckLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_buck_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 2520da2654..68b9a8cbe2 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -44,9 +44,9 @@ using namespace LAMMPS_NS; PairCoulLong::PairCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -242,13 +242,13 @@ void PairCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -291,10 +291,10 @@ void PairCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); } } @@ -320,11 +320,11 @@ void PairCoulLong::write_restart_settings(FILE *fp) void PairCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -393,5 +393,5 @@ void *PairCoulLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_coul_msm.cpp b/src/KSPACE/pair_coul_msm.cpp index 5d42e1f046..bf689d403d 100644 --- a/src/KSPACE/pair_coul_msm.cpp +++ b/src/KSPACE/pair_coul_msm.cpp @@ -217,5 +217,5 @@ void *PairCoulMSM::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 261e93fbc9..b4455ff9b8 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -47,11 +47,11 @@ PairLJCharmmCoulLong::PairLJCharmmCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -738,11 +738,11 @@ void PairLJCharmmCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -824,14 +824,14 @@ void PairLJCharmmCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -863,13 +863,13 @@ void PairLJCharmmCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -994,5 +994,5 @@ void *PairLJCharmmCoulLong::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.cpp b/src/KSPACE/pair_lj_charmm_coul_msm.cpp index a93a1275f4..fe3ce441a1 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_msm.cpp @@ -35,7 +35,7 @@ PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -537,5 +537,5 @@ void *PairLJCharmmCoulMSM::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 9df9862c11..abc8888e59 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -51,11 +51,11 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; // short-range/long-range flag accessed by DihedralCharmmfsw @@ -786,11 +786,11 @@ void PairLJCharmmfswCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -872,14 +872,14 @@ void PairLJCharmmfswCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -911,13 +911,13 @@ void PairLJCharmmfswCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -1055,5 +1055,5 @@ void *PairLJCharmmfswCoulLong::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 7fd8a72559..7ae60acc86 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -51,9 +51,9 @@ PairLJCutCoulLong::PairLJCutCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -676,11 +676,11 @@ void PairLJCutCoulLong::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -792,13 +792,13 @@ void PairLJCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -829,13 +829,13 @@ void PairLJCutCoulLong::write_restart_settings(FILE *fp) void PairLJCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -943,5 +943,5 @@ void *PairLJCutCoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_msm.cpp b/src/KSPACE/pair_lj_cut_coul_msm.cpp index 4ebbcb9a3f..00aa88152d 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.cpp +++ b/src/KSPACE/pair_lj_cut_coul_msm.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSM::PairLJCutCoulMSM(LAMMPS *lmp) : PairLJCutCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -478,5 +478,5 @@ void *PairLJCutCoulMSM::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index a62c1bd55b..0d7778c93a 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -55,8 +55,8 @@ PairLJCutTIP4PLong::PairLJCutTIP4PLong(LAMMPS *lmp) : writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -464,9 +464,9 @@ void PairLJCutTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLong::init_style(); @@ -529,19 +529,19 @@ void PairLJCutTIP4PLong::write_restart_settings(FILE *fp) void PairLJCutTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -594,7 +594,7 @@ void *PairLJCutTIP4PLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index b6727c2c99..960a47e685 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -53,10 +53,10 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -65,7 +65,7 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/coul/long command"); @@ -176,10 +176,10 @@ void *PairLJLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_LJ", NULL}; + "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, - &cut_coul, &cut_lj_global, NULL}; + &cut_coul, &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -235,7 +235,7 @@ void PairLJLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -245,7 +245,7 @@ void PairLJLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -360,13 +360,13 @@ void PairLJLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -398,14 +398,14 @@ void PairLJLongCoulLong::write_restart_settings(FILE *fp) void PairLJLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index 8f17bda008..790e318160 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -52,8 +52,8 @@ PairLJLongTIP4PLong::PairLJLongTIP4PLong(LAMMPS *lmp) : respa_enable = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to find_M() finding bonded H atoms which are not near O atom @@ -1479,9 +1479,9 @@ void PairLJLongTIP4PLong::init_style() error->all(FLERR,"Pair style lj/long/tip4p/long requires newton pair on"); if (!atom->q_flag) error->all(FLERR,"Pair style lj/long/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJLongCoulLong::init_style(); @@ -1544,20 +1544,20 @@ void PairLJLongTIP4PLong::write_restart_settings(FILE *fp) void PairLJLongTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -1611,14 +1611,14 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "cut_coul", - "ewald_mix", "cut_LJ", NULL}; + "ewald_mix", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &cut_coul, - &mix_flag, &cut_lj_global, NULL}; + &mix_flag, &cut_lj_global, nullptr}; int i; i=0; - while (ids[i] != NULL) { + while (ids[i] != nullptr) { if (i <=2) dim = 2; else dim = 0; @@ -1627,7 +1627,7 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) ++i; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index 54973c69c2..80785d3551 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -51,8 +51,8 @@ PairTIP4PLong::PairTIP4PLong(LAMMPS *lmp) : PairCoulLong(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -421,9 +421,9 @@ void PairTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLong::init_style(); @@ -468,11 +468,11 @@ void PairTIP4PLong::read_restart_settings(FILE *fp) PairCoulLong::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -514,7 +514,7 @@ void *PairTIP4PLong::extract(const char *str, int &dim) if (strcmp(str,"typeA") == 0) return (void *) &typeA; if (strcmp(str,"typeB") == 0) return (void *) &typeB; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 41ffec4f3b..89d308eaa3 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -63,16 +63,16 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), density_brick(NULL), vdx_brick(NULL), vdy_brick(NULL), vdz_brick(NULL), - u_brick(NULL), v0_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), - v4_brick(NULL), v5_brick(NULL), greensfn(NULL), vg(NULL), fkx(NULL), fky(NULL), - fkz(NULL), density_fft(NULL), work1(NULL), work2(NULL), gf_b(NULL), rho1d(NULL), - rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), - acons(NULL), fft1(NULL), fft2(NULL), remap(NULL), gc(NULL), - gc_buf1(NULL), gc_buf2(NULL), density_A_brick(NULL), density_B_brick(NULL), density_A_fft(NULL), - density_B_fft(NULL), part2grid(NULL), boxlo(NULL) + factors(nullptr), density_brick(nullptr), vdx_brick(nullptr), vdy_brick(nullptr), vdz_brick(nullptr), + u_brick(nullptr), v0_brick(nullptr), v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), + v4_brick(nullptr), v5_brick(nullptr), greensfn(nullptr), vg(nullptr), fkx(nullptr), fky(nullptr), + fkz(nullptr), density_fft(nullptr), work1(nullptr), work2(nullptr), gf_b(nullptr), rho1d(nullptr), + rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), + acons(nullptr), fft1(nullptr), fft2(nullptr), remap(nullptr), gc(nullptr), + gc_buf1(nullptr), gc_buf2(nullptr), density_A_brick(nullptr), density_B_brick(nullptr), density_A_fft(nullptr), + density_B_fft(nullptr), part2grid(nullptr), boxlo(nullptr) { peratom_allocate_flag = 0; group_allocate_flag = 0; @@ -95,31 +95,31 @@ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), nyhi_in = nylo_in = nyhi_out = nylo_out = 0; nzhi_in = nzlo_in = nzhi_out = nzlo_out = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; - u_brick = NULL; - v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = NULL; - greensfn = NULL; - work1 = work2 = NULL; - vg = NULL; - fkx = fky = fkz = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; + u_brick = nullptr; + v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = nullptr; + greensfn = nullptr; + work1 = work2 = nullptr; + vg = nullptr; + fkx = fky = fkz = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; - density_A_brick = density_B_brick = NULL; - density_A_fft = density_B_fft = NULL; + density_A_brick = density_B_brick = nullptr; + density_A_fft = density_B_fft = nullptr; - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; - gc_buf1 = gc_buf2 = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; + gc_buf1 = gc_buf2 = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; // define acons coefficients for estimation of kspace errors // see JCP 109, pg 7698 for derivation of coefficients @@ -229,7 +229,7 @@ void PPPM::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -254,8 +254,8 @@ void PPPM::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL || - force->angle->setflag == NULL || force->bond->setflag == NULL) + if (force->angle == nullptr || force->bond == nullptr || + force->angle->setflag == nullptr || force->bond->setflag == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -292,7 +292,7 @@ void PPPM::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -867,7 +867,7 @@ void PPPM::deallocate() } memory->destroy(gf_b); - if (stagger_flag) gf_b = NULL; + if (stagger_flag) gf_b = nullptr; memory->destroy2d_offset(rho1d,-order_allocated/2); memory->destroy2d_offset(drho1d,-order_allocated/2); memory->destroy2d_offset(rho_coeff,(1-order_allocated)/2); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index b319014c78..62f816a94d 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -47,7 +47,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMCG::PPPMCG(LAMMPS *lmp) : PPPM(lmp), - is_charged(NULL) + is_charged(nullptr) { num_charged = -1; group_group_enable = 1; diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 1b7d325326..feb17e522e 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -58,25 +58,25 @@ enum{FORWARD_MU,FORWARD_MU_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMDipole::PPPMDipole(LAMMPS *lmp) : PPPM(lmp), - densityx_brick_dipole(NULL), densityy_brick_dipole(NULL), - densityz_brick_dipole(NULL), - vdxx_brick_dipole(NULL), vdyy_brick_dipole(NULL), vdzz_brick_dipole(NULL), - vdxy_brick_dipole(NULL), vdxz_brick_dipole(NULL), vdyz_brick_dipole(NULL), - ux_brick_dipole(NULL), uy_brick_dipole(NULL), uz_brick_dipole(NULL), - v0x_brick_dipole(NULL), v1x_brick_dipole(NULL), - v2x_brick_dipole(NULL), v3x_brick_dipole(NULL), v4x_brick_dipole(NULL), - v5x_brick_dipole(NULL), v0y_brick_dipole(NULL), v1y_brick_dipole(NULL), - v2y_brick_dipole(NULL), v3y_brick_dipole(NULL), v4y_brick_dipole(NULL), - v5y_brick_dipole(NULL), v0z_brick_dipole(NULL), v1z_brick_dipole(NULL), - v2z_brick_dipole(NULL), v3z_brick_dipole(NULL), v4z_brick_dipole(NULL), - v5z_brick_dipole(NULL), work3(NULL), work4(NULL), - densityx_fft_dipole(NULL), densityy_fft_dipole(NULL), - densityz_fft_dipole(NULL) + densityx_brick_dipole(nullptr), densityy_brick_dipole(nullptr), + densityz_brick_dipole(nullptr), + vdxx_brick_dipole(nullptr), vdyy_brick_dipole(nullptr), vdzz_brick_dipole(nullptr), + vdxy_brick_dipole(nullptr), vdxz_brick_dipole(nullptr), vdyz_brick_dipole(nullptr), + ux_brick_dipole(nullptr), uy_brick_dipole(nullptr), uz_brick_dipole(nullptr), + v0x_brick_dipole(nullptr), v1x_brick_dipole(nullptr), + v2x_brick_dipole(nullptr), v3x_brick_dipole(nullptr), v4x_brick_dipole(nullptr), + v5x_brick_dipole(nullptr), v0y_brick_dipole(nullptr), v1y_brick_dipole(nullptr), + v2y_brick_dipole(nullptr), v3y_brick_dipole(nullptr), v4y_brick_dipole(nullptr), + v5y_brick_dipole(nullptr), v0z_brick_dipole(nullptr), v1z_brick_dipole(nullptr), + v2z_brick_dipole(nullptr), v3z_brick_dipole(nullptr), v4z_brick_dipole(nullptr), + v5z_brick_dipole(nullptr), work3(nullptr), work4(nullptr), + densityx_fft_dipole(nullptr), densityy_fft_dipole(nullptr), + densityz_fft_dipole(nullptr) { dipoleflag = 1; group_group_enable = 0; - gc_dipole = NULL; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -153,7 +153,7 @@ void PPPMDipole::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -187,7 +187,7 @@ void PPPMDipole::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 595c257331..a3f7aa29cf 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -75,10 +75,10 @@ PPPMDipoleSpin::~PPPMDipoleSpin() deallocate(); if (peratom_allocate_flag) deallocate_peratom(); - fft1 = NULL; - fft2 = NULL; - remap = NULL; - gc_dipole = NULL; + fft1 = nullptr; + fft2 = nullptr; + remap = nullptr; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -139,7 +139,7 @@ void PPPMDipoleSpin::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); // check the correct extract here - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -172,7 +172,7 @@ void PPPMDipoleSpin::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index a484751a81..a88a0892bc 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -63,47 +63,47 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM, /* ---------------------------------------------------------------------- */ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), csumi(NULL), cii(NULL), B(NULL), density_brick(NULL), vdx_brick(NULL), - vdy_brick(NULL), vdz_brick(NULL), density_fft(NULL), u_brick(NULL), v0_brick(NULL), - v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), v4_brick(NULL), v5_brick(NULL), - density_brick_g(NULL), vdx_brick_g(NULL), vdy_brick_g(NULL), vdz_brick_g(NULL), - density_fft_g(NULL), u_brick_g(NULL), v0_brick_g(NULL), v1_brick_g(NULL), v2_brick_g(NULL), - v3_brick_g(NULL), v4_brick_g(NULL), v5_brick_g(NULL), density_brick_a0(NULL), - vdx_brick_a0(NULL), vdy_brick_a0(NULL), vdz_brick_a0(NULL), density_fft_a0(NULL), - u_brick_a0(NULL), v0_brick_a0(NULL), v1_brick_a0(NULL), v2_brick_a0(NULL), - v3_brick_a0(NULL), v4_brick_a0(NULL), v5_brick_a0(NULL), density_brick_a1(NULL), - vdx_brick_a1(NULL), vdy_brick_a1(NULL), vdz_brick_a1(NULL), density_fft_a1(NULL), - u_brick_a1(NULL), v0_brick_a1(NULL), v1_brick_a1(NULL), v2_brick_a1(NULL), - v3_brick_a1(NULL), v4_brick_a1(NULL), v5_brick_a1(NULL), density_brick_a2(NULL), - vdx_brick_a2(NULL), vdy_brick_a2(NULL), vdz_brick_a2(NULL), density_fft_a2(NULL), - u_brick_a2(NULL), v0_brick_a2(NULL), v1_brick_a2(NULL), v2_brick_a2(NULL), - v3_brick_a2(NULL), v4_brick_a2(NULL), v5_brick_a2(NULL), density_brick_a3(NULL), - vdx_brick_a3(NULL), vdy_brick_a3(NULL), vdz_brick_a3(NULL), density_fft_a3(NULL), - u_brick_a3(NULL), v0_brick_a3(NULL), v1_brick_a3(NULL), v2_brick_a3(NULL), - v3_brick_a3(NULL), v4_brick_a3(NULL), v5_brick_a3(NULL), density_brick_a4(NULL), - vdx_brick_a4(NULL), vdy_brick_a4(NULL), vdz_brick_a4(NULL), density_fft_a4(NULL), - u_brick_a4(NULL), v0_brick_a4(NULL), v1_brick_a4(NULL), v2_brick_a4(NULL), - v3_brick_a4(NULL), v4_brick_a4(NULL), v5_brick_a4(NULL), density_brick_a5(NULL), - vdx_brick_a5(NULL), vdy_brick_a5(NULL), vdz_brick_a5(NULL), density_fft_a5(NULL), - u_brick_a5(NULL), v0_brick_a5(NULL), v1_brick_a5(NULL), v2_brick_a5(NULL), - v3_brick_a5(NULL), v4_brick_a5(NULL), v5_brick_a5(NULL), density_brick_a6(NULL), - vdx_brick_a6(NULL), vdy_brick_a6(NULL), vdz_brick_a6(NULL), density_fft_a6(NULL), - u_brick_a6(NULL), v0_brick_a6(NULL), v1_brick_a6(NULL), v2_brick_a6(NULL), - v3_brick_a6(NULL), v4_brick_a6(NULL), v5_brick_a6(NULL), density_brick_none(NULL), - vdx_brick_none(NULL), vdy_brick_none(NULL), vdz_brick_none(NULL), - density_fft_none(NULL), u_brick_none(NULL), v0_brick_none(NULL), v1_brick_none(NULL), - v2_brick_none(NULL), v3_brick_none(NULL), v4_brick_none(NULL), v5_brick_none(NULL), - greensfn(NULL), vg(NULL), vg2(NULL), greensfn_6(NULL), vg_6(NULL), vg2_6(NULL), - fkx(NULL), fky(NULL), fkz(NULL), fkx2(NULL), fky2(NULL), fkz2(NULL), fkx_6(NULL), - fky_6(NULL), fkz_6(NULL), fkx2_6(NULL), fky2_6(NULL), fkz2_6(NULL), gf_b(NULL), - gf_b_6(NULL), sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), sf_precoeff1_6(NULL), - sf_precoeff2_6(NULL), sf_precoeff3_6(NULL), sf_precoeff4_6(NULL), sf_precoeff5_6(NULL), - sf_precoeff6_6(NULL), rho1d(NULL), rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - rho1d_6(NULL), rho_coeff_6(NULL), drho1d_6(NULL), drho_coeff_6(NULL), work1(NULL), - work2(NULL), work1_6(NULL), work2_6(NULL), fft1(NULL), fft2(NULL), fft1_6(NULL), - fft2_6(NULL), remap(NULL), remap_6(NULL), gc(NULL), gc6(NULL), - part2grid(NULL), part2grid_6(NULL), boxlo(NULL) + factors(nullptr), csumi(nullptr), cii(nullptr), B(nullptr), density_brick(nullptr), vdx_brick(nullptr), + vdy_brick(nullptr), vdz_brick(nullptr), density_fft(nullptr), u_brick(nullptr), v0_brick(nullptr), + v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), v4_brick(nullptr), v5_brick(nullptr), + density_brick_g(nullptr), vdx_brick_g(nullptr), vdy_brick_g(nullptr), vdz_brick_g(nullptr), + density_fft_g(nullptr), u_brick_g(nullptr), v0_brick_g(nullptr), v1_brick_g(nullptr), v2_brick_g(nullptr), + v3_brick_g(nullptr), v4_brick_g(nullptr), v5_brick_g(nullptr), density_brick_a0(nullptr), + vdx_brick_a0(nullptr), vdy_brick_a0(nullptr), vdz_brick_a0(nullptr), density_fft_a0(nullptr), + u_brick_a0(nullptr), v0_brick_a0(nullptr), v1_brick_a0(nullptr), v2_brick_a0(nullptr), + v3_brick_a0(nullptr), v4_brick_a0(nullptr), v5_brick_a0(nullptr), density_brick_a1(nullptr), + vdx_brick_a1(nullptr), vdy_brick_a1(nullptr), vdz_brick_a1(nullptr), density_fft_a1(nullptr), + u_brick_a1(nullptr), v0_brick_a1(nullptr), v1_brick_a1(nullptr), v2_brick_a1(nullptr), + v3_brick_a1(nullptr), v4_brick_a1(nullptr), v5_brick_a1(nullptr), density_brick_a2(nullptr), + vdx_brick_a2(nullptr), vdy_brick_a2(nullptr), vdz_brick_a2(nullptr), density_fft_a2(nullptr), + u_brick_a2(nullptr), v0_brick_a2(nullptr), v1_brick_a2(nullptr), v2_brick_a2(nullptr), + v3_brick_a2(nullptr), v4_brick_a2(nullptr), v5_brick_a2(nullptr), density_brick_a3(nullptr), + vdx_brick_a3(nullptr), vdy_brick_a3(nullptr), vdz_brick_a3(nullptr), density_fft_a3(nullptr), + u_brick_a3(nullptr), v0_brick_a3(nullptr), v1_brick_a3(nullptr), v2_brick_a3(nullptr), + v3_brick_a3(nullptr), v4_brick_a3(nullptr), v5_brick_a3(nullptr), density_brick_a4(nullptr), + vdx_brick_a4(nullptr), vdy_brick_a4(nullptr), vdz_brick_a4(nullptr), density_fft_a4(nullptr), + u_brick_a4(nullptr), v0_brick_a4(nullptr), v1_brick_a4(nullptr), v2_brick_a4(nullptr), + v3_brick_a4(nullptr), v4_brick_a4(nullptr), v5_brick_a4(nullptr), density_brick_a5(nullptr), + vdx_brick_a5(nullptr), vdy_brick_a5(nullptr), vdz_brick_a5(nullptr), density_fft_a5(nullptr), + u_brick_a5(nullptr), v0_brick_a5(nullptr), v1_brick_a5(nullptr), v2_brick_a5(nullptr), + v3_brick_a5(nullptr), v4_brick_a5(nullptr), v5_brick_a5(nullptr), density_brick_a6(nullptr), + vdx_brick_a6(nullptr), vdy_brick_a6(nullptr), vdz_brick_a6(nullptr), density_fft_a6(nullptr), + u_brick_a6(nullptr), v0_brick_a6(nullptr), v1_brick_a6(nullptr), v2_brick_a6(nullptr), + v3_brick_a6(nullptr), v4_brick_a6(nullptr), v5_brick_a6(nullptr), density_brick_none(nullptr), + vdx_brick_none(nullptr), vdy_brick_none(nullptr), vdz_brick_none(nullptr), + density_fft_none(nullptr), u_brick_none(nullptr), v0_brick_none(nullptr), v1_brick_none(nullptr), + v2_brick_none(nullptr), v3_brick_none(nullptr), v4_brick_none(nullptr), v5_brick_none(nullptr), + greensfn(nullptr), vg(nullptr), vg2(nullptr), greensfn_6(nullptr), vg_6(nullptr), vg2_6(nullptr), + fkx(nullptr), fky(nullptr), fkz(nullptr), fkx2(nullptr), fky2(nullptr), fkz2(nullptr), fkx_6(nullptr), + fky_6(nullptr), fkz_6(nullptr), fkx2_6(nullptr), fky2_6(nullptr), fkz2_6(nullptr), gf_b(nullptr), + gf_b_6(nullptr), sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), sf_precoeff1_6(nullptr), + sf_precoeff2_6(nullptr), sf_precoeff3_6(nullptr), sf_precoeff4_6(nullptr), sf_precoeff5_6(nullptr), + sf_precoeff6_6(nullptr), rho1d(nullptr), rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + rho1d_6(nullptr), rho_coeff_6(nullptr), drho1d_6(nullptr), drho_coeff_6(nullptr), work1(nullptr), + work2(nullptr), work1_6(nullptr), work2_6(nullptr), fft1(nullptr), fft2(nullptr), fft1_6(nullptr), + fft2_6(nullptr), remap(nullptr), remap_6(nullptr), gc(nullptr), gc6(nullptr), + part2grid(nullptr), part2grid_6(nullptr), boxlo(nullptr) { triclinic_support = 0; pppmflag = dispersionflag = 1; @@ -125,98 +125,98 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), nzhi_in_6 = nzlo_in_6 = nzhi_out_6 = nzlo_out_6 = 0; csumflag = 0; - B = NULL; - cii = NULL; - csumi = NULL; + B = nullptr; + cii = nullptr; + csumi = nullptr; peratom_allocate_flag = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; u_brick = v0_brick = v1_brick = v2_brick = v3_brick = - v4_brick = v5_brick = NULL; + v4_brick = v5_brick = nullptr; - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = v3_brick_g = - v4_brick_g = v5_brick_g = NULL; + v4_brick_g = v5_brick_g = nullptr; - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = v3_brick_a0 = - v4_brick_a0 = v5_brick_a0 = NULL; + v4_brick_a0 = v5_brick_a0 = nullptr; - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = v3_brick_a1 = - v4_brick_a1 = v5_brick_a1 = NULL; + v4_brick_a1 = v5_brick_a1 = nullptr; - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = - v4_brick_a2 = v5_brick_a2 = NULL; + v4_brick_a2 = v5_brick_a2 = nullptr; - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = - v4_brick_a3 = v5_brick_a3 = NULL; + v4_brick_a3 = v5_brick_a3 = nullptr; - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = - v4_brick_a4 = v5_brick_a4 = NULL; + v4_brick_a4 = v5_brick_a4 = nullptr; - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = v3_brick_a5 = - v4_brick_a5 = v5_brick_a5 = NULL; + v4_brick_a5 = v5_brick_a5 = nullptr; - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = v3_brick_a6 = - v4_brick_a6 = v5_brick_a6 = NULL; + v4_brick_a6 = v5_brick_a6 = nullptr; - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = v3_brick_none = - v4_brick_none = v5_brick_none = NULL; - - greensfn = NULL; - greensfn_6 = NULL; - work1 = work2 = NULL; - work1_6 = work2_6 = NULL; - vg = NULL; - vg2 = NULL; - vg_6 = NULL; - vg2_6 = NULL; - fkx = fky = fkz = NULL; - fkx2 = fky2 = fkz2 = NULL; - fkx_6 = fky_6 = fkz_6 = NULL; - fkx2_6 = fky2_6 = fkz2_6 = NULL; + v4_brick_none = v5_brick_none = nullptr; + + greensfn = nullptr; + greensfn_6 = nullptr; + work1 = work2 = nullptr; + work1_6 = work2_6 = nullptr; + vg = nullptr; + vg2 = nullptr; + vg_6 = nullptr; + vg2_6 = nullptr; + fkx = fky = fkz = nullptr; + fkx2 = fky2 = fkz2 = nullptr; + fkx_6 = fky_6 = fkz_6 = nullptr; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = - sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff5 = sf_precoeff6 = nullptr; sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = sf_precoeff4_6 = - sf_precoeff5_6 = sf_precoeff6_6 = NULL; - - gf_b = NULL; - gf_b_6 = NULL; - rho1d = rho_coeff = NULL; - drho1d = drho_coeff = NULL; - rho1d_6 = rho_coeff_6 = NULL; - drho1d_6 = drho_coeff_6 = NULL; - fft1 = fft2 = NULL; - fft1_6 = fft2_6 = NULL; - remap = NULL; - remap_6 = NULL; - gc = gc6 = NULL; - gc_buf1 = gc_buf2 = NULL; - gc6_buf1 = gc6_buf2 = NULL; + sf_precoeff5_6 = sf_precoeff6_6 = nullptr; + + gf_b = nullptr; + gf_b_6 = nullptr; + rho1d = rho_coeff = nullptr; + drho1d = drho_coeff = nullptr; + rho1d_6 = rho_coeff_6 = nullptr; + drho1d_6 = drho_coeff_6 = nullptr; + fft1 = fft2 = nullptr; + fft1_6 = fft2_6 = nullptr; + remap = nullptr; + remap_6 = nullptr; + gc = gc6 = nullptr; + gc_buf1 = gc_buf2 = nullptr; + gc6_buf1 = gc6_buf2 = nullptr; ngc_buf1 = ngc_buf2 = ngc6_buf1 = ngc6_buf2 = 0; ngrid = ngrid_6 = npergrid = npergrid6 = 0; nmax = 0; - part2grid = NULL; - part2grid_6 = NULL; + part2grid = nullptr; + part2grid_6 = nullptr; memset(function,0,EWALD_FUNCS*sizeof(int)); } @@ -237,16 +237,16 @@ PPPMDisp::~PPPMDisp() { delete [] factors; delete [] B; - B = NULL; + B = nullptr; delete [] cii; - cii = NULL; + cii = nullptr; delete [] csumi; - csumi = NULL; + csumi = nullptr; deallocate(); deallocate_peratom(); memory->destroy(part2grid); memory->destroy(part2grid_6); - part2grid = part2grid_6 = NULL; + part2grid = part2grid_6 = nullptr; } /* ---------------------------------------------------------------------- @@ -295,9 +295,9 @@ void PPPMDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; - double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; + double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : nullptr; if (!(ptr||p_cutoff||p_cutoff_lj)) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -377,7 +377,7 @@ void PPPMDisp::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL) + if (force->angle == nullptr || force->bond == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -411,7 +411,7 @@ void PPPMDisp::init() int iteration = 0; if (function[0]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order >= minorder) { if (iteration && me == 0) @@ -492,7 +492,7 @@ void PPPMDisp::init() iteration = 0; if (function[1] + function[2] + function[3]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order_6 >= minorder) { if (iteration && me == 0) @@ -1281,14 +1281,14 @@ void PPPMDisp::init_coeffs() // local pair coeffs int n = atom->ntypes; int converged; delete [] B; - B = NULL; + B = nullptr; if (function[3] + function[2]) { // no mixing rule or arithmetic if (function[2] && me == 0) utils::logmesg(lmp," Optimizing splitting of Dispersion coefficients\n"); // allocate data for eigenvalue decomposition - double **A=NULL; - double **Q=NULL; + double **A=nullptr; + double **Q=nullptr; if ( n > 1 ) { // get dispersion coefficients double **b = (double **) force->pair->extract("B",tmp); @@ -2299,80 +2299,80 @@ void PPPMDisp::deallocate() memory->destroy3d_offset(vdy_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy3d_offset(vdz_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy(density_fft); - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; memory->destroy3d_offset(density_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_g); - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; memory->destroy3d_offset(density_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a0); - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; memory->destroy3d_offset(density_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a1); - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; memory->destroy3d_offset(density_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a2); - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; memory->destroy3d_offset(density_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a3); - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; memory->destroy3d_offset(density_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a4); - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; memory->destroy3d_offset(density_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a5); - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; memory->destroy3d_offset(density_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a6); - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; memory->destroy4d_offset(density_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdx_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdy_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdz_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_none); - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; memory->destroy(sf_precoeff1); memory->destroy(sf_precoeff2); @@ -2381,7 +2381,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5); memory->destroy(sf_precoeff6); sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; memory->destroy(sf_precoeff1_6); memory->destroy(sf_precoeff2_6); @@ -2390,7 +2390,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5_6); memory->destroy(sf_precoeff6_6); sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = - sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = NULL; + sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = nullptr; memory->destroy(greensfn); memory->destroy(greensfn_6); @@ -2402,45 +2402,45 @@ void PPPMDisp::deallocate() memory->destroy(vg2); memory->destroy(vg_6); memory->destroy(vg2_6); - greensfn = greensfn_6 = NULL; - work1 = work2 = work1_6 = work2_6 = NULL; - vg = vg2 = vg_6 = vg2_6 = NULL; + greensfn = greensfn_6 = nullptr; + work1 = work2 = work1_6 = work2_6 = nullptr; + vg = vg2 = vg_6 = vg2_6 = nullptr; memory->destroy1d_offset(fkx,nxlo_fft); memory->destroy1d_offset(fky,nylo_fft); memory->destroy1d_offset(fkz,nzlo_fft); - fkx = fky = fkz = NULL; + fkx = fky = fkz = nullptr; memory->destroy1d_offset(fkx2,nxlo_fft); memory->destroy1d_offset(fky2,nylo_fft); memory->destroy1d_offset(fkz2,nzlo_fft); - fkx2 = fky2 = fkz2 = NULL; + fkx2 = fky2 = fkz2 = nullptr; memory->destroy1d_offset(fkx_6,nxlo_fft_6); memory->destroy1d_offset(fky_6,nylo_fft_6); memory->destroy1d_offset(fkz_6,nzlo_fft_6); - fkx_6 = fky_6 = fkz_6 = NULL; + fkx_6 = fky_6 = fkz_6 = nullptr; memory->destroy1d_offset(fkx2_6,nxlo_fft_6); memory->destroy1d_offset(fky2_6,nylo_fft_6); memory->destroy1d_offset(fkz2_6,nzlo_fft_6); - fkx2_6 = fky2_6 = fkz2_6 = NULL; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; memory->destroy(gf_b); memory->destroy2d_offset(rho1d,-order/2); memory->destroy2d_offset(rho_coeff,(1-order)/2); memory->destroy2d_offset(drho1d,-order/2); memory->destroy2d_offset(drho_coeff, (1-order)/2); - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; memory->destroy(gf_b_6); memory->destroy2d_offset(rho1d_6,-order_6/2); memory->destroy2d_offset(rho_coeff_6,(1-order_6)/2); memory->destroy2d_offset(drho1d_6,-order_6/2); memory->destroy2d_offset(drho_coeff_6,(1-order_6)/2); - gf_b_6 = NULL; - rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = NULL; + gf_b_6 = nullptr; + rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = nullptr; memory->destroy(gc_buf1); memory->destroy(gc_buf2); @@ -2474,7 +2474,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick, nzlo_out, nylo_out, nxlo_out); memory->destroy3d_offset(v5_brick, nzlo_out, nylo_out, nxlo_out); u_brick = v0_brick = v1_brick = v2_brick = - v3_brick = v4_brick = v5_brick = NULL; + v3_brick = v4_brick = v5_brick = nullptr; memory->destroy3d_offset(u_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2484,7 +2484,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = - v3_brick_g = v4_brick_g = v5_brick_g = NULL; + v3_brick_g = v4_brick_g = v5_brick_g = nullptr; memory->destroy3d_offset(u_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2494,7 +2494,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = - v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = NULL; + v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = nullptr; memory->destroy3d_offset(u_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2504,7 +2504,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = - v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = NULL; + v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = nullptr; memory->destroy3d_offset(u_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2513,7 +2513,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = NULL; + u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = nullptr; memory->destroy3d_offset(u_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2522,7 +2522,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = NULL; + u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = nullptr; memory->destroy3d_offset(u_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2532,7 +2532,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = - v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = NULL; + v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = nullptr; memory->destroy3d_offset(u_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2542,7 +2542,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = - v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = NULL; + v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = nullptr; memory->destroy3d_offset(u_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2552,7 +2552,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = - v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = NULL; + v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = nullptr; memory->destroy4d_offset(u_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v0_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2562,7 +2562,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy4d_offset(v4_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v5_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = - v3_brick_none = v4_brick_none = v5_brick_none = NULL; + v3_brick_none = v4_brick_none = v5_brick_none = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index f71529ae83..afdc97e374 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -50,7 +50,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; PPPMStagger::PPPMStagger(LAMMPS *lmp) : PPPM(lmp), - gf_b2(NULL) + gf_b2(nullptr) { stagger_flag = 1; group_group_enable = 0; diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index d4cfdea2b0..41ba1a6782 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -252,7 +252,7 @@ struct remap_plan_3d *remap_3d_create_plan( // allocate memory for plan data struct plan = (struct remap_plan_3d *) malloc(sizeof(struct remap_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; // store parameters in local data structs @@ -284,10 +284,10 @@ struct remap_plan_3d *remap_3d_create_plan( // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -313,8 +313,8 @@ struct remap_plan_3d *remap_3d_create_plan( plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -395,9 +395,9 @@ struct remap_plan_3d *remap_3d_create_plan( plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -456,7 +456,7 @@ struct remap_plan_3d *remap_3d_create_plan( // create sub-comm rank list if (plan->usecollective) { - plan->commringlist = NULL; + plan->commringlist = nullptr; // merge recv and send rank lists // ask Steve Plimpton about method to more accurately determine @@ -578,7 +578,7 @@ struct remap_plan_3d *remap_3d_create_plan( // find biggest send message (not including self) and malloc space for it - plan->sendbuf = NULL; + plan->sendbuf = nullptr; size = 0; for (nsend = 0; nsend < plan->nsend; nsend++) @@ -586,20 +586,20 @@ struct remap_plan_3d *remap_3d_create_plan( if (size) { plan->sendbuf = (FFT_SCALAR *) malloc(size*sizeof(FFT_SCALAR)); - if (plan->sendbuf == NULL) return NULL; + if (plan->sendbuf == nullptr) return nullptr; } // if requested, allocate internal scratch space for recvs, // only need it if I will receive any data (including self) - plan->scratch = NULL; + plan->scratch = nullptr; if (memory == 1) { if (nrecv > 0) { plan->scratch = (FFT_SCALAR *) malloc(nqty*out.isize*out.jsize*out.ksize * sizeof(FFT_SCALAR)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } } @@ -643,7 +643,7 @@ void remap_3d_destroy_plan(struct remap_plan_3d *plan) MPI_Comm_free(&plan->comm); if (plan->usecollective) { - if (plan->commringlist != NULL) + if (plan->commringlist != nullptr) free(plan->commringlist); } diff --git a/src/KSPACE/remap_wrap.cpp b/src/KSPACE/remap_wrap.cpp index 4aaaa1329e..de85339474 100644 --- a/src/KSPACE/remap_wrap.cpp +++ b/src/KSPACE/remap_wrap.cpp @@ -31,7 +31,7 @@ Remap::Remap(LAMMPS *lmp, MPI_Comm comm, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 7d4e89272d..0581f1e359 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -74,10 +74,10 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : thermo_virial = 1; // store ID of compute pe/atom used to generate Coulomb potential for LATTE - // NULL means LATTE will compute Coulombic potential + // nullptr means LATTE will compute Coulombic potential coulomb = 0; - id_pe = NULL; + id_pe = nullptr; if (strcmp(arg[3],"NULL") != 0) { coulomb = 1; @@ -97,8 +97,8 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : // initializations nmax = 0; - qpotential = NULL; - flatte = NULL; + qpotential = nullptr; + flatte = nullptr; latte_energy = 0.0; } @@ -136,7 +136,7 @@ void FixLatte::init() error->all(FLERR,"Fix latte requires 3d problem"); if (coulomb) { - if (atom->q_flag == 0 || force->pair == NULL || force->kspace == NULL) + if (atom->q_flag == 0 || force->pair == nullptr || force->kspace == nullptr) error->all(FLERR,"Fix latte cannot compute Coulomb potential"); int ipe = modify->find_compute(id_pe); @@ -154,7 +154,7 @@ void FixLatte::init() // create qpotential & flatte if needed // for now, assume nlocal will never change - if (coulomb && qpotential == NULL) { + if (coulomb && qpotential == nullptr) { memory->create(qpotential,atom->nlocal,"latte:qpotential"); memory->create(flatte,atom->nlocal,3,"latte:flatte"); } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 54169d08d7..bddec9e2ec 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -39,7 +39,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), comb(NULL), comb3(NULL), qf(NULL), q1(NULL), q2(NULL) + fp(nullptr), comb(nullptr), comb3(nullptr), qf(nullptr), q1(nullptr), q2(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix qeq/comb command"); @@ -65,7 +65,7 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/comb command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,std::string("Cannot open fix qeq/comb file ") + arg[iarg+1]); } @@ -85,8 +85,8 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) qf[i] = 0.0; - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; comm_forward = 1; } @@ -121,7 +121,7 @@ void FixQEQComb::init() comb = (PairComb *) force->pair_match("^comb",0); comb3 = (PairComb3 *) force->pair_match("^comb3",0); - if (comb == NULL && comb3 == NULL) + if (comb == nullptr && comb3 == nullptr) error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb"); if (utils::strmatch(update->integrate_style,"^respa")) { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index ff30ac7b1e..4eeab89381 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -41,25 +41,25 @@ PairADP::PairADP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nmax = 0; - rho = NULL; - fp = NULL; - mu = NULL; - lambda = NULL; - map = NULL; - - setfl = NULL; - - frho = NULL; - rhor = NULL; - z2r = NULL; - u2r = NULL; - w2r = NULL; - - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; - u2r_spline = NULL; - w2r_spline = NULL; + rho = nullptr; + fp = nullptr; + mu = nullptr; + lambda = nullptr; + map = nullptr; + + setfl = nullptr; + + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + u2r = nullptr; + w2r = nullptr; + + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; + u2r_spline = nullptr; + w2r_spline = nullptr; // set comm size needed by this Pair @@ -465,7 +465,7 @@ void PairADP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 7ab2eaa27b..8643f54812 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -61,13 +61,13 @@ PairAIREBO::PairAIREBO(LAMMPS *lmp) pvector = new double[nextra]; maxlocal = 0; - REBO_numneigh = NULL; - REBO_firstneigh = NULL; - ipage = NULL; + REBO_numneigh = nullptr; + REBO_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - nC = nH = NULL; - map = NULL; + nC = nH = nullptr; + map = nullptr; manybody_flag = 1; sigwid = 0.84; @@ -185,7 +185,7 @@ void PairAIREBO::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and H - // map[i] = which element (0,1) the Ith atom type is, -1 if NULL + // map[i] = which element (0,1) the Ith atom type is, -1 if nullptr for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -245,7 +245,7 @@ void PairAIREBO::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index ab02533cec..d605ddc2d8 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -40,7 +40,7 @@ class PairAIREBO : public Pair { enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code protected: - int *map; // 0 (C), 1 (H), or -1 (NULL) for each type + int *map; // 0 (C), 1 (H), or -1 (nullptr) for each type int variant; int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index 2a69e70b81..a6bf0ac400 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -311,10 +311,10 @@ void PairATM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) for (k = j; k <= atom->ntypes; k++) { - if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&nu[i][j][k],1,MPI_DOUBLE,0,world); } } @@ -339,8 +339,8 @@ void PairATM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_triple,1,MPI_DOUBLE,0,world); diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index e7c2f64672..4c7d30e457 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -64,114 +64,114 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; allocated = 0; - BOP_index = NULL; - BOP_index3 = NULL; - BOP_total = NULL; - BOP_total3 = NULL; - map = NULL; - pi_a = NULL; - pro_delta = NULL; - pi_delta = NULL; - pi_p = NULL; - pi_c = NULL; - r1 = NULL; - sigma_r0 = NULL; - pi_r0 = NULL; - phi_r0 = NULL; - sigma_rc = NULL; - pi_rc = NULL; - phi_rc = NULL; - sigma_beta0 = NULL; - pi_beta0 = NULL; - phi0 = NULL; - sigma_n = NULL; - pi_n = NULL; - phi_m = NULL; - sigma_nc = NULL; - pi_nc = NULL; - phi_nc = NULL; - pro = NULL; - sigma_delta = NULL; - sigma_c = NULL; - sigma_a = NULL; - sigma_f = NULL; - sigma_k = NULL; - small3 = NULL; - rcut = NULL; - rcut3 = NULL; - rcutsq = NULL; - rcutsq3 = NULL; - dr = NULL; - rdr = NULL; - dr3 = NULL; - rdr3 = NULL; - disij = NULL; - rij = NULL; - neigh_index = NULL; - neigh_index3 = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - cosAng = NULL; - betaS = NULL; - dBetaS = NULL; - betaP = NULL; - dBetaP = NULL; - repul = NULL; - dRepul = NULL; - itypeSigBk = NULL; - itypePiBk = NULL; - pBetaS = NULL; - pBetaS1 = NULL; - pBetaS2 = NULL; - pBetaS3 = NULL; - pBetaS4 = NULL; - pBetaS5 = NULL; - pBetaS6 = NULL; - pLong = NULL; - pLong1 = NULL; - pLong2 = NULL; - pLong3 = NULL; - pLong4 = NULL; - pLong5 = NULL; - pLong6 = NULL; - pBetaP = NULL; - pBetaP1 = NULL; - pBetaP2 = NULL; - pBetaP3 = NULL; - pBetaP4 = NULL; - pBetaP5 = NULL; - pBetaP6 = NULL; - pRepul = NULL; - pRepul1 = NULL; - pRepul2 = NULL; - pRepul3 = NULL; - pRepul4 = NULL; - pRepul5 = NULL; - pRepul6 = NULL; - FsigBO = NULL; - FsigBO1 = NULL; - FsigBO2 = NULL; - FsigBO3 = NULL; - FsigBO4 = NULL; - FsigBO5 = NULL; - FsigBO6 = NULL; - rcmin = NULL; - rcmax = NULL; - rcmaxp = NULL; - setflag = NULL; - cutsq = NULL; - cutghost = NULL; - - gfunc = NULL; - gfunc1 = NULL; - gfunc2 = NULL; - gfunc3 = NULL; - gfunc4 = NULL; - gfunc5 = NULL; - gfunc6 = NULL; - gpara = NULL; - bt_sg=NULL; - bt_pi=NULL; + BOP_index = nullptr; + BOP_index3 = nullptr; + BOP_total = nullptr; + BOP_total3 = nullptr; + map = nullptr; + pi_a = nullptr; + pro_delta = nullptr; + pi_delta = nullptr; + pi_p = nullptr; + pi_c = nullptr; + r1 = nullptr; + sigma_r0 = nullptr; + pi_r0 = nullptr; + phi_r0 = nullptr; + sigma_rc = nullptr; + pi_rc = nullptr; + phi_rc = nullptr; + sigma_beta0 = nullptr; + pi_beta0 = nullptr; + phi0 = nullptr; + sigma_n = nullptr; + pi_n = nullptr; + phi_m = nullptr; + sigma_nc = nullptr; + pi_nc = nullptr; + phi_nc = nullptr; + pro = nullptr; + sigma_delta = nullptr; + sigma_c = nullptr; + sigma_a = nullptr; + sigma_f = nullptr; + sigma_k = nullptr; + small3 = nullptr; + rcut = nullptr; + rcut3 = nullptr; + rcutsq = nullptr; + rcutsq3 = nullptr; + dr = nullptr; + rdr = nullptr; + dr3 = nullptr; + rdr3 = nullptr; + disij = nullptr; + rij = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + cosAng = nullptr; + betaS = nullptr; + dBetaS = nullptr; + betaP = nullptr; + dBetaP = nullptr; + repul = nullptr; + dRepul = nullptr; + itypeSigBk = nullptr; + itypePiBk = nullptr; + pBetaS = nullptr; + pBetaS1 = nullptr; + pBetaS2 = nullptr; + pBetaS3 = nullptr; + pBetaS4 = nullptr; + pBetaS5 = nullptr; + pBetaS6 = nullptr; + pLong = nullptr; + pLong1 = nullptr; + pLong2 = nullptr; + pLong3 = nullptr; + pLong4 = nullptr; + pLong5 = nullptr; + pLong6 = nullptr; + pBetaP = nullptr; + pBetaP1 = nullptr; + pBetaP2 = nullptr; + pBetaP3 = nullptr; + pBetaP4 = nullptr; + pBetaP5 = nullptr; + pBetaP6 = nullptr; + pRepul = nullptr; + pRepul1 = nullptr; + pRepul2 = nullptr; + pRepul3 = nullptr; + pRepul4 = nullptr; + pRepul5 = nullptr; + pRepul6 = nullptr; + FsigBO = nullptr; + FsigBO1 = nullptr; + FsigBO2 = nullptr; + FsigBO3 = nullptr; + FsigBO4 = nullptr; + FsigBO5 = nullptr; + FsigBO6 = nullptr; + rcmin = nullptr; + rcmax = nullptr; + rcmaxp = nullptr; + setflag = nullptr; + cutsq = nullptr; + cutghost = nullptr; + + gfunc = nullptr; + gfunc1 = nullptr; + gfunc2 = nullptr; + gfunc3 = nullptr; + gfunc4 = nullptr; + gfunc5 = nullptr; + gfunc6 = nullptr; + gpara = nullptr; + bt_sg=nullptr; + bt_pi=nullptr; } /* ---------------------------------------------------------------------- @@ -5627,12 +5627,12 @@ void PairBOP::memory_theta_destroy() memory->destroy(neigh_flag3); memory->destroy(neigh_index); memory->destroy(neigh_index3); - itypeSigBk = NULL; - itypePiBk = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - neigh_index = NULL; - neigh_index3 = NULL; + itypeSigBk = nullptr; + itypePiBk = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; if(otfly==0) { memory->destroy(cosAng); memory->destroy(dcAng); @@ -5680,7 +5680,7 @@ void PairBOP::grow_pi(int n1, int n2) } } memory->destroy(bt_pi); - bt_pi=NULL; + bt_pi=nullptr; bt_pi = (B_PI *) memory->smalloc(n2*sizeof(B_PI),"BOP:bt_pi"); for(i=0;idestroy(bt_sg); - bt_sg=NULL; + bt_sg=nullptr; bt_sg = (B_SG *) memory->smalloc(n2*sizeof(B_SG),"BOP:bt_sg"); for(i=0;iall(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -465,7 +465,7 @@ void PairComb::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -542,7 +542,7 @@ void PairComb::init_style() //for (i = 0; i < modify->nfix; i++) // if (strcmp(modify->fix[i]->style,"qeq") == 0) break; //if (i < modify->nfix) fixqeq = (FixQEQ *) modify->fix[i]; - //else fixqeq = NULL; + //else fixqeq = nullptr; // need a full neighbor list @@ -554,7 +554,7 @@ void PairComb::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 265d30c6f7..fd4f1b3822 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -54,38 +54,38 @@ PairComb3::PairComb3(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nmax = 0; - NCo = NULL; - bbij = NULL; - map = NULL; - esm = NULL; + NCo = nullptr; + bbij = nullptr; + map = nullptr; + esm = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; - - intype = NULL; - afb = NULL; - dafb = NULL; - fafb = NULL; - dfafb = NULL; - ddfafb = NULL; - phin = NULL; - dphin = NULL; - erpaw = NULL; - vvdw = NULL; - vdvdw = NULL; - dpl = NULL; - xcctmp = NULL; - xchtmp = NULL; - xcotmp = NULL; - - sht_num = NULL; - sht_first = NULL; - - ipage = NULL; + params = nullptr; + elem2param = nullptr; + + intype = nullptr; + afb = nullptr; + dafb = nullptr; + fafb = nullptr; + dfafb = nullptr; + ddfafb = nullptr; + phin = nullptr; + dphin = nullptr; + erpaw = nullptr; + vvdw = nullptr; + vdvdw = nullptr; + dpl = nullptr; + xcctmp = nullptr; + xchtmp = nullptr; + xcotmp = nullptr; + + sht_num = nullptr; + sht_first = nullptr; + + ipage = nullptr; pgsize = oneatom = 0; cflag = 0; @@ -192,7 +192,7 @@ void PairComb3::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -201,7 +201,7 @@ void PairComb3::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -277,7 +277,7 @@ void PairComb3::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 999384ea2f..ac96c040bb 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -46,26 +46,26 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nmax = 0; - rho = NULL; - fp = NULL; - numforce = NULL; - map = NULL; - type2frho = NULL; + rho = nullptr; + fp = nullptr; + numforce = nullptr; + map = nullptr; + type2frho = nullptr; nfuncfl = 0; - funcfl = NULL; + funcfl = nullptr; - setfl = NULL; - fs = NULL; + setfl = nullptr; + fs = nullptr; - frho = NULL; - rhor = NULL; - z2r = NULL; - scale = NULL; + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + scale = nullptr; - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; // set comm size needed by this Pair @@ -90,8 +90,8 @@ PairEAM::~PairEAM() memory->destroy(cutsq); delete [] map; delete [] type2frho; - map = NULL; - type2frho = NULL; + map = nullptr; + type2frho = nullptr; memory->destroy(type2rhor); memory->destroy(type2z2r); memory->destroy(scale); @@ -105,7 +105,7 @@ PairEAM::~PairEAM() memory->destroy(funcfl[i].zr); } memory->sfree(funcfl); - funcfl = NULL; + funcfl = nullptr; } if (setfl) { @@ -116,7 +116,7 @@ PairEAM::~PairEAM() memory->destroy(setfl->rhor); memory->destroy(setfl->z2r); delete setfl; - setfl = NULL; + setfl = nullptr; } if (fs) { @@ -127,7 +127,7 @@ PairEAM::~PairEAM() memory->destroy(fs->rhor); memory->destroy(fs->z2r); delete fs; - fs = NULL; + fs = nullptr; } memory->destroy(frho); @@ -937,5 +937,5 @@ void *PairEAM::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index d30f46aa36..055a2baf11 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -70,7 +70,7 @@ void PairEAMAlloy::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index dc36c73272..01ec02dd2e 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -44,9 +44,9 @@ PairEAMCD::PairEAMCD(LAMMPS *lmp, int _cdeamVersion) restartinfo = 0; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - rhoB = NULL; - D_values = NULL; - hcoeff = NULL; + rhoB = nullptr; + D_values = nullptr; + hcoeff = nullptr; // Set communication buffer sizes needed by this pair style. @@ -505,14 +505,14 @@ void PairEAMCD::read_h_coeff(char *filename) char nextline[MAXLINE]; int convert_flag = unit_convert_flag; fptr = utils::open_potential(filename, lmp, &convert_flag); - if (fptr == NULL) + if (fptr == nullptr) error->one(FLERR,fmt::format("Cannot open EAMCD potential file {}", filename)); // h coefficients are stored at the end of the file. // Skip to last line of file. - while(fgets(nextline, MAXLINE, fptr) != NULL) { + while(fgets(nextline, MAXLINE, fptr) != nullptr) { strcpy(line, nextline); } diff --git a/src/MANYBODY/pair_eam_cd.h b/src/MANYBODY/pair_eam_cd.h index ee84fb09c5..8f306d1019 100644 --- a/src/MANYBODY/pair_eam_cd.h +++ b/src/MANYBODY/pair_eam_cd.h @@ -49,7 +49,7 @@ public: /// Reports the memory usage of this pair style to LAMMPS. double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } /// Parses the coefficients of the h polynomial from the end of the EAM file. void read_h_coeff(char* filename); diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index dd45d12da3..90c24bb254 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -70,7 +70,7 @@ void PairEAMFS::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index cb5a95faa2..69e2832b37 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -41,25 +41,25 @@ PairEIM::PairEIM(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - setfl = NULL; + setfl = nullptr; nmax = 0; - rho = NULL; - fp = NULL; - map = NULL; + rho = nullptr; + fp = nullptr; + map = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; - negativity = NULL; - q0 = NULL; - cutforcesq = NULL; - Fij = NULL; - Gij = NULL; - phiij = NULL; + negativity = nullptr; + q0 = nullptr; + cutforcesq = nullptr; + Fij = nullptr; + Gij = nullptr; + phiij = nullptr; - Fij_spline = NULL; - Gij_spline = NULL; - phiij_spline = NULL; + Fij_spline = nullptr; + Gij_spline = nullptr; + phiij_spline = nullptr; // set comm size needed by this Pair @@ -388,7 +388,7 @@ void PairEIM::coeff(int narg, char **arg) read_file(arg[2+nelements]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3 + nelements; i < narg; i++) { m = i - (3+nelements) + 1; @@ -1062,7 +1062,7 @@ EIMPotentialFileReader::EIMPotentialFileReader(LAMMPS *lmp, FILE *fp = utils::open_potential(filename, lmp, &unit_convert); conversion_factor = utils::get_conversion_factor(utils::ENERGY,unit_convert); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR, fmt::format("cannot open eim potential file {}", filename)); } diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 051c30f873..dd9b55b7bf 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -51,11 +51,11 @@ PairGW::PairGW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void PairGW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -292,7 +292,7 @@ void PairGW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -370,7 +370,7 @@ double PairGW::init_one(int i, int j) void PairGW::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index ee3bebda13..69c677d0cf 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -61,7 +61,7 @@ PairGWZBL::PairGWZBL(LAMMPS *lmp) : PairGW(lmp) void PairGWZBL::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index d2e478b37d..c84361d7a6 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -48,13 +48,13 @@ PairLCBOP::PairLCBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - N = NULL; - M = NULL; + N = nullptr; + M = nullptr; } /* ---------------------------------------------------------------------- @@ -135,8 +135,8 @@ void PairLCBOP::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read args that map atom types to C and NULL - // map[i] = which element (0 for C) the Ith atom type is, -1 if NULL + // read args that map atom types to C and nullptr + // map[i] = which element (0 for C) the Ith atom type is, -1 if nullptr for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -193,7 +193,7 @@ void PairLCBOP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -970,7 +970,7 @@ void PairLCBOP::read_file(char *filename) if (me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open LCBOP potential file %s",filename); error->one(FLERR,str); diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index c7a7fab46d..9ca2e3d55e 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,7 +39,7 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 (NULL) for each type + int *map; // 0 (C) or -1 (nullptr) for each type int me; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 0a197a1576..a361955fa7 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -50,11 +50,11 @@ PairNb3bHarmonic::PairNb3bHarmonic(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -207,7 +207,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 0f7fd7a1c7..cdf9a7f23a 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -909,7 +909,7 @@ void PairPolymorphic::write_tables(int npts) { char tag[6] = ""; if (comm->me != 0) sprintf(tag,"%d",comm->me); - FILE* fp = NULL; + FILE* fp = nullptr; double xmin,xmax,x,uf,vf,wf,pf,gf,ff,ufp,vfp,wfp,pfp,gfp,ffp; char line[MAXLINE]; for (int i = 0; i < nelements; i++) { diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 2deb45ac75..9db9adf423 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -46,14 +46,14 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ void PairSW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -271,7 +271,7 @@ void PairSW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index c08c722e5f..21a8f7de67 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -50,14 +50,14 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -306,7 +306,7 @@ void PairTersoff::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -315,7 +315,7 @@ void PairTersoff::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 63765234b3..fea414f5fb 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -48,15 +48,15 @@ PairVashishta::PairVashishta(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; r0max = 0.0; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void PairVashishta::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -278,7 +278,7 @@ void PairVashishta::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index 5e0c2c16f7..8939efc78f 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; PairVashishtaTable::PairVashishtaTable(LAMMPS *lmp) : PairVashishta(lmp) { - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; } /* ---------------------------------------------------------------------- @@ -252,8 +252,8 @@ void PairVashishtaTable::create_tables() { memory->destroy(forceTable); memory->destroy(potentialTable); - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; tabinnersq = tabinner*tabinner; diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index f786179aa4..217646b92d 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -50,10 +50,10 @@ using namespace FixConst; FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), type_list(NULL), mu(NULL), qtype(NULL), - sqrt_mass_ratio(NULL), local_swap_iatom_list(NULL), - local_swap_jatom_list(NULL), local_swap_atom_list(NULL), - random_equal(NULL), random_unequal(NULL), c_pe(NULL) + idregion(nullptr), type_list(nullptr), mu(nullptr), qtype(nullptr), + sqrt_mass_ratio(nullptr), local_swap_iatom_list(nullptr), + local_swap_jatom_list(nullptr), local_swap_atom_list(nullptr), + random_equal(nullptr), random_unequal(nullptr), c_pe(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix atom/swap command"); @@ -105,9 +105,9 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : nswap_successes = 0.0; atom_swap_nmax = 0; - local_swap_atom_list = NULL; - local_swap_iatom_list = NULL; - local_swap_jatom_list = NULL; + local_swap_atom_list = nullptr; + local_swap_iatom_list = nullptr; + local_swap_jatom_list = nullptr; // set comm size needed by this Fix diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 8a7cd20b0f..a024bc20de 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -33,8 +33,8 @@ using namespace FixConst; FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - partner(NULL), finalpartner(NULL), distsq(NULL), probability(NULL), - broken(NULL), copy(NULL), random(NULL) + partner(nullptr), finalpartner(nullptr), distsq(nullptr), probability(nullptr), + broken(nullptr), copy(nullptr), random(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix bond/break command"); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index a2c2eee2c5..e485d370d8 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -40,8 +40,8 @@ using namespace MathConst; FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - bondcount(NULL), partner(NULL), finalpartner(NULL), distsq(NULL), - probability(NULL), created(NULL), copy(NULL), random(NULL), list(NULL) + bondcount(nullptr), partner(nullptr), finalpartner(nullptr), distsq(nullptr), + probability(nullptr), created(nullptr), copy(nullptr), random(nullptr), list(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix bond/create command"); @@ -163,7 +163,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // register with Atom class // bondcount values will be initialized in setup() - bondcount = NULL; + bondcount = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); countflag = 0; @@ -177,11 +177,11 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; maxcreate = 0; - created = NULL; + created = nullptr; // copy = special list for one atom // size = ms^2 + ms is sufficient @@ -237,7 +237,7 @@ void FixBondCreate::init() // check cutoff for iatomtype,jatomtype - if (force->pair == NULL || cutsq > force->pair->cutsq[iatomtype][jatomtype]) + if (force->pair == nullptr || cutsq > force->pair->cutsq[iatomtype][jatomtype]) error->all(FLERR,"Fix bond/create cutoff is longer than pairwise cutoff"); // warn if more than one fix bond/create or also a fix bond/break diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 270a497772..9b1f14516a 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -52,8 +52,8 @@ static const char cite_fix_bond_swap[] = FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tflag(0), alist(NULL), id_temp(NULL), type(NULL), x(NULL), list(NULL), - temperature(NULL), random(NULL) + tflag(0), alist(nullptr), id_temp(nullptr), type(nullptr), x(nullptr), list(nullptr), + temperature(nullptr), random(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_swap); @@ -96,7 +96,7 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : // initialize atom list nmax = 0; - alist = NULL; + alist = nullptr; naccept = foursome = 0; } @@ -130,7 +130,7 @@ void FixBondSwap::init() { // require an atom style with molecule IDs - if (atom->molecule == NULL) + if (atom->molecule == nullptr) error->all(FLERR, "Must use atom style with molecule IDs with fix bond/swap"); @@ -143,13 +143,13 @@ void FixBondSwap::init() // no dihedral or improper potentials allowed // special bonds must be 0 1 1 - if (force->pair == NULL || force->bond == NULL) + if (force->pair == nullptr || force->bond == nullptr) error->all(FLERR,"Fix bond/swap requires pair and bond styles"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support fix bond/swap"); - if (force->angle == NULL && atom->nangles > 0 && comm->me == 0) + if (force->angle == nullptr && atom->nangles > 0 && comm->me == 0) error->warning(FLERR,"Fix bond/swap will ignore defined angles"); if (force->dihedral || force->improper) diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index fc306696ed..670a1ff583 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -66,10 +66,10 @@ enum{MOVEATOM,MOVEMOL}; // movemode FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), ngroups(0), groupstrings(NULL), ngrouptypes(0), grouptypestrings(NULL), - grouptypebits(NULL), grouptypes(NULL), local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL), random_unequal(NULL), - fixrigid(NULL), fixshake(NULL), idrigid(NULL), idshake(NULL) + idregion(nullptr), full_flag(0), ngroups(0), groupstrings(nullptr), ngrouptypes(0), grouptypestrings(nullptr), + grouptypebits(nullptr), grouptypes(nullptr), local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr), random_unequal(nullptr), + fixrigid(nullptr), fixshake(nullptr), idrigid(nullptr), idshake(nullptr) { if (narg < 11) error->all(FLERR,"Illegal fix gcmc command"); @@ -167,7 +167,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix gcmc molecule must have atom types"); if (ngcmc_type != 0) error->all(FLERR,"Atom type must be zero in fix gcmc mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix gcmc molecule has charges, but atom style does not"); if (atom->molecular == 2 && onemols != atom->avec->onemols) @@ -176,7 +176,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) + if (charge_flag && atom->q == nullptr) error->all(FLERR,"Fix gcmc atom has charge, but atom style does not"); if (rigidflag && exchmode == EXCHATOM) @@ -219,7 +219,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : ninsertion_successes = 0.0; gcmc_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -258,12 +258,12 @@ void FixGCMC::options(int narg, char **arg) full_flag = false; ngroups = 0; int ngroupsmax = 0; - groupstrings = NULL; + groupstrings = nullptr; ngrouptypes = 0; int ngrouptypesmax = 0; - grouptypestrings = NULL; - grouptypes = NULL; - grouptypebits = NULL; + grouptypestrings = nullptr; + grouptypes = nullptr; + grouptypebits = nullptr; energy_intra = 0.0; tfac_insert = 1.0; overlap_cutoffsq = 0.0; @@ -481,7 +481,7 @@ void FixGCMC::init() if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("^hybrid",0)) || (force->pair_match("^eam",0)) || @@ -542,7 +542,7 @@ void FixGCMC::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix gcmc rigid fix does not exist"); @@ -557,7 +557,7 @@ void FixGCMC::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix gcmc shake fix does not exist"); diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index b855c0b79e..20b72dc269 100644 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xd(NULL), rotflag(0), random_num(NULL) + xd(nullptr), rotflag(0), random_num(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tfmc command"); @@ -83,7 +83,7 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : comflag = 0; if (rotflag) { - xd = NULL; + xd = nullptr; nmax = -1; } @@ -97,7 +97,7 @@ FixTFMC::~FixTFMC() delete random_num; if (rotflag) { memory->destroy(xd); - xd = NULL; + xd = nullptr; nmax = -1; } } diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 94b2481742..919cf6d3c3 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -58,9 +58,9 @@ enum{EXCHATOM,EXCHMOL}; // exchmode FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), - local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL) + idregion(nullptr), full_flag(0), + local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix Widom command"); @@ -151,7 +151,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix Widom molecule must have atom types"); if (nwidom_type != 0) error->all(FLERR,"Atom type must be zero in fix Widom mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix Widom molecule has charges, but atom style does not"); if (atom->molecular == 2 && onemols != atom->avec->onemols) @@ -160,7 +160,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) + if (charge_flag && atom->q == nullptr) error->all(FLERR,"Fix Widom atom has charge, but atom style does not"); // setup of array of coordinates for molecule insertion @@ -177,7 +177,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : // zero out counters widom_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void FixWidom::init() // decide whether to switch to the full_energy option if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("hybrid",0)) || (force->pair_match("eam",0)) || diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index 588d57f324..f4bac9b8cb 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -38,8 +38,8 @@ PairDSMC::PairDSMC(LAMMPS *lmp) : Pair(lmp) total_number_of_collisions = 0; max_particles = max_particle_list = 0; - next_particle = NULL; - random = NULL; + next_particle = nullptr; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -342,12 +342,12 @@ void PairDSMC::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -375,11 +375,11 @@ void PairDSMC::write_restart_settings(FILE *fp) void PairDSMC::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/MESSAGE/fix_client_md.cpp b/src/MESSAGE/fix_client_md.cpp index 1cbce3a7f9..aee8b2a069 100644 --- a/src/MESSAGE/fix_client_md.cpp +++ b/src/MESSAGE/fix_client_md.cpp @@ -62,7 +62,7 @@ FixClientMD::FixClientMD(LAMMPS *lmp, int narg, char **arg) : box[0][2] = box[1][2] = box[2][0] = box[2][1] = box[2][2] = 0.0; maxatom = 0; - xpbc = NULL; + xpbc = nullptr; // unit conversion factors for REAL // otherwise not needed diff --git a/src/MESSAGE/message.cpp b/src/MESSAGE/message.cpp index b83be0339c..b43a2686a2 100644 --- a/src/MESSAGE/message.cpp +++ b/src/MESSAGE/message.cpp @@ -116,6 +116,6 @@ void Message::quit() // clean-up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; lmp->clientserver = 0; } diff --git a/src/MESSAGE/server_mc.cpp b/src/MESSAGE/server_mc.cpp index af7850a0e9..44e4a628a0 100644 --- a/src/MESSAGE/server_mc.cpp +++ b/src/MESSAGE/server_mc.cpp @@ -77,7 +77,7 @@ void ServerMC::loop() cs->send(msgID,2); cs->pack_double(1,dval); - double *coords = NULL; + double *coords = nullptr; if (atom->nlocal) coords = &atom->x[0][0]; cs->pack_parallel(2,4,atom->nlocal,atom->tag,3,coords); @@ -143,5 +143,5 @@ void ServerMC::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } diff --git a/src/MESSAGE/server_md.cpp b/src/MESSAGE/server_md.cpp index 418162e5d9..d2bbb088b8 100644 --- a/src/MESSAGE/server_md.cpp +++ b/src/MESSAGE/server_md.cpp @@ -64,7 +64,7 @@ ServerMD::ServerMD(LAMMPS *lmp) : Pointers(lmp) pconvert = 1.0 / 0.986923; // atmospheres -> bars } - fcopy = NULL; + fcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -107,15 +107,15 @@ void ServerMD::loop() if (msgID == SETUP) { int dim = 0; - int *periodicity = NULL; + int *periodicity = nullptr; int natoms = -1; int ntypes = -1; - double *origin = NULL; - double *box = NULL; - int *types = NULL; - double *coords = NULL; - char *unit_style = NULL; - double *charge = NULL; + double *origin = nullptr; + double *box = nullptr; + int *types = nullptr; + double *coords = nullptr; + char *unit_style = nullptr; + double *charge = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == DIM) { @@ -185,7 +185,7 @@ void ServerMD::loop() int nlocal = 0; for (int i = 0; i < natoms; i++) { - if (!domain->ownatom(i+1,&coords[3*i],NULL,0)) continue; + if (!domain->ownatom(i+1,&coords[3*i],nullptr,0)) continue; atom->avec->create_atom(types[i],&coords[3*i]); atom->tag[nlocal] = i+1; if (charge) atom->q[nlocal] = charge[i]; @@ -226,9 +226,9 @@ void ServerMD::loop() } else if (msgID == STEP) { - double *coords = NULL; - double *origin = NULL; - double *box = NULL; + double *coords = nullptr; + double *origin = nullptr; + double *box = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == COORDS) { @@ -314,7 +314,7 @@ void ServerMD::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void ServerMD::send_fev(int msgID) cs->send(msgID,3); - double *forces = NULL; + double *forces = nullptr; if (atom->nlocal) { if (units != REAL) forces = &atom->f[0][0]; else { diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index d8be8679c6..f984aeac2e 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -36,8 +36,8 @@ enum{PAIR,TAIL,KSPACE}; /* ---------------------------------------------------------------------- */ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), nterms(0), which(NULL), ivar1(NULL), ivar2(NULL), - ilo(NULL), ihi(NULL), var1(NULL), var2(NULL), pptr(NULL), pstyle(NULL) + Compute(lmp, narg, arg), nterms(0), which(nullptr), ivar1(nullptr), ivar2(nullptr), + ilo(nullptr), ihi(nullptr), var1(nullptr), var2(nullptr), pptr(nullptr), pstyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute ti command"); @@ -64,7 +64,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : pptr = new Pair*[nterms]; pstyle = new char*[nterms]; - for (int m = 0; m < nterms; m++) pstyle[m] = NULL; + for (int m = 0; m < nterms; m++) pstyle[m] = nullptr; // parse keywords @@ -136,16 +136,16 @@ void ComputeTI::init() if (which[m] == PAIR) { pptr[m] = force->pair_match(pstyle[m],1); - if (pptr[m] == NULL) + if (pptr[m] == nullptr) error->all(FLERR,"Compute ti pair style does not exist"); } else if (which[m] == TAIL) { - if (force->pair == NULL || force->pair->tail_flag == 0) + if (force->pair == nullptr || force->pair->tail_flag == 0) error->all(FLERR,"Compute ti tail when pair style does not " "compute tail corrections"); } else if (which[m] == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Compute ti kspace style does not exist"); } } diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 9f2bbfe424..5c3ca7264e 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -53,7 +53,7 @@ int xdr3dfcoord(XDR *, float *, int *, float *); /* ---------------------------------------------------------------------- */ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xtc command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), size_one = 3; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; precision = 1000.0; @@ -137,9 +137,9 @@ void DumpXTC::init_style() void DumpXTC::openfile() { // XTC maintains it's own XDR file ptr - // set fp to NULL so parent dump class will not use it + // set fp to nullptr so parent dump class will not use it - fp = NULL; + fp = nullptr; if (me == 0) if (xdropen(&xd,filename,"w") == 0) error->one(FLERR,"Cannot open dump file"); } @@ -364,8 +364,8 @@ void DumpXTC::write_frame() static FILE *xdrfiles[MAXID]; static XDR *xdridptr[MAXID]; static char xdrmodes[MAXID]; -static int *ip = NULL; -static int *buf = NULL; +static int *ip = nullptr; +static int *buf = nullptr; /*___________________________________________________________________________ | @@ -414,12 +414,12 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) if (init_done == 0) { for (xdrid = 1; xdrid < MAXID; xdrid++) { - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; } init_done = 1; } xdrid = 1; - while (xdrid < MAXID && xdridptr[xdrid] != NULL) { + while (xdrid < MAXID && xdridptr[xdrid] != nullptr) { xdrid++; } if (xdrid == MAXID) { @@ -433,8 +433,8 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) lmode = XDR_DECODE; } xdrfiles[xdrid] = fopen(filename, type); - if (xdrfiles[xdrid] == NULL) { - xdrs = NULL; + if (xdrfiles[xdrid] == nullptr) { + xdrs = nullptr; return 0; } xdrmodes[xdrid] = *type; @@ -444,7 +444,7 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) * (C users are expected to pass the address of an already allocated * XDR staructure) */ - if (xdrs == NULL) { + if (xdrs == nullptr) { xdridptr[xdrid] = (XDR *) malloc(sizeof(XDR)); xdrstdio_create(xdridptr[xdrid], xdrfiles[xdrid], lmode); } else { @@ -468,7 +468,7 @@ int xdrclose(XDR *xdrs) { int xdrid; - if (xdrs == NULL) { + if (xdrs == nullptr) { fprintf(stderr, "xdrclose: passed a NULL pointer\n"); exit(1); } @@ -477,7 +477,7 @@ int xdrclose(XDR *xdrs) xdr_destroy(xdrs); fclose(xdrfiles[xdrid]); - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; return 1; } } @@ -495,8 +495,8 @@ void xdrfreebuf() { if (ip) free(ip); if (buf) free(buf); - ip = NULL; - buf = NULL; + ip = nullptr; + buf = nullptr; } @@ -815,28 +815,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *) realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } @@ -1059,28 +1059,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) (xdrproc_t)xdr_float)); } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *)realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *)realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 7ee6fce1b9..35b5e0e405 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -44,9 +44,9 @@ enum{DIST_UNIFORM,DIST_GAUSSIAN}; /* ---------------------------------------------------------------------- */ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), idrigid(NULL), - idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), imageflags(NULL), - fixrigid(NULL), fixshake(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), idrigid(nullptr), + idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), imageflags(nullptr), + fixrigid(nullptr), fixshake(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix deposit command"); @@ -233,7 +233,7 @@ void FixDeposit::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix deposit rigid fix does not exist"); @@ -248,7 +248,7 @@ void FixDeposit::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix deposit shake fix does not exist"); @@ -658,13 +658,13 @@ void FixDeposit::options(int narg, char **arg) // defaults iregion = -1; - idregion = NULL; + idregion = nullptr; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; globalflag = localflag = 0; lo = hi = deltasq = 0.0; @@ -904,5 +904,5 @@ void *FixDeposit::extract(const char *str, int &itype) return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index bd2f9acfb9..d3836f52a5 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -40,8 +40,8 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), - estr(NULL), idregion(NULL), efield(NULL) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), + estr(nullptr), idregion(nullptr), efield(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix efield command"); @@ -57,7 +57,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -89,8 +89,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; - estr = NULL; + idregion = nullptr; + estr = nullptr; int iarg = 6; while (iarg < narg) { @@ -272,7 +272,7 @@ void FixEfield::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index 6396d139a0..0d3b400106 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -33,7 +33,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), list(NULL), mark(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), list(nullptr), mark(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix evaporate command"); @@ -84,8 +84,8 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : ndeleted = 0; nmax = 0; - list = NULL; - mark = NULL; + list = nullptr; + mark = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 75642b632f..6f56eb4d5c 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - step_respa(NULL), prony_c(NULL), prony_tau(NULL), s_gld(NULL), random(NULL) + step_respa(nullptr), prony_c(nullptr), prony_tau(nullptr), s_gld(nullptr), random(nullptr) { int narg_min = 8; // Check to make sure we have the minimal number of inputs @@ -89,7 +89,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : // allocate memory for Prony series timescale coefficients memory->create(prony_tau, prony_terms, "gld:prony_tau"); // allocate memory for Prony series extended variables - s_gld = NULL; + s_gld = nullptr; grow_arrays(atom->nmax); // add callbacks to enable restarts atom->add_callback(0); diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index 1ca24a5906..3508c2fd7e 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -35,7 +35,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { direction = NONE; regionidx = 0; - regionstr = NULL; + regionstr = nullptr; if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index cc22a509ba..7d9463f77c 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -56,7 +56,7 @@ static const char cite_fix_orient_bcc[] = FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_bcc); @@ -114,7 +114,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); @@ -124,7 +124,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index f391eab91e..0677b8d57c 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -53,8 +53,8 @@ static const char cite_fix_orient_fcc[] = FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), - sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), + sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_fcc); @@ -112,7 +112,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); @@ -122,7 +122,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); diff --git a/src/MISC/fix_thermal_conductivity.cpp b/src/MISC/fix_thermal_conductivity.cpp index 115045db81..ac86162e31 100644 --- a/src/MISC/fix_thermal_conductivity.cpp +++ b/src/MISC/fix_thermal_conductivity.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - index_lo(NULL), index_hi(NULL), ke_lo(NULL), ke_hi(NULL) + index_lo(nullptr), index_hi(nullptr), ke_lo(nullptr), ke_hi(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix thermal/conductivity command"); diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index 2d38f3c6c6..31585cea9e 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -42,11 +42,11 @@ using namespace FixConst; FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (narg < 15) error->all(FLERR,"Illegal fix ttm command"); @@ -74,7 +74,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : if (narg != 16) error->all(FLERR,"Illegal fix ttm command"); if (comm->me == 0) { fp = fopen(arg[15],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open output file {}: {}", arg[15], utils::getsyserror())); } @@ -128,7 +128,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "TTM:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -341,7 +341,7 @@ void FixTTM::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/MISC/fix_viscosity.cpp b/src/MISC/fix_viscosity.cpp index 5dcd2d291d..90e6fcda63 100644 --- a/src/MISC/fix_viscosity.cpp +++ b/src/MISC/fix_viscosity.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pos_index(NULL), neg_index(NULL), pos_delta(NULL), neg_delta(NULL) + pos_index(nullptr), neg_index(nullptr), pos_delta(nullptr), neg_delta(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix viscosity command"); diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 4fc1fb0628..4090677a03 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -319,15 +319,15 @@ void PairNMCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -357,10 +357,10 @@ void PairNMCut::write_restart_settings(FILE *fp) void PairNMCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -422,5 +422,5 @@ void *PairNMCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 4a18680415..1f0ae96324 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -370,16 +370,16 @@ void PairNMCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -411,11 +411,11 @@ void PairNMCutCoulCut::write_restart_settings(FILE *fp) void PairNMCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -493,5 +493,5 @@ void *PairNMCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index 576637c593..a981204af6 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -46,7 +46,7 @@ using namespace MathConst; PairNMCutCoulLong::PairNMCutCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -308,13 +308,13 @@ void PairNMCutCoulLong::init_style() cut_coulsq = cut_coul * cut_coul; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -414,15 +414,15 @@ void PairNMCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -455,13 +455,13 @@ void PairNMCutCoulLong::write_restart_settings(FILE *fp) void PairNMCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -576,5 +576,5 @@ void *PairNMCutCoulLong::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/xdr_compat.cpp b/src/MISC/xdr_compat.cpp index 9806b0bbd2..7483b4aa18 100644 --- a/src/MISC/xdr_compat.cpp +++ b/src/MISC/xdr_compat.cpp @@ -352,7 +352,7 @@ xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt) /* * XDR null terminated ASCII strings * xdr_string deals with "C strings" - arrays of bytes that are - * terminated by a NULL character. The parameter cpp references a + * terminated by a nullptr character. The parameter cpp references a * pointer to storage; If the pointer is null, then the necessary * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. @@ -370,13 +370,13 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) switch (xdrs->x_op) { case XDR_FREE: - if (sp == NULL) + if (sp == nullptr) { return TRUE; /* already free */ } /* fall through... */ case XDR_ENCODE: - if (sp == NULL) + if (sp == nullptr) return FALSE; size = strlen (sp); break; @@ -404,9 +404,9 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) { return TRUE; } - if (sp == NULL) + if (sp == nullptr) *cpp = sp = (char *) malloc (nodesize); - if (sp == NULL) + if (sp == nullptr) { (void) fputs ("xdr_string: out of memory\n", stderr); return FALSE; @@ -419,7 +419,7 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) case XDR_FREE: free (sp); - *cpp = NULL; + *cpp = nullptr; return TRUE; } return FALSE; @@ -660,7 +660,7 @@ xdrstdio_inline (XDR * /*xdrs*/, int /*len*/) * most of the gains to be had here and require storage * management on this buffer, so we don't do this. */ - return NULL; + return nullptr; } static bool_t diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp index 956cb0196f..fe406772ca 100644 --- a/src/MLIAP/compute_mliap.cpp +++ b/src/MLIAP/compute_mliap.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), mliaparray(NULL), - mliaparrayall(NULL), map(NULL) + Compute(lmp, narg, arg), mliaparray(nullptr), + mliaparrayall(nullptr), map(nullptr) { array_flag = 1; extarray = 0; @@ -127,7 +127,7 @@ ComputeMLIAP::~ComputeMLIAP() void ComputeMLIAP::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute mliap requires a pair style be defined"); if (descriptor->cutmax > force->pair->cutforce) diff --git a/src/MLIAP/mliap_data.cpp b/src/MLIAP/mliap_data.cpp index a7e50012cb..cb29dffd46 100644 --- a/src/MLIAP/mliap_data.cpp +++ b/src/MLIAP/mliap_data.cpp @@ -25,10 +25,10 @@ MLIAPData::MLIAPData(LAMMPS *lmp, int gradgradflag_in, int *map_in, class MLIAPModel* model_in, class MLIAPDescriptor* descriptor_in, class PairMLIAP* pairmliap_in) : - Pointers(lmp), gradforce(NULL), betas(NULL), descriptors(NULL), gamma(NULL), - gamma_row_index(NULL), gamma_col_index(NULL), egradient(NULL), - numneighs(NULL), iatoms(NULL), ielems(NULL), jatoms(NULL), jelems(NULL), - rij(NULL), graddesc(NULL), model(NULL), descriptor(NULL), list(NULL) + Pointers(lmp), gradforce(nullptr), betas(nullptr), descriptors(nullptr), gamma(nullptr), + gamma_row_index(nullptr), gamma_col_index(nullptr), egradient(nullptr), + numneighs(nullptr), iatoms(nullptr), ielems(nullptr), jatoms(nullptr), jelems(nullptr), + rij(nullptr), graddesc(nullptr), model(nullptr), descriptor(nullptr), list(nullptr) { gradgradflag = gradgradflag_in; map = map_in; diff --git a/src/MLIAP/mliap_data.h b/src/MLIAP/mliap_data.h index 0307d93aee..ffac9ccd4c 100644 --- a/src/MLIAP/mliap_data.h +++ b/src/MLIAP/mliap_data.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class MLIAPData : protected Pointers { public: - MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = NULL); + MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = nullptr); ~MLIAPData(); void init(); diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 5f0ee33c8c..21ba68e9a8 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -35,10 +35,10 @@ MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): MLIAPDescriptor(lmp) { nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - snaptr = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + snaptr = nullptr; read_paramfile(paramfilename); snaptr = new SNA(lmp, rfac0, twojmax, @@ -374,7 +374,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) + if (fpparam == nullptr) error->one(FLERR,fmt::format("Cannot open SNAP parameter file {}: {}", paramfilename, utils::getsyserror())); } @@ -386,7 +386,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -406,7 +406,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { utils::logmesg(lmp, fmt::format("SNAP keyword {} {} \n", keywd, keyval)); @@ -427,19 +427,19 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) int n = strlen(elemtmp) + 1; elements[ielem] = new char[n]; strcpy(elements[ielem],elemtmp); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } elementsflag = 1; } else if (strcmp(keywd,"radelems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { radelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } radelemflag = 1; } else if (strcmp(keywd,"welems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { wjelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } wjelemflag = 1; } diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index b731e1c9f8..7ac1013c4f 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp) { - coeffelem = NULL; + coeffelem = nullptr; if (coefffilename) read_coeffs(coefffilename); else { nparams = 0; @@ -81,7 +81,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) + if (fpcoeff == nullptr) error->one(FLERR,fmt::format("Cannot open MLIAPModel coeff file {}: {}", coefffilename,utils::getsyserror())); } @@ -94,7 +94,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -119,7 +119,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); nparams = atoi(words[1]); @@ -134,7 +134,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) for (int icoeff = 0; icoeff < nparams; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; diff --git a/src/MLIAP/mliap_model_quadratic.h b/src/MLIAP/mliap_model_quadratic.h index 188d78661f..b41df18a07 100644 --- a/src/MLIAP/mliap_model_quadratic.h +++ b/src/MLIAP/mliap_model_quadratic.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { class MLIAPModelQuadratic : public MLIAPModel { public: - MLIAPModelQuadratic(LAMMPS*, char* = NULL); + MLIAPModelQuadratic(LAMMPS*, char* = nullptr); ~MLIAPModelQuadratic(); virtual int get_nparams(); virtual int get_gamma_nnz(class MLIAPData*); diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 6cd550384d..61051084bb 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -246,10 +246,10 @@ void AngleCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 0288a61d83..b4190d902d 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -194,7 +194,7 @@ void AngleCosine::read_restart(FILE *fp) { allocate(); - if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1; diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 1a05edc20b..1cf0cb8873 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -247,9 +247,9 @@ void AngleCosinePeriodic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 5fb40b54c9..dc1a20fd8b 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -37,8 +37,8 @@ using namespace MathConst; AngleCosineSquared::AngleCosineSquared(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleCosineSquared::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index eb5e48ec9b..19142f94c8 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -33,8 +33,8 @@ using namespace MathConst; AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 100b75cb0a..6e47bf7877 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -47,7 +47,7 @@ AngleTable::AngleTable(LAMMPS *lmp) : Angle(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -205,7 +205,7 @@ void AngleTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -311,8 +311,8 @@ void AngleTable::write_restart_settings(FILE *fp) void AngleTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -351,10 +351,10 @@ double AngleTable::single(int type, int i1, int i2, int i3) void AngleTable::null_table(Table *tb) { - tb->afile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->ang = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->afile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->ang = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 3dc8c90882..5e3e2df070 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -55,7 +55,7 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = 0; - bond_negative = angle_negative = NULL; + bond_negative = angle_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index 2fa445c8ee..22f47e5693 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -50,7 +50,7 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = 0; - bond_negative = NULL; + bond_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 866cf796c9..a69007cea6 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -75,7 +75,7 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index e90bec5108..da75316a75 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -75,7 +75,7 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index b2271d45fc..f79c56b636 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -215,10 +215,10 @@ void BondFENE::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -279,5 +279,5 @@ void *BondFENE::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 676d5f6871..8166e63e24 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -225,11 +225,11 @@ void BondFENEExpand::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 89b3830cb5..85653a60f3 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -167,8 +167,8 @@ void BondGromos::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -204,5 +204,5 @@ void *BondGromos::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 28100512a8..6e523b4923 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -168,8 +168,8 @@ void BondHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -208,7 +208,7 @@ void *BondHarmonic::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 49074e1cdc..f7e4e6c919 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -173,9 +173,9 @@ void BondMorse::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&d0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -213,5 +213,5 @@ void *BondMorse::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 63b640730a..7c74d8f418 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -168,9 +168,9 @@ void BondNonlinear::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&epsilon[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -211,5 +211,5 @@ void *BondNonlinear::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"epsilon")==0) return (void*) epsilon; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index c8d182e4ff..4fd22f3778 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -229,7 +229,7 @@ void BondQuartic::coeff(int narg, char **arg) void BondQuartic::init_style() { - if (force->pair == NULL || force->pair->single_enable == 0) + if (force->pair == nullptr || force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support bond_style quartic"); if (force->angle || force->dihedral || force->improper) error->all(FLERR, @@ -276,11 +276,11 @@ void BondQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&b1[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 5cc91ceae0..a7fbbb84d7 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -43,7 +43,7 @@ BondTable::BondTable(LAMMPS *lmp) : Bond(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -157,7 +157,7 @@ void BondTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -254,8 +254,8 @@ void BondTable::write_restart_settings(FILE *fp) void BondTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -278,10 +278,10 @@ double BondTable::single(int type, double rsq, int /*i*/, int /*j*/, void BondTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 11422e0820..cc615213a0 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -389,7 +389,7 @@ void DihedralCharmm::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmm is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -424,11 +424,11 @@ void DihedralCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 408be8ef99..a124212117 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -407,7 +407,7 @@ void DihedralCharmmfsw::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -428,8 +428,8 @@ void DihedralCharmmfsw::init_style() double *p_cutlj = (double *) force->pair->extract("cut_lj",itmp); double *p_cutcoul = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutcoul == NULL || p_cutljinner == NULL || - p_cutlj == NULL || p_dihedflag == NULL) + if (p_cutcoul == nullptr || p_cutljinner == nullptr || + p_cutlj == nullptr || p_dihedflag == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); dihedflag = *p_dihedflag; @@ -467,11 +467,11 @@ void DihedralCharmmfsw::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 55e2f25006..87ade01be3 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -328,9 +328,9 @@ void DihedralHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 40e026c2f1..8c4ba07fb6 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -323,9 +323,9 @@ void DihedralHelix::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&aphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&bphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 963304da80..57c017bd95 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -319,11 +319,11 @@ void DihedralMultiHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&a1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index fe05dc7c3d..39b979ff23 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -331,10 +331,10 @@ void DihedralOPLS::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 2de6dd4183..0de406120d 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -62,11 +62,11 @@ using namespace MathConst; FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - crosstermlist(NULL), num_crossterm(NULL), crossterm_type(NULL), - crossterm_atom1(NULL), crossterm_atom2(NULL), crossterm_atom3(NULL), - crossterm_atom4(NULL), crossterm_atom5(NULL), - g_axis(NULL), cmapgrid(NULL), d1cmapgrid(NULL), d2cmapgrid(NULL), - d12cmapgrid(NULL) + crosstermlist(nullptr), num_crossterm(nullptr), crossterm_type(nullptr), + crossterm_atom1(nullptr), crossterm_atom2(nullptr), crossterm_atom3(nullptr), + crossterm_atom4(nullptr), crossterm_atom5(nullptr), + g_axis(nullptr), cmapgrid(nullptr), d1cmapgrid(nullptr), d2cmapgrid(nullptr), + d12cmapgrid(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix cmap command"); @@ -101,13 +101,13 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - num_crossterm = NULL; - crossterm_type = NULL; - crossterm_atom1 = NULL; - crossterm_atom2 = NULL; - crossterm_atom3 = NULL; - crossterm_atom4 = NULL; - crossterm_atom5 = NULL; + num_crossterm = nullptr; + crossterm_type = nullptr; + crossterm_atom1 = nullptr; + crossterm_atom2 = nullptr; + crossterm_atom3 = nullptr; + crossterm_atom4 = nullptr; + crossterm_atom5 = nullptr; nmax_previous = 0; grow_arrays(atom->nmax); @@ -118,7 +118,7 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : ncmap = 0; maxcrossterm = 0; - crosstermlist = NULL; + crosstermlist = nullptr; } /* --------------------------------------------------------------------- */ @@ -631,10 +631,10 @@ void FixCMAP::read_grid_map(char *cmapfile) char *chunk,*line; int i1, i2, i3, i4, i5, i6, j1, j2, j3, j4, j5, j6, counter; - FILE *fp = NULL; + FILE *fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(cmapfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix cmap file {}: {}", cmapfile, utils::getsyserror())); @@ -654,7 +654,7 @@ void FixCMAP::read_grid_map(char *cmapfile) while (!done) { // only read on rank 0 and broadcast to all other ranks if (comm->me == 0) - done = (fgets(linebuf,MAXLINE,fp) == NULL); + done = (fgets(linebuf,MAXLINE,fp) == nullptr); MPI_Bcast(&done,1,MPI_INT,0,world); if (done) continue; @@ -681,13 +681,13 @@ void FixCMAP::read_grid_map(char *cmapfile) // 6. Glycine before proline map chunk = strtok(line, " \r\n"); - while (chunk != NULL) { + while (chunk != nullptr) { // alanine map if (counter < CMAPDIM*CMAPDIM) { cmapgrid[0][i1][j1] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j1++; if (j1 == CMAPDIM) { j1 = 0; @@ -701,7 +701,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= CMAPDIM*CMAPDIM && counter < 2*CMAPDIM*CMAPDIM) { cmapgrid[1][i2][j2]= atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j2++; if (j2 == CMAPDIM) { j2 = 0; @@ -715,7 +715,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 2*CMAPDIM*CMAPDIM && counter < 3*CMAPDIM*CMAPDIM) { cmapgrid[2][i3][j3] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j3++; if (j3 == CMAPDIM) { j3 = 0; @@ -729,7 +729,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 3*CMAPDIM*CMAPDIM && counter < 4*CMAPDIM*CMAPDIM) { cmapgrid[3][i4][j4] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j4++; if (j4 == CMAPDIM) { j4 = 0; @@ -743,7 +743,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 4*CMAPDIM*CMAPDIM && counter < 5*CMAPDIM*CMAPDIM) { cmapgrid[4][i5][j5] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j5++; if (j5 == CMAPDIM) { j5 = 0; @@ -757,7 +757,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 5*CMAPDIM*CMAPDIM && counter < 6*CMAPDIM*CMAPDIM) { cmapgrid[5][i6][j6] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j6++; if (j6 == CMAPDIM) { j6 = 0; diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 90cf3eee39..75eeb4a45a 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -334,9 +334,9 @@ void ImproperCvff::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->nimpropertypes,MPI_INT,0,world); diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 6327ea8b06..159574a12d 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -275,8 +275,8 @@ void ImproperHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 7b2c4e0b09..7a7c07ab02 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -316,9 +316,9 @@ void ImproperUmbrella::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 6d9c851422..307fe37728 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -50,7 +50,7 @@ PairHbondDreidingLJ::PairHbondDreidingLJ(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nparams = maxparam = 0; - params = NULL; + params = nullptr; nextra = 2; pvector = new double[2]; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index dea6bd6251..9b3805a8b6 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -375,14 +375,14 @@ void PairLJCharmmCoulCharmm::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -436,12 +436,12 @@ void PairLJCharmmCoulCharmm::write_restart_settings(FILE *fp) void PairLJCharmmCoulCharmm::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -523,5 +523,5 @@ void *PairLJCharmmCoulCharmm::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"implicit") == 0) return (void *) &implicit; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 31083312a9..c311c76f55 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -433,14 +433,14 @@ void PairLJCharmmfswCoulCharmmfsh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -470,11 +470,11 @@ void PairLJCharmmfswCoulCharmmfsh::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulCharmmfsh::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -560,5 +560,5 @@ void *PairLJCharmmfswCoulCharmmfsh::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index b5ed255789..d8ab817e7d 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -43,8 +43,8 @@ PairLJCutTIP4PCut::PairLJCutTIP4PCut(LAMMPS *lmp) : Pair(lmp) writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -494,9 +494,9 @@ void PairLJCutTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -618,13 +618,13 @@ void PairLJCutTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -660,17 +660,17 @@ void PairLJCutTIP4PCut::write_restart_settings(FILE *fp) void PairLJCutTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -740,7 +740,7 @@ void *PairLJCutTIP4PCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- memory usage of hneigh diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 8d8f5ec78e..7757e96496 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -39,8 +39,8 @@ PairTIP4PCut::PairTIP4PCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -423,9 +423,9 @@ void PairTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -475,7 +475,7 @@ void PairTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -502,13 +502,13 @@ void PairTIP4PCut::write_restart_settings(FILE *fp) void PairTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 62d940af37..812cec21a3 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -186,7 +186,7 @@ void DumpAtomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 6d5fc3da8e..f598f25998 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -207,7 +207,7 @@ void DumpCFGMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index b623df82d0..065b04801e 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -202,7 +202,7 @@ void DumpCustomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -247,8 +247,8 @@ void DumpCustomMPIIO::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index 139245e4b0..959a454103 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -198,7 +198,7 @@ void DumpXYZMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -239,7 +239,7 @@ void DumpXYZMPIIO::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index 29d6d550e4..650c25cd4d 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -65,7 +65,7 @@ FixMSCG::FixMSCG(LAMMPS *lmp, int narg, char **arg) : nframes = n_frames = block_size = 0; range_flag = 0; name_flag = 0; - f = NULL; + f = nullptr; type_names = new char*[natoms]; for (int i = 0; i < natoms; i++) type_names[i] = new char[24]; diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 8bea52f1cf..9e4c886900 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDamageAtom::ComputeDamageAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), damage(NULL) + Compute(lmp, narg, arg), damage(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute damage/atom command"); diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 65a25cda03..bf8d345f29 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -43,7 +43,7 @@ ComputeDilatationAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dilatation = NULL; + dilatation = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index d90e211506..5d0d554986 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -44,7 +44,7 @@ ComputePlasticityAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - plasticity = NULL; + plasticity = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 2950381197..d741aca856 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -56,15 +56,15 @@ FixPeriNeigh::FixPeriNeigh(LAMMPS *lmp,int narg, char **arg) : // set maxpartner = 1 as placeholder maxpartner = 1; - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; - vinter = NULL; - wvolume = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; + vinter = nullptr; + wvolume = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -228,13 +228,13 @@ void FixPeriNeigh::setup(int /*vflag*/) memory->destroy(r0); memory->destroy(npartner); - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; grow_arrays(atom->nmax); // create partner list and r0 values from neighbor list @@ -301,9 +301,9 @@ void FixPeriNeigh::setup(int /*vflag*/) double **x0 = atom->x0; double half_lc = 0.5*(domain->lattice->xlattice); double vfrac_scale; - PairPeriLPS *pairlps = NULL; - PairPeriVES *pairves = NULL; - PairPeriEPS *paireps = NULL; + PairPeriLPS *pairlps = nullptr; + PairPeriVES *pairves = nullptr; + PairPeriEPS *paireps = nullptr; if (isLPS) pairlps = static_cast(anypair); else if (isVES) diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 0e5760ac8d..c6f3c1ada5 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -47,14 +47,14 @@ PairPeriEPS::PairPeriEPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = -1; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_yieldstress = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_yieldstress = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -219,7 +219,7 @@ void PairPeriEPS::compute(int eflag, int vflag) // ******** temp array to store Plastic extension *********** /// // create on heap to reduce stack use and to allow for faster zeroing - double **deviatorPlasticExtTemp = NULL; + double **deviatorPlasticExtTemp = nullptr; if (nlocal*maxpartner > 0) { memory->create(deviatorPlasticExtTemp,nlocal,maxpartner,"pair:plastext"); memset(&(deviatorPlasticExtTemp[0][0]),0,sizeof(double)*nlocal*maxpartner); @@ -505,7 +505,7 @@ void PairPeriEPS::init_style() if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -559,16 +559,16 @@ void PairPeriEPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index b60f28d9f1..65f43ad669 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -45,13 +45,13 @@ PairPeriLPS::PairPeriLPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -481,15 +481,15 @@ void PairPeriLPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 5d6973a915..f29671a421 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -44,12 +44,12 @@ PairPeriPMB::PairPeriPMB(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; + s0_new = nullptr; - kspring = NULL; - s00 = NULL; - alpha = NULL; - cut = NULL; + kspring = nullptr; + s00 = nullptr; + alpha = nullptr; + cut = nullptr; } /* ---------------------------------------------------------------------- */ @@ -410,14 +410,14 @@ void PairPeriPMB::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&kspring[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&s00[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index 93c980702b..ff131eae53 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -45,15 +45,15 @@ PairPeriVES::PairPeriVES(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_lambdai = NULL; - m_taubi = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_lambdai = nullptr; + m_taubi = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -484,7 +484,7 @@ void PairPeriVES::init_style() if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -539,17 +539,17 @@ void PairPeriVES::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 12dc59c286..6dadb2866e 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -62,12 +62,12 @@ static const char cite_fix_poems[] = ------------------------------------------------------------------------- */ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), natom2body(NULL), - atom2body(NULL), displace(NULL), nrigid(NULL), masstotal(NULL), - xcm(NULL), vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), sum(NULL), all(NULL), jointbody(NULL), - xjoint(NULL), freelist(NULL), poems(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), natom2body(nullptr), + atom2body(nullptr), displace(nullptr), nrigid(nullptr), masstotal(nullptr), + xcm(nullptr), vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), sum(nullptr), all(nullptr), jointbody(nullptr), + xjoint(nullptr), freelist(nullptr), poems(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_poems); @@ -84,9 +84,9 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with atom class - natom2body = NULL; - atom2body = NULL; - displace = NULL; + natom2body = nullptr; + atom2body = nullptr; + displace = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -944,7 +944,7 @@ void FixPOEMS::readfile(char *file) if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix poems file %s",file); error->one(FLERR,str); @@ -952,7 +952,7 @@ void FixPOEMS::readfile(char *file) } nbody = 0; - char *line = NULL; + char *line = nullptr; int maxline = 0; char *ptr; int nlocal = atom->nlocal; @@ -965,10 +965,10 @@ void FixPOEMS::readfile(char *file) MPI_Bcast(line,nlen,MPI_CHAR,0,world); ptr = strtok(line," ,\t\n\0"); - if (ptr == NULL || ptr[0] == '#') continue; - ptr = strtok(NULL," ,\t\n\0"); + if (ptr == nullptr || ptr[0] == '#') continue; + ptr = strtok(nullptr," ,\t\n\0"); - while ((ptr = strtok(NULL," ,\t\n\0"))) { + while ((ptr = strtok(nullptr," ,\t\n\0"))) { id = atoi(ptr); i = atom->map(id); if (i < 0 || i >= nlocal) continue; @@ -995,7 +995,7 @@ int FixPOEMS::readline(FILE *fp, char **pline, int *pmaxline) maxline += DELTA; memory->grow(line,maxline,"fix_poems:line"); } - if (fgets(&line[n],maxline-n,fp) == NULL) { + if (fgets(&line[n],maxline-n,fp) == nullptr) { n = 0; break; } @@ -1030,7 +1030,7 @@ void FixPOEMS::jointbuild() mjoint += natom2body[i]-1; } - tagint **mylist = NULL; + tagint **mylist = nullptr; if (mjoint) memory->create(mylist,mjoint,3,"poems:mylist"); mjoint = 0; @@ -1047,7 +1047,7 @@ void FixPOEMS::jointbuild() // jlist = mylist concatenated across all procs via MPI_Allgatherv MPI_Allreduce(&mjoint,&njoint,1,MPI_INT,MPI_SUM,world); - tagint **jlist = NULL; + tagint **jlist = nullptr; if (njoint) memory->create(jlist,njoint,3,"poems:jlist"); int nprocs; @@ -1069,7 +1069,7 @@ void FixPOEMS::jointbuild() MPI_Allgatherv(mylist[0],3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); else - MPI_Allgatherv(NULL,3*mjoint,MPI_LMP_TAGINT,jlist[0], + MPI_Allgatherv(nullptr,3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); } @@ -1107,9 +1107,9 @@ void FixPOEMS::jointbuild() // each proc sets myjoint if it owns joint atom // MPI_Allreduce gives all procs the xjoint coords - jointbody = NULL; - xjoint = NULL; - double **myjoint = NULL; + jointbody = nullptr; + xjoint = nullptr; + double **myjoint = nullptr; if (njoint) { memory->create(jointbody,njoint,2,"poems:jointbody"); memory->create(xjoint,njoint,3,"poems:xjoint"); @@ -1146,7 +1146,7 @@ void FixPOEMS::jointbuild() for (i = 0; i < nbody; i++) if (mark[i]) nfree++; if (nfree) freelist = new int[nfree]; - else freelist = NULL; + else freelist = nullptr; nfree = 0; for (i = 0; i < nbody; i++) if (mark[i]) freelist[nfree++] = i + 1; diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index 53bde5e804..6aec1d785a 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -37,7 +37,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : python->init(); - py_move = NULL; + py_move = nullptr; PyGILState_STATE gstate = PyGILState_Ensure(); @@ -50,7 +50,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : char * full_cls_name = arg[3]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Fix python/integrate requires fully qualified class name"); } @@ -138,7 +138,7 @@ void FixPythonMove::init() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'init' method'"); } - PyObject * result = PyEval_CallObject(py_init, NULL); + PyObject * result = PyEval_CallObject(py_init, nullptr); PyGILState_Release(gstate); } @@ -174,7 +174,7 @@ void FixPythonMove::final_integrate() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'final_integrate' method'"); } - PyObject * result = PyEval_CallObject(py_final_integrate, NULL); + PyObject * result = PyEval_CallObject(py_final_integrate, nullptr); PyGILState_Release(gstate); } @@ -229,6 +229,6 @@ void FixPythonMove::reset_dt() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'reset_dt' method'"); } - PyObject * result = PyEval_CallObject(py_reset_dt, NULL); + PyObject * result = PyEval_CallObject(py_reset_dt, nullptr); PyGILState_Release(gstate); } diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 074de2f39a..e24daf3116 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -43,8 +43,8 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { cut_global = 0.0; centroidstressflag = 1; - py_potential = NULL; - skip_types = NULL; + py_potential = nullptr; + skip_types = nullptr; python->init(); @@ -54,7 +54,7 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { // if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well const char * potentials_path = getenv("LAMMPS_POTENTIALS"); - if (potentials_path != NULL) { + if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); } } @@ -259,7 +259,7 @@ void PairPython::coeff(int narg, char **arg) char * full_cls_name = arg[2]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Python pair style requires fully qualified class name"); } @@ -297,7 +297,7 @@ void PairPython::coeff(int narg, char **arg) delete [] module_name; delete [] cls_name; - PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, NULL); + PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, nullptr); if (!py_pair_instance) { PyErr_Print(); PyErr_Clear(); diff --git a/src/PYTHON/python_compat.h b/src/PYTHON/python_compat.h index effac81cef..97946349b2 100644 --- a/src/PYTHON/python_compat.h +++ b/src/PYTHON/python_compat.h @@ -21,14 +21,14 @@ #define PY_INT_FROM_LONG(X) PyInt_FromLong(X) #define PY_INT_AS_LONG(X) PyInt_AsLong(X) #define PY_STRING_FROM_STRING(X) PyString_FromString(X) -#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, NULL) +#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, nullptr) #define PY_STRING_AS_STRING(X) PyString_AsString(X) #elif PY_MAJOR_VERSION == 3 #define PY_INT_FROM_LONG(X) PyLong_FromLong(X) #define PY_INT_AS_LONG(X) PyLong_AsLong(X) #define PY_STRING_FROM_STRING(X) PyUnicode_FromString(X) -#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, NULL, NULL) +#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, nullptr, nullptr) #define PY_STRING_AS_STRING(X) PyUnicode_AsUTF8(X) #endif diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index cb35cba85a..5a94d33e98 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -38,15 +38,15 @@ enum{NONE,INT,DOUBLE,STRING,PTR}; PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) { ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; // pfuncs stores interface info for each Python function nfunc = 0; - pfuncs = NULL; + pfuncs = nullptr; // one-time initialization of Python interpreter // pyMain stores pointer to main module @@ -104,7 +104,7 @@ void PythonImpl::command(int narg, char **arg) int ifunc = find(arg[0]); if (ifunc < 0) error->all(FLERR,"Python invoke of undefined function"); - char *str = NULL; + char *str = nullptr; if (noutput) { str = input->variable->pythonstyle(pfuncs[ifunc].ovarname, pfuncs[ifunc].name); @@ -122,7 +122,7 @@ void PythonImpl::command(int narg, char **arg) int err; FILE *fp = fopen(arg[2],"r"); - if (fp == NULL) + if (fp == nullptr) err = execute_string(arg[2]); else err = execute_file(arg[2]); @@ -136,12 +136,12 @@ void PythonImpl::command(int narg, char **arg) // parse optional args, invoke is not allowed in this mode ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; - char *pyfile = NULL; - char *herestr = NULL; + char *pyfile = nullptr; + char *herestr = nullptr; int existflag = 0; int iarg = 1; @@ -206,7 +206,7 @@ void PythonImpl::command(int narg, char **arg) if (pyfile) { FILE *fp = fopen(pyfile,"r"); - if (fp == NULL) { + if (fp == nullptr) { PyGILState_Release(gstate); error->all(FLERR,"Could not open Python file"); } @@ -422,7 +422,7 @@ int PythonImpl::create_entry(char *name) pfuncs[ifunc].svalue = new char*[ninput]; for (int i = 0; i < ninput; i++) { - pfuncs[ifunc].svalue[i] = NULL; + pfuncs[ifunc].svalue[i] = nullptr; char type = format[i]; if (type == 'i') { pfuncs[ifunc].itype[i] = INT; @@ -470,8 +470,8 @@ int PythonImpl::create_entry(char *name) // process output as value or variable - pfuncs[ifunc].ovarname = NULL; - pfuncs[ifunc].longstr = NULL; + pfuncs[ifunc].ovarname = nullptr; + pfuncs[ifunc].longstr = nullptr; if (!noutput) return ifunc; char type = format[ninput]; @@ -512,7 +512,7 @@ int PythonImpl::execute_string(char *cmd) int PythonImpl::execute_file(char *fname) { FILE *fp = fopen(fname,"r"); - if (fp == NULL) return -1; + if (fp == nullptr) return -1; PyGILState_STATE gstate = PyGILState_Ensure(); int err = PyRun_SimpleFile(fp,fname); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 5cadce617f..9f8b6c3442 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -37,11 +37,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), list(NULL), chi(NULL), eta(NULL), - gamma(NULL), zeta(NULL), zcore(NULL), chizj(NULL), shld(NULL), - s(NULL), t(NULL), s_hist(NULL), t_hist(NULL), Hdia_inv(NULL), b_s(NULL), - b_t(NULL), p(NULL), q(NULL), r(NULL), d(NULL), - qf(NULL), q1(NULL), q2(NULL), qv(NULL) + Fix(lmp, narg, arg), list(nullptr), chi(nullptr), eta(nullptr), + gamma(nullptr), zeta(nullptr), zcore(nullptr), chizj(nullptr), shld(nullptr), + s(nullptr), t(nullptr), s_hist(nullptr), t_hist(nullptr), Hdia_inv(nullptr), b_s(nullptr), + b_t(nullptr), p(nullptr), q(nullptr), r(nullptr), d(nullptr), + qf(nullptr), q1(nullptr), q2(nullptr), qv(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); @@ -58,48 +58,48 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : swa = 0.0; swb = cutoff; - shld = NULL; + shld = nullptr; nlocal = n_cap = 0; nall = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 5; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // others cutoff_sq = cutoff*cutoff; - chizj = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; + chizj = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; streitz_flag = 0; reax_flag = 0; - qv = NULL; + qv = nullptr; comm_forward = comm_reverse = 1; // perform initial allocation of atom-based arrays // register with Atom class - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -708,7 +708,7 @@ void FixQEq::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix qeq parameter file %s",file); error->one(FLERR,str); @@ -726,7 +726,7 @@ void FixQEq::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -751,7 +751,7 @@ void FixQEq::read_file(char *file) for (n=0, words[n] = strtok(line," \t\n\r\f"); n < 6; - words[++n] = strtok(NULL," \t\n\r\f")); + words[++n] = strtok(nullptr," \t\n\r\f")); utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); for (n=nlo; n <=nhi; ++n) { diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 6dcc5e9cdc..10cdc5d3ca 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -66,8 +66,8 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix qeq/fire command"); } - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 37951adb1a..306f3f61e3 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -78,12 +78,12 @@ void FixQEqShielded::init() void FixQEqShielded::extract_reax() { Pair *pair = force->pair_match("^reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair reax/c"); } diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 327a9c5b3a..7c7dc159b1 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -88,15 +88,15 @@ void FixQEqSlater::init() void FixQEqSlater::extract_streitz() { Pair *pair = force->pair_match("coul/streitz",1); - if (pair == NULL) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); + if (pair == nullptr) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); zeta = (double *) pair->extract("zeta",tmp); zcore = (double *) pair->extract("zcore",tmp); - if (chi == NULL || eta == NULL || gamma == NULL - || zeta == NULL || zcore == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr + || zeta == nullptr || zcore == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair coul/streitz"); diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 531f488e60..8efaab7c7a 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_event(NULL), fix_event(NULL) + Compute(lmp, narg, arg), id_event(nullptr), fix_event(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute event/displace command"); @@ -47,7 +47,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : // fix event ID will be set later by accelerated dynamics method - id_event = NULL; + id_event = nullptr; } /* ---------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ void ComputeEventDisplace::init() // if set by PRD, then find fix which stores original atom coords // check if it is correct style - if (id_event != NULL) { + if (id_event != nullptr) { int ifix = modify->find_fix(id_event); if (ifix < 0) error->all(FLERR, "Could not find compute event/displace fix ID"); @@ -88,7 +88,7 @@ double ComputeEventDisplace::compute_scalar() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; double event = 0.0; double **xevent = fix_event->array_atom; @@ -150,7 +150,7 @@ int ComputeEventDisplace::all_events() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; int event = 0; double **xevent = fix_event->array_atom; @@ -204,8 +204,8 @@ int ComputeEventDisplace::all_events() void ComputeEventDisplace::reset_extra_compute_fix(const char *id_new) { delete [] id_event; - id_event = NULL; - if (id_new == NULL) return; + id_event = nullptr; + if (id_new == nullptr) return; int n = strlen(id_new) + 1; id_event = new char[n]; diff --git a/src/REPLICA/fix_event.cpp b/src/REPLICA/fix_event.cpp index 41f91332cb..7e6a82bdd3 100644 --- a/src/REPLICA/fix_event.cpp +++ b/src/REPLICA/fix_event.cpp @@ -27,8 +27,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvent::FixEvent(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xevent(NULL), xold(NULL), vold(NULL), - imageold(NULL), xorig(NULL), vorig(NULL), imageorig(NULL) + Fix(lmp, narg, arg), xevent(nullptr), xold(nullptr), vold(nullptr), + imageold(nullptr), xorig(nullptr), vorig(nullptr), imageorig(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix event command"); diff --git a/src/REPLICA/fix_hyper.cpp b/src/REPLICA/fix_hyper.cpp index 472d0bbb44..733578caa1 100644 --- a/src/REPLICA/fix_hyper.cpp +++ b/src/REPLICA/fix_hyper.cpp @@ -35,6 +35,6 @@ void *FixHyper::extract(const char *str, int &dim) if (strcmp(str,"hyperflag") == 0) { return &hyperflag; } - return NULL; + return nullptr; } diff --git a/src/REPLICA/fix_hyper_global.cpp b/src/REPLICA/fix_hyper_global.cpp index f104d14c2f..abc16618c5 100644 --- a/src/REPLICA/fix_hyper_global.cpp +++ b/src/REPLICA/fix_hyper_global.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), xold(NULL), tagold(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), xold(nullptr), tagold(nullptr) { if (atom->map_style == 0) error->all(FLERR,"Fix hyper/global command requires atom map"); @@ -70,12 +70,12 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : maxbond = 0; nblocal = 0; - blist = NULL; + blist = nullptr; maxold = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; me = comm->me; firstflag = 1; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index da444bc451..2eb18a0c8a 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -47,10 +47,10 @@ enum{IGNORE,WARN,ERROR}; /* ---------------------------------------------------------------------- */ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), biascoeff(NULL), numbond(NULL), - maxhalf(NULL), eligible(NULL), maxhalfstrain(NULL), old2now(NULL), - tagold(NULL), xold(NULL), maxstrain(NULL), maxstrain_domain(NULL), - biasflag(NULL), bias(NULL), cpage(NULL), clist(NULL), numcoeff(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), biascoeff(nullptr), numbond(nullptr), + maxhalf(nullptr), eligible(nullptr), maxhalfstrain(nullptr), old2now(nullptr), + tagold(nullptr), xold(nullptr), maxstrain(nullptr), maxstrain_domain(nullptr), + biasflag(nullptr), bias(nullptr), cpage(nullptr), clist(nullptr), numcoeff(nullptr) { // error checks @@ -132,28 +132,28 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : // per-atom data structs maxbond = nblocal = 0; - blist = NULL; - biascoeff = NULL; + blist = nullptr; + biascoeff = nullptr; allbonds = 0; maxatom = 0; - maxstrain = NULL; - maxstrain_domain = NULL; - biasflag = NULL; + maxstrain = nullptr; + maxstrain_domain = nullptr; + biasflag = nullptr; maxlocal = nlocal_old = 0; - numbond = NULL; - maxhalf = NULL; - eligible = NULL; - maxhalfstrain = NULL; + numbond = nullptr; + maxhalf = nullptr; + eligible = nullptr; + maxhalfstrain = nullptr; maxall = nall_old = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; nbias = maxbias = 0; - bias = NULL; + bias = nullptr; // data structs for persisting bias coeffs when bond list is reformed // maxbondperatom = max # of bonds any atom is part of @@ -162,8 +162,8 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : maxcoeff = 0; maxbondperatom = FCCBONDS; - numcoeff = NULL; - clist = NULL; + numcoeff = nullptr; + clist = nullptr; cpage = new MyPage; cpage->init(maxbondperatom,1024*maxbondperatom,1); @@ -983,7 +983,7 @@ void FixHyperLocal::build_bond_list(int natom) while (1) { if (firstflag) break; for (i = 0; i < nall; i++) numcoeff[i] = 0; - for (i = 0; i < nall; i++) clist[i] = NULL; + for (i = 0; i < nall; i++) clist[i] = nullptr; cpage->reset(); for (m = 0; m < nblocal; m++) { diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index b8fd0f6442..a739ec754c 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -45,12 +45,12 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), xnext(NULL), - fnext(NULL), springF(NULL), tangent(NULL), xsend(NULL), xrecv(NULL), - fsend(NULL), frecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), - tagsendall(NULL), tagrecvall(NULL), counts(NULL), - displacements(NULL) + id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), xnext(nullptr), + fnext(nullptr), springF(nullptr), tangent(nullptr), xsend(nullptr), xrecv(nullptr), + fsend(nullptr), frecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), + tagsendall(nullptr), tagrecvall(nullptr), counts(nullptr), + displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb command"); @@ -237,7 +237,7 @@ void FixNEB::init() if (atom->nmax > maxlocal) reallocate(); - if ((cmode == MULTI_PROC) && (counts == NULL)) { + if ((cmode == MULTI_PROC) && (counts == nullptr)) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -785,9 +785,9 @@ void FixNEB::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index 6c4cba4ab8..b015839f64 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -38,7 +38,7 @@ enum{NOHYPER,GLOBAL,LOCAL}; /* ---------------------------------------------------------------------- */ -Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(NULL) {} +Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(nullptr) {} /* ---------------------------------------------------------------------- perform hyperdynamics simulation @@ -91,7 +91,7 @@ void Hyper::command(int narg, char **arg) fix_hyper = (FixHyper *) modify->fix[ifix]; int dim; int *hyperflag = (int *) fix_hyper->extract("hyperflag",dim); - if (hyperflag == NULL || *hyperflag == 0) + if (hyperflag == nullptr || *hyperflag == 0) error->all(FLERR,"Hyper fix is not a valid hyperdynamics fix"); if (*hyperflag == 1) hyperstyle = GLOBAL; if (*hyperflag == 2) hyperstyle = LOCAL; @@ -353,7 +353,7 @@ void Hyper::command(int narg, char **arg) delete finish; modify->delete_fix("hyper_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -449,7 +449,7 @@ void Hyper::options(int narg, char **arg) maxeval = 50; dumpflag = 0; ndump = 0; - dumplist = NULL; + dumplist = nullptr; rebond = 0; int iarg = 0; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 2d1dd6eea7..31ce61f4c2 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -391,7 +391,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -407,7 +407,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -460,7 +460,7 @@ void NEB::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust atom coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -561,7 +561,7 @@ void NEB::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index cdb1eb9b02..6417141151 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -117,9 +117,9 @@ void PRD::command(int narg, char **arg) natoms = atom->natoms; - tagall = NULL; - xall = NULL; - imageall = NULL; + tagall = nullptr; + xall = nullptr; + imageall = nullptr; if (cmode != SINGLE_PROC_DIRECT) { memory->create(tagall,natoms,"prd:tagall"); @@ -127,8 +127,8 @@ void PRD::command(int narg, char **arg) memory->create(imageall,natoms,"prd:imageall"); } - counts = NULL; - displacements = NULL; + counts = nullptr; + displacements = nullptr; if (cmode == MULTI_PROC) { memory->create(counts,nprocs,"prd:counts"); @@ -465,7 +465,7 @@ void PRD::command(int narg, char **arg) modify->delete_compute("prd_temp"); modify->delete_fix("prd_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -908,16 +908,16 @@ void PRD::options(int narg, char **arg) delete [] loop_setting; delete [] dist_setting; - if (strcmp(arg[iarg+1],"all") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = NULL; + if (strcmp(arg[iarg+1],"all") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = nullptr; else error->all(FLERR,"Illegal prd command"); int n = strlen(arg[iarg+1]) + 1; loop_setting = new char[n]; strcpy(loop_setting,arg[iarg+1]); - if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = NULL; - else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = NULL; + if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = nullptr; + else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = nullptr; else error->all(FLERR,"Illegal prd command"); n = strlen(arg[iarg+2]) + 1; dist_setting = new char[n]; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index db74b63c35..3deda0c506 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -50,7 +50,7 @@ TAD::TAD(LAMMPS *lmp) : Pointers(lmp) {} TAD::~TAD() { memory->sfree(fix_event_list); - if (neb_logfilename != NULL) delete [] neb_logfilename; + if (neb_logfilename != nullptr) delete [] neb_logfilename; delete [] min_style; delete [] min_style_neb; } @@ -62,7 +62,7 @@ TAD::~TAD() void TAD::command(int narg, char **arg) { - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; nmin_event_list = 10; @@ -226,8 +226,8 @@ void TAD::command(int narg, char **arg) ulogfile_lammps = universe->ulogfile; uscreen_lammps = universe->uscreen; - ulogfile_neb = NULL; - uscreen_neb = NULL; + ulogfile_neb = nullptr; + uscreen_neb = nullptr; if (me_universe == 0 && neb_logfilename) ulogfile_neb = fopen(neb_logfilename,"w"); @@ -421,7 +421,7 @@ void TAD::command(int narg, char **arg) modify->delete_fix("tad_revert"); delete_event_list(); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -586,7 +586,7 @@ void TAD::options(int narg, char **arg) min_style_neb = new char[n]; strcpy(min_style_neb,"quickmin"); dt_neb = update->dt; - neb_logfilename = NULL; + neb_logfilename = nullptr; int iarg = 0; while (iarg < narg) { @@ -630,7 +630,7 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb_log") == 0) { delete [] neb_logfilename; if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); - if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = NULL; + if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = nullptr; else { int n = strlen(arg[iarg+1]) + 1; neb_logfilename = new char[n]; @@ -885,7 +885,7 @@ void TAD::delete_event_list() { modify->delete_fix(str); } memory->sfree(fix_event_list); - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 0cce389bf0..0d15be2aa6 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -147,7 +147,7 @@ void Temper::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index a5ed1a671d..f6a8f59944 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : - Verlet(lmp, narg, arg), qsize(NULL), qdisp(NULL), xsize(NULL), xdisp(NULL), f_kspace(NULL) + Verlet(lmp, narg, arg), qsize(nullptr), qdisp(nullptr), xsize(nullptr), xdisp(nullptr), f_kspace(nullptr) { // error checks on partitions @@ -194,7 +194,7 @@ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : // allocate dummy version for Kspace partition maxatom = 0; - f_kspace = NULL; + f_kspace = nullptr; if (!master) memory->create(f_kspace,1,1,"verlet/split:f_kspace"); } @@ -289,7 +289,7 @@ void VerletSplit::run(int n) Fix *fix_omp; int ifix = modify->find_fix("package_omp"); - if (ifix < 0) fix_omp = NULL; + if (ifix < 0) fix_omp = nullptr; else fix_omp = modify->fix[ifix]; // flags for timestepping iterations diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index e15c0deb82..43e636963f 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute erotate/rigid command"); diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index 031919b7a9..6ce4440d05 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute ke/rigid command"); diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index 57f69a64e2..c100db82e8 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -33,7 +33,7 @@ enum{ID,MOL,MASS,X,Y,Z,XU,YU,ZU,VX,VY,VZ,FX,FY,FZ,IX,IY,IZ, ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rstyle(NULL), idrigid(NULL), fixrigid(NULL), vlocal(NULL), alocal(NULL) + rstyle(nullptr), idrigid(nullptr), fixrigid(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute rigid/local command"); @@ -89,8 +89,8 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; ncount = nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,8 +115,8 @@ void ComputeRigidLocal::init() fixrigid = (FixRigidSmall *) modify->fix[ifix]; int flag = 0; - if (strstr(fixrigid->style,"rigid/") == NULL) flag = 1; - if (strstr(fixrigid->style,"/small") == NULL) flag = 1; + if (strstr(fixrigid->style,"rigid/") == nullptr) flag = 1; + if (strstr(fixrigid->style,"/small") == nullptr) flag = 1; if (flag) error->all(FLERR,"Compute rigid/local does not use fix rigid/small fix"); diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 03b79cc750..6b283b2f85 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -45,8 +45,8 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), x(NULL), f(NULL), v(NULL), - mass(NULL), rmass(NULL), type(NULL), scalingmask(NULL) + idregion(nullptr), x(nullptr), f(nullptr), v(nullptr), + mass(nullptr), rmass(nullptr), type(nullptr), scalingmask(nullptr) { MPI_Comm_rank(world, &me); @@ -127,7 +127,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), error->all(FLERR, "You can only use the keyword 'com' together with the keyword 'constrain' "); scale = 1.0; - scalingmask = NULL; + scalingmask = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -177,7 +177,7 @@ void FixEHEX::init() if (group->count(igroup) == 0) error->all(FLERR,"Fix ehex group has no atoms"); - fshake = NULL; + fshake = nullptr; if (constraints) { // check if constraining algorithm is used (FixRattle inherits from FixShake) @@ -335,7 +335,7 @@ void FixEHEX::update_scalingmask() { // prematch region - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -354,7 +354,7 @@ void FixEHEX::update_scalingmask() { m = fshake->list[i]; // check if the centre of mass of the cluster is inside the region - // if region == NULL, just check the group information of all sites + // if region == nullptr, just check the group information of all sites if (fshake->shake_flag[m] == 1) nsites = 3; else if (fshake->shake_flag[m] == 2) nsites = 2; diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index 436b2191ff..07787bcbfe 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -59,7 +59,7 @@ FixRattle::FixRattle(LAMMPS *lmp, int narg, char **arg) : // allocate memory for unconstrained velocity update - vp = NULL; + vp = nullptr; grow_arrays(atom->nmax); // default communication mode diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index f74cce8233..c40c3b13d8 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -46,16 +46,16 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL), - body(NULL), displace(NULL), masstotal(NULL), xcm(NULL), - vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), quat(NULL), imagebody(NULL), fflag(NULL), - tflag(NULL), langextra(NULL), sum(NULL), all(NULL), - remapflag(NULL), xcmimage(NULL), eflags(NULL), orient(NULL), - dorient(NULL), id_dilate(NULL), id_gravity(NULL), random(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), nrigid(nullptr), mol2body(nullptr), body2mol(nullptr), + body(nullptr), displace(nullptr), masstotal(nullptr), xcm(nullptr), + vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), quat(nullptr), imagebody(nullptr), fflag(nullptr), + tflag(nullptr), langextra(nullptr), sum(nullptr), all(nullptr), + remapflag(nullptr), xcmimage(nullptr), eflags(nullptr), orient(nullptr), + dorient(nullptr), id_dilate(nullptr), id_gravity(nullptr), random(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr) { int i,ibody; @@ -76,12 +76,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = 0; - body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -91,8 +91,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix rigid command"); int iarg; - mol2body = NULL; - body2mol = NULL; + mol2body = nullptr; + body2mol = nullptr; // single rigid body // nbody = 1 @@ -322,9 +322,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : t_order = 3; p_chain = 10; - inpfile = NULL; - id_gravity = NULL; - id_dilate = NULL; + inpfile = nullptr; + id_gravity = nullptr; + id_dilate = nullptr; pcouple = NONE; pstyle = ANISO; @@ -567,7 +567,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed if (langflag) random = new RanMars(lmp,seed + me); - else random = NULL; + else random = nullptr; // initialize vector output quantities in case accessed before run @@ -1930,7 +1930,7 @@ void FixRigid::setup_bodies_static() // overwrite Cartesian inertia tensor with file values - if (inpfile) readfile(1,NULL,all,NULL,NULL,NULL,inbody); + if (inpfile) readfile(1,nullptr,all,nullptr,nullptr,nullptr,inbody); // diagonalize inertia tensor for each body via Jacobi rotations // inertia = 3 eigenvalues = principal moments of inertia @@ -2281,12 +2281,12 @@ void FixRigid::readfile(int which, double *vec, if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of fix rigid file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -2327,7 +2327,7 @@ void FixRigid::readfile(int which, double *vec, values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = atoi(values[0]); if (rstyle == MOLECULE) { @@ -2390,7 +2390,7 @@ void FixRigid::write_restart_file(const char *file) auto outfile = std::string(file) + ".rigid"; FILE *fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -2711,7 +2711,7 @@ void *FixRigid::extract(const char *str, int &dim) return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 1df7f34532..0aa5f99765 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -42,12 +42,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : - FixRigid(lmp, narg, arg), conjqm(NULL), w(NULL), - wdti1(NULL), wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), - eta_t(NULL), eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), - f_eta_t(NULL), f_eta_r(NULL), q_b(NULL), eta_b(NULL), - eta_dot_b(NULL), f_eta_b(NULL), rfix(NULL), id_temp(NULL), - id_press(NULL), temperature(NULL), pressure(NULL) + FixRigid(lmp, narg, arg), conjqm(nullptr), w(nullptr), + wdti1(nullptr), wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), + eta_t(nullptr), eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), + f_eta_t(nullptr), f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), + eta_dot_b(nullptr), f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), + id_press(nullptr), temperature(nullptr), pressure(nullptr) { // error checks: could be moved up to FixRigid @@ -145,7 +145,7 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -153,8 +153,8 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -304,7 +304,7 @@ void FixRigidNH::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index d1204e2bbc..b599868ecd 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -44,12 +44,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : - FixRigidSmall(lmp, narg, arg), w(NULL), wdti1(NULL), - wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), eta_t(NULL), - eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), f_eta_t(NULL), - f_eta_r(NULL), q_b(NULL), eta_b(NULL), eta_dot_b(NULL), - f_eta_b(NULL), rfix(NULL), id_temp(NULL), id_press(NULL), - temperature(NULL), pressure(NULL) + FixRigidSmall(lmp, narg, arg), w(nullptr), wdti1(nullptr), + wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), eta_t(nullptr), + eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), f_eta_t(nullptr), + f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), eta_dot_b(nullptr), + f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), id_press(nullptr), + temperature(nullptr), pressure(nullptr) { // error checks @@ -159,7 +159,7 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -167,8 +167,8 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -301,7 +301,7 @@ void FixRigidNHSmall::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 85cadc826e..e7f67ab2b4 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -54,12 +54,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL), - xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL), - itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL), - id_dilate(NULL), id_gravity(NULL), onemols(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), body(nullptr), bodyown(nullptr), bodytag(nullptr), atom2body(nullptr), + xcmimage(nullptr), displace(nullptr), eflags(nullptr), orient(nullptr), dorient(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr), counts(nullptr), + itensor(nullptr), mass_body(nullptr), langextra(nullptr), random(nullptr), + id_dilate(nullptr), id_gravity(nullptr), onemols(nullptr) { int i; @@ -82,21 +82,21 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = customflag = 0; - bodyown = NULL; - bodytag = NULL; - atom2body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + bodyown = nullptr; + bodytag = nullptr; + atom2body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); // parse args for rigid body specification int *mask = atom->mask; - tagint *bodyID = NULL; + tagint *bodyID = nullptr; int nlocal = atom->nlocal; if (narg < 4) error->all(FLERR,"Illegal fix rigid/small command"); @@ -178,14 +178,14 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : int seed; langflag = 0; - inpfile = NULL; - onemols = NULL; + inpfile = nullptr; + onemols = nullptr; reinitflag = 1; tstat_flag = 0; pstat_flag = 0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; t_chain = 10; t_iter = 1; t_order = 3; @@ -477,13 +477,13 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed maxlang = 0; - langextra = NULL; - random = NULL; + langextra = nullptr; + random = nullptr; if (langflag) random = new RanMars(lmp,seed + comm->me); // mass vector for granular pair styles - mass_body = NULL; + mass_body = nullptr; nmax_mass = 0; // wait to setup bodies until comm stencils are defined @@ -1965,7 +1965,7 @@ void FixRigidSmall::setup_bodies_static() if (inpfile) { memory->create(inbody,nlocal_body,"rigid/small:inbody"); for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0; - readfile(0,NULL,inbody); + readfile(0,nullptr,inbody); } // remap the xcm of each body back into simulation box @@ -2445,12 +2445,12 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid/small file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid/small file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; @@ -2490,7 +2490,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = ATOTAGINT(values[0]); if (id <= 0 || id > maxmol) @@ -2559,7 +2559,7 @@ void FixRigidSmall::write_restart_file(const char *file) if (me == 0) { auto outfile = std::string(file) + ".rigid"; fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -3432,7 +3432,7 @@ void *FixRigidSmall::extract(const char *str, int &dim) return mass_body; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index ee88f57341..c4b0c68f3e 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -47,16 +47,16 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), bond_flag(NULL), angle_flag(NULL), - type_flag(NULL), mass_list(NULL), bond_distance(NULL), angle_distance(NULL), - loop_respa(NULL), step_respa(NULL), x(NULL), v(NULL), f(NULL), ftmp(NULL), - vtmp(NULL), mass(NULL), rmass(NULL), type(NULL), shake_flag(NULL), - shake_atom(NULL), shake_type(NULL), xshake(NULL), nshake(NULL), - list(NULL), b_count(NULL), b_count_all(NULL), b_ave(NULL), b_max(NULL), - b_min(NULL), b_ave_all(NULL), b_max_all(NULL), b_min_all(NULL), - a_count(NULL), a_count_all(NULL), a_ave(NULL), a_max(NULL), a_min(NULL), - a_ave_all(NULL), a_max_all(NULL), a_min_all(NULL), atommols(NULL), - onemols(NULL) + Fix(lmp, narg, arg), bond_flag(nullptr), angle_flag(nullptr), + type_flag(nullptr), mass_list(nullptr), bond_distance(nullptr), angle_distance(nullptr), + loop_respa(nullptr), step_respa(nullptr), x(nullptr), v(nullptr), f(nullptr), ftmp(nullptr), + vtmp(nullptr), mass(nullptr), rmass(nullptr), type(nullptr), shake_flag(nullptr), + shake_atom(nullptr), shake_type(nullptr), xshake(nullptr), nshake(nullptr), + list(nullptr), b_count(nullptr), b_count_all(nullptr), b_ave(nullptr), b_max(nullptr), + b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), + a_count(nullptr), a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), + a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), + onemols(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -76,13 +76,13 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; - xshake = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; + xshake = nullptr; - ftmp = NULL; - vtmp = NULL; + ftmp = nullptr; + vtmp = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -161,7 +161,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // parse optional args - onemols = NULL; + onemols = nullptr; int iarg = next; while (iarg < narg) { @@ -233,7 +233,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // initialize list of SHAKE clusters to constrain maxlist = 0; - list = NULL; + list = nullptr; } /* ---------------------------------------------------------------------- */ @@ -367,7 +367,7 @@ void FixShake::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for SHAKE"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -378,7 +378,7 @@ void FixShake::init() for (i = 1; i <= atom->nangletypes; i++) { if (angle_flag[i] == 0) continue; - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle potential must be defined for SHAKE"); // scan all atoms for a SHAKE angle cluster @@ -2976,7 +2976,7 @@ void *FixShake::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"onemol") == 0) return onemols; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 509e45202c..3061962105 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -35,8 +35,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomx(NULL), randomt(NULL), basistype(NULL), - spatialid(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomx(nullptr), randomt(nullptr), basistype(nullptr), + spatialid(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; @@ -48,7 +48,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : scaleflag = 1; spatflag=0; - spatialid = NULL; + spatialid = nullptr; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; tempflag = 0; @@ -58,8 +58,8 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : rany = 0.0; ranz = 0.0; - randomx = NULL; - randomt = NULL; + randomx = nullptr; + randomt = nullptr; if (domain->lattice->nbasis == 0) error->all(FLERR,"Fix append/atoms requires a lattice be defined"); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 3930133221..1b2e73726b 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -41,9 +41,9 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), old_velocity(NULL), rfix(NULL), - id_temp(NULL), id_press(NULL), id_pe(NULL), temperature(NULL), - pressure(NULL), pe(NULL) + Fix(lmp, narg, arg), old_velocity(nullptr), rfix(nullptr), + id_temp(nullptr), id_press(nullptr), id_pe(nullptr), temperature(nullptr), + pressure(nullptr), pe(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix msst command"); @@ -206,10 +206,10 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : omega[0] = omega[1] = omega[2] = 0.0; nrigid = 0; - rfix = NULL; + rfix = nullptr; maxold = -1; - old_velocity = NULL; + old_velocity = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,7 +246,7 @@ int FixMSST::setmask() void FixMSST::init() { - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); // set compute ptrs @@ -287,7 +287,7 @@ void FixMSST::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^rigid") || @@ -306,7 +306,7 @@ void FixMSST::init() for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^external$")) fix_external = (FixExternal *) modify->fix[i]; - if (fix_external == NULL) + if (fix_external == nullptr) error->all(FLERR,"Fix msst dftb cannot be used w/out fix external"); } } diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 1179bb6b35..20fa909af2 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -30,7 +30,7 @@ enum{ISO,ANISO,TRICLINIC}; // same as fix_nh.cpp /* ---------------------------------------------------------------------- */ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), pe(NULL), id_pe(NULL) + FixNH(lmp, narg, arg), pe(nullptr), id_pe(nullptr) { // Prevent masses from being updated every timestep diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index a796c1a4b4..b375370226 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -31,15 +31,15 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomt(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomt(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; if (narg < 4) error->all(FLERR,"Illegal fix wall/piston command"); - randomt = NULL; - gfactor1 = gfactor2 = NULL; + randomt = nullptr; + gfactor1 = gfactor2 = nullptr; tempflag = 0; scaleflag = 1; roughflag = 0; diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index 37b82b86f0..66d6abfb78 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), sna(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), sna(nullptr), + radelem(nullptr), wjelem(nullptr) { double rmin0, rfac0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -145,7 +145,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - sna = NULL; + sna = nullptr; } /* ---------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ ComputeSNAAtom::~ComputeSNAAtom() void ComputeSNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute sna/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index bb546708b8..e08679a374 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snad(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snad(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -147,7 +147,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snad = NULL; + snad = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeSNADAtom::~ComputeSNADAtom() void ComputeSNADAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snad/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snap.cpp b/src/SNAP/compute_snap.cpp index ca989a75b4..5537d2c933 100644 --- a/src/SNAP/compute_snap.cpp +++ b/src/SNAP/compute_snap.cpp @@ -32,9 +32,9 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snap(NULL), - snapall(NULL), snap_peratom(NULL), radelem(NULL), wjelem(NULL), - snaptr(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snap(nullptr), + snapall(nullptr), snap_peratom(nullptr), radelem(nullptr), wjelem(nullptr), + snaptr(nullptr) { array_flag = 1; @@ -42,8 +42,8 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -180,7 +180,7 @@ ComputeSnap::~ComputeSnap() void ComputeSnap::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snap requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index dd562cac5c..cace5e532f 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -29,13 +29,13 @@ using namespace LAMMPS_NS; ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snav(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snav(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -140,7 +140,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snav = NULL; + snav = nullptr; } @@ -160,7 +160,7 @@ ComputeSNAVAtom::~ComputeSNAVAtom() void ComputeSNAVAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snav/atom requires a pair style be defined"); // TODO: Not sure what to do with this error check since cutoff radius is not // a single number diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index cb1a71aa45..e3b8fdfa98 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -42,15 +42,15 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - coeffelem = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + coeffelem = nullptr; beta_max = 0; - beta = NULL; - bispectrum = NULL; - snaptr = NULL; + beta = nullptr; + bispectrum = nullptr; + snaptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -516,7 +516,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) { + if (fpcoeff == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); error->one(FLERR,str); @@ -531,7 +531,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -556,7 +556,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); ncoeffall = atoi(words[1]); @@ -574,7 +574,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -592,9 +592,9 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); char* elemtmp = words[0]; int n = strlen(elemtmp) + 1; @@ -615,7 +615,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -663,7 +663,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) { + if (fpparam == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); error->one(FLERR,str); @@ -674,7 +674,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -697,7 +697,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); diff --git a/src/SNAP/sna.cpp b/src/SNAP/sna.cpp index e003ec7ca8..ae250c6f76 100644 --- a/src/SNAP/sna.cpp +++ b/src/SNAP/sna.cpp @@ -134,16 +134,16 @@ SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in, compute_ncoeff(); - rij = NULL; - inside = NULL; - wj = NULL; - rcutij = NULL; - element = NULL; + rij = nullptr; + inside = nullptr; + wj = nullptr; + rcutij = nullptr; + element = nullptr; nmax = 0; - idxz = NULL; - idxb = NULL; - ulist_r_ij = NULL; - ulist_i_ij = NULL; + idxz = nullptr; + idxb = nullptr; + ulist_r_ij = nullptr; + ulist_i_ij = nullptr; build_indexlist(); create_twojmax_arrays(); @@ -1332,7 +1332,7 @@ void SNA::create_twojmax_arrays() if (bzero_flag) memory->create(bzero, twojmax+1,"sna:bzero"); else - bzero = NULL; + bzero = nullptr; } diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 281100740a..32f9e73518 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -41,7 +41,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ComputeSpin::ComputeSpin(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), pair(NULL), spin_pairs(NULL) + Compute(lmp, narg, arg), pair(nullptr), spin_pairs(nullptr) { if ((narg != 3) && (narg != 4)) error->all(FLERR,"Illegal compute compute/spin command"); diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 82bf83ac10..2b3aa363f6 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_temp(NULL), random(NULL) + Fix(lmp, narg, arg), id_temp(nullptr), random(nullptr) { if (narg != 6) error->all(FLERR,"Illegal langevin/spin command"); diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp index 0b2e86e465..b2982e7bc0 100644 --- a/src/SPIN/fix_neb_spin.cpp +++ b/src/SPIN/fix_neb_spin.cpp @@ -46,13 +46,13 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; /* ---------------------------------------------------------------------- */ FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), - xnext(NULL), fnext(NULL), spprev(NULL), spnext(NULL), fmnext(NULL), springF(NULL), - tangent(NULL), xsend(NULL), xrecv(NULL), fsend(NULL), frecv(NULL), spsend(NULL), - sprecv(NULL), fmsend(NULL), fmrecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), spsendall(NULL), - sprecvall(NULL), fmsendall(NULL), fmrecvall(NULL), tagsendall(NULL), tagrecvall(NULL), - counts(NULL), displacements(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), + xnext(nullptr), fnext(nullptr), spprev(nullptr), spnext(nullptr), fmnext(nullptr), springF(nullptr), + tangent(nullptr), xsend(nullptr), xrecv(nullptr), fsend(nullptr), frecv(nullptr), spsend(nullptr), + sprecv(nullptr), fmsend(nullptr), fmrecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), spsendall(nullptr), + sprecvall(nullptr), fmsendall(nullptr), fmrecvall(nullptr), tagsendall(nullptr), tagrecvall(nullptr), + counts(nullptr), displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb_spin command"); @@ -229,7 +229,7 @@ void FixNEBSpin::init() if (atom->nmax > maxlocal) reallocate(); - if (MULTI_PROC && counts == NULL) { + if (MULTI_PROC && counts == nullptr) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -861,9 +861,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } if (spsend) { @@ -872,9 +872,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fmsend[0],3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, spsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 462a359d99..d74e82e50e 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -60,9 +60,9 @@ enum{NONE}; FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), spin_pairs(NULL), - rsec(NULL), stack_head(NULL), stack_foot(NULL), - backward_stacks(NULL), forward_stacks(NULL) + pair(nullptr), spin_pairs(nullptr), + rsec(nullptr), stack_head(nullptr), stack_foot(nullptr), + backward_stacks(nullptr), forward_stacks(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_nve_spin); diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index cbb367e438..f4dfddd3ca 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -44,7 +44,7 @@ enum{CONSTANT,EQUAL}; /* ---------------------------------------------------------------------- */ -FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(NULL) +FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(nullptr) { if (narg < 7) error->all(FLERR,"Illegal precession/spin command"); @@ -59,7 +59,7 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lm respa_level_support = 1; ilevel_respa = 0; - magstr = NULL; + magstr = nullptr; magfieldstyle = CONSTANT; H_field = 0.0; diff --git a/src/SPIN/fix_setforce_spin.cpp b/src/SPIN/fix_setforce_spin.cpp index ec738b7522..1f38ee43ec 100644 --- a/src/SPIN/fix_setforce_spin.cpp +++ b/src/SPIN/fix_setforce_spin.cpp @@ -52,7 +52,7 @@ void FixSetForceSpin::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -124,7 +124,7 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -195,7 +195,7 @@ void FixSetForceSpin::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index 4b8b745419..817c149390 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_cg[] = /* ---------------------------------------------------------------------- */ MinSpinCG::MinSpinCG(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_cg); nlocal_max = 0; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index 40029b7e71..edabcf6bbf 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_lbfgs[] = /* ---------------------------------------------------------------------- */ MinSpinLBFGS::MinSpinLBFGS(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), rho(NULL), ds(NULL), dy(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), rho(nullptr), ds(nullptr), dy(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_lbfgs); nlocal_max = 0; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index a89ca403ce..322249e02a 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -384,7 +384,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -398,7 +398,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -452,7 +452,7 @@ void NEBSpin::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust spin coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -705,7 +705,7 @@ void NEBSpin::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index b0965d1271..53dd6530bf 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -42,7 +42,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(NULL) +PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(nullptr) { hbar = force->hplanck/MY_2PI; single_enable = 0; diff --git a/src/SPIN/pair_spin.h b/src/SPIN/pair_spin.h index 8bbb27ed06..9db2bd4177 100644 --- a/src/SPIN/pair_spin.h +++ b/src/SPIN/pair_spin.h @@ -27,7 +27,7 @@ friend class FixNVESpin; virtual void coeff(int, char **) {} virtual void init_style(); virtual double init_one(int, int) {return 0.0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void compute(int, int) {} virtual void compute_single_pair(int, double *) {} diff --git a/src/SPIN/pair_spin_dipole_cut.cpp b/src/SPIN/pair_spin_dipole_cut.cpp index b27c9736b2..7444be347a 100644 --- a/src/SPIN/pair_spin_dipole_cut.cpp +++ b/src/SPIN/pair_spin_dipole_cut.cpp @@ -154,7 +154,7 @@ void *PairSpinDipoleCut::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -448,11 +448,11 @@ void PairSpinDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -477,8 +477,8 @@ void PairSpinDipoleCut::write_restart_settings(FILE *fp) void PairSpinDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dipole_long.cpp b/src/SPIN/pair_spin_dipole_long.cpp index d4b1b8e43e..28a70a047d 100644 --- a/src/SPIN/pair_spin_dipole_long.cpp +++ b/src/SPIN/pair_spin_dipole_long.cpp @@ -133,7 +133,7 @@ void PairSpinDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -174,7 +174,7 @@ void *PairSpinDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -527,11 +527,11 @@ void PairSpinDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -556,8 +556,8 @@ void PairSpinDipoleLong::write_restart_settings(FILE *fp) void PairSpinDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index e27f9fad7d..e2ddd708df 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -156,7 +156,7 @@ void *PairSpinDmi::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_dmi_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -477,18 +477,18 @@ void PairSpinDmi::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&DM[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_dmx[i][j],1,MPI_DOUBLE,0,world); @@ -522,9 +522,9 @@ void PairSpinDmi::write_restart_settings(FILE *fp) void PairSpinDmi::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_dmi_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 27da47dd0f..ba9bddb7c8 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -141,7 +141,7 @@ void *PairSpinExchange::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_exchange_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -467,15 +467,15 @@ void PairSpinExchange::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&J1_mag[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&J1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -506,9 +506,9 @@ void PairSpinExchange::write_restart_settings(FILE *fp) void PairSpinExchange::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_exchange_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 2242cf985d..849590bad2 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -149,7 +149,7 @@ void *PairSpinMagelec::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_magelec_global; - return NULL; + return nullptr; } @@ -465,15 +465,15 @@ void PairSpinMagelec::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&ME[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mex[i][j],1,MPI_DOUBLE,0,world); @@ -503,9 +503,9 @@ void PairSpinMagelec::write_restart_settings(FILE *fp) void PairSpinMagelec::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_magelec_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 33ea904c0c..1e50ee48a6 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -156,7 +156,7 @@ void *PairSpinNeel::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_neel_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -681,19 +681,19 @@ void PairSpinNeel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&g1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&g1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -727,9 +727,9 @@ void PairSpinNeel::write_restart_settings(FILE *fp) void PairSpinNeel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_neel_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 688522c1bd..50a27b5fae 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -77,12 +77,12 @@ static const char cite_fix_srd[] = /* ---------------------------------------------------------------------- */ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - wallfix(NULL), wallwhich(NULL), xwall(NULL), xwallhold(NULL), - vwall(NULL), fwall(NULL), avec_ellipsoid(NULL), avec_line(NULL), - avec_tri(NULL), random(NULL), randomshift(NULL), flocal(NULL), - tlocal(NULL), biglist(NULL), binhead(NULL), binnext(NULL), sbuf1(NULL), - sbuf2(NULL), rbuf1(NULL), rbuf2(NULL), nbinbig(NULL), binbig(NULL), - binsrd(NULL), stencil(NULL) + wallfix(nullptr), wallwhich(nullptr), xwall(nullptr), xwallhold(nullptr), + vwall(nullptr), fwall(nullptr), avec_ellipsoid(nullptr), avec_line(nullptr), + avec_tri(nullptr), random(nullptr), randomshift(nullptr), flocal(nullptr), + tlocal(nullptr), biglist(nullptr), binhead(nullptr), binnext(nullptr), sbuf1(nullptr), + sbuf2(nullptr), rbuf1(nullptr), rbuf2(nullptr), nbinbig(nullptr), binbig(nullptr), + binsrd(nullptr), stencil(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_srd); @@ -232,7 +232,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (shiftuser == SHIFT_YES || shiftuser == SHIFT_POSSIBLE) randomshift = new RanPark(lmp,shiftseed); - else randomshift = NULL; + else randomshift = nullptr; // initialize data structs and flags @@ -240,31 +240,31 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), else biggroupbit = 0; nmax = 0; - binhead = NULL; + binhead = nullptr; maxbin1 = 0; - binnext = NULL; + binnext = nullptr; maxbuf = 0; - sbuf1 = sbuf2 = rbuf1 = rbuf2 = NULL; + sbuf1 = sbuf2 = rbuf1 = rbuf2 = nullptr; shifts[0].maxvbin = shifts[1].maxvbin = 0; - shifts[0].vbin = shifts[1].vbin = NULL; + shifts[0].vbin = shifts[1].vbin = nullptr; shifts[0].maxbinsq = shifts[1].maxbinsq = 0; for (int ishift = 0; ishift < 2; ishift++) for (int iswap = 0; iswap < 6; iswap++) shifts[ishift].bcomm[iswap].sendlist = - shifts[ishift].bcomm[iswap].recvlist = NULL; + shifts[ishift].bcomm[iswap].recvlist = nullptr; maxbin2 = 0; - nbinbig = NULL; - binbig = NULL; - binsrd = NULL; + nbinbig = nullptr; + binbig = nullptr; + binsrd = nullptr; nstencil = maxstencil = 0; - stencil = NULL; + stencil = nullptr; maxbig = 0; - biglist = NULL; + biglist = nullptr; stats_flag = 1; for (int i = 0; i < size_vector; i++) stats_all[i] = 0.0; @@ -1367,7 +1367,7 @@ void FixSRD::collisions_single() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1, xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1387,7 +1387,7 @@ void FixSRD::collisions_single() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) @@ -1557,7 +1557,7 @@ void FixSRD::collisions_multi() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1,xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1576,7 +1576,7 @@ void FixSRD::collisions_multi() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index 8ffd764447..aa8a4140ab 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -34,7 +34,7 @@ enum{NONE,EDGE,CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), nwall(0), fwall(NULL), fwall_all(NULL) + Fix(lmp, narg, arg), nwall(0), fwall(nullptr), fwall_all(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/srd command"); diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 063dc542be..5df63682b7 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -50,7 +50,7 @@ extern "C" { #define MPI_GROUP_EMPTY -1 #define MPI_ANY_SOURCE -1 -#define MPI_STATUS_IGNORE NULL +#define MPI_STATUS_IGNORE nullptr #define MPI_Comm int #define MPI_Request int @@ -60,7 +60,7 @@ extern "C" { #define MPI_Group int #define MPI_Offset long -#define MPI_IN_PLACE NULL +#define MPI_IN_PLACE nullptr #define MPI_MAX_PROCESSOR_NAME 128 #define MPI_MAX_LIBRARY_VERSION_STRING 128 diff --git a/src/USER-ADIOS/dump_atom_adios.cpp b/src/USER-ADIOS/dump_atom_adios.cpp index 3012223ac7..121bb193e1 100644 --- a/src/USER-ADIOS/dump_atom_adios.cpp +++ b/src/USER-ADIOS/dump_atom_adios.cpp @@ -190,7 +190,7 @@ void DumpAtomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/dump_custom_adios.cpp b/src/USER-ADIOS/dump_custom_adios.cpp index f7015ef696..921c725bc2 100644 --- a/src/USER-ADIOS/dump_custom_adios.cpp +++ b/src/USER-ADIOS/dump_custom_adios.cpp @@ -274,7 +274,7 @@ void DumpCustomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/reader_adios.cpp b/src/USER-ADIOS/reader_adios.cpp index d1e7313439..89a9ae698a 100644 --- a/src/USER-ADIOS/reader_adios.cpp +++ b/src/USER-ADIOS/reader_adios.cpp @@ -73,7 +73,7 @@ public: ReaderADIOS::ReaderADIOS(LAMMPS *lmp) : Reader(lmp) { - fieldindex = NULL; + fieldindex = nullptr; nAtoms = 0; nAtomsTotal = 0; atomOffset = 0; @@ -230,7 +230,7 @@ void ReaderADIOS::skip() { internal->fh.EndStep(); } match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index dd02676466..e5e42115f8 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -48,7 +48,7 @@ using std::string; /* ------------------------------------------------------------------------- */ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - lammps_(lmp), atc_(NULL) + lammps_(lmp), atc_(nullptr) { // ID GROUP atc PHYSICSTYPE [PARAMETERFILE] if (narg < 4 || narg > 5) lmp->error->all(FLERR,"Illegal fix atc command"); diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 5e23b7fc69..870a154073 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -49,8 +49,8 @@ PairAWPMDCut::PairAWPMDCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_var = NULL; - min_varforce = NULL; + min_var = nullptr; + min_varforce = nullptr; nextra = 4; pvector = new double[nextra]; @@ -82,7 +82,7 @@ PairAWPMDCut::~PairAWPMDCut() struct cmp_x{ double **xx; double tol; - cmp_x(double **xx_=NULL, double tol_=1e-12):xx(xx_),tol(tol_){} + cmp_x(double **xx_=nullptr, double tol_=1e-12):xx(xx_),tol(tol_){} bool operator()(const pair &left, const pair &right) const { if(left.first==right.first){ double d=xx[left.second][0]-xx[right.second][0]; @@ -241,7 +241,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) error->all(FLERR,logfmt("Invalid spin value (%d) for particle %d !",spin[i],i)); } // ion force vector - Vector_3 *fi=NULL; + Vector_3 *fi=nullptr; if(wpmd->ni) fi= new Vector_3[wpmd->ni]; @@ -269,7 +269,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) atom->ervel[i]=pv/(m*ermscale); } } - wpmd->set_pbc(NULL); // not required for LAMMPS + wpmd->set_pbc(nullptr); // not required for LAMMPS wpmd->interaction(0x1|0x4|0x10,fi); // get forces from the AWPMD solver object @@ -602,10 +602,10 @@ void PairAWPMDCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -629,9 +629,9 @@ void PairAWPMDCut::write_restart_settings(FILE *fp) void PairAWPMDCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index a4b8de84bd..46aabf7903 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure/bocs command"); if (igroup) error->all(FLERR,"Compute pressure/bocs must use group all"); @@ -52,12 +52,12 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : timeflag = 1; p_match_flag = 0; - phi_coeff = NULL; + phi_coeff = nullptr; // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -104,15 +104,15 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure/bocs requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; } @@ -149,7 +149,7 @@ void ComputePressureBocs::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairflag && force->pair) nvirial++; if (bondflag && atom->molecular && force->bond) nvirial++; @@ -179,7 +179,7 @@ void ComputePressureBocs::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* Extra functions added for BOCS */ diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 6f7962c83f..0dad793fd2 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -75,10 +75,10 @@ const int MAX_MESSAGE_LENGTH = 255; FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_bocs_package); @@ -98,7 +98,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -113,12 +113,12 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; - p_match_coeffs = NULL; + p_match_coeffs = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; // turn on tilt factor scaling, whenever applicable @@ -385,10 +385,10 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -481,7 +481,7 @@ FixBocs::~FixBocs() if (p_match_coeffs) free(p_match_coeffs); // Free splines memory structure - if (splines != NULL) { + if (splines != nullptr) { memory->destroy(splines); spline_length = 0; } @@ -629,7 +629,7 @@ void FixBocs::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -918,7 +918,7 @@ void FixBocs::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1924,7 +1924,7 @@ void *FixBocs::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index c9540bf0c0..f135c6b7ef 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -359,9 +359,9 @@ void BondOxdnaFene::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&Delta[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 662d55c590..6ddf03518c 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -815,47 +815,47 @@ void PairOxdna2Coaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,nullptr,error); } @@ -919,9 +919,9 @@ void PairOxdna2Coaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1023,5 +1023,5 @@ void *PairOxdna2Coaxstk::extract(const char *str, int &dim) if (strcmp(str,"AA_cxst1") == 0) return (void *) AA_cxst1; if (strcmp(str,"BB_cxst1") == 0) return (void *) BB_cxst1; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index f23ca4fbf7..1c4bd3bf09 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -437,16 +437,16 @@ void PairOxdna2Dh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -479,9 +479,9 @@ void PairOxdna2Dh::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -531,5 +531,5 @@ void *PairOxdna2Dh::extract(const char *str, int &dim) if (strcmp(str,"cut_dh_ast") == 0) return (void *) cut_dh_ast; if (strcmp(str,"cut_dh_c") == 0) return (void *) cut_dh_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index f1d425a0b3..3a1ee3d127 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -974,53 +974,53 @@ void PairOxdnaCoaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1090,9 +1090,9 @@ void PairOxdnaCoaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1205,5 +1205,5 @@ void *PairOxdnaCoaxstk::extract(const char *str, int &dim) if (strcmp(str,"b_cxst4p") == 0) return (void *) b_cxst4p; if (strcmp(str,"cosphi_cxst4p_c") == 0) return (void *) cosphi_cxst4p_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index ad96186b6b..64881cae22 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -696,26 +696,26 @@ void PairOxdnaExcv::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -758,9 +758,9 @@ void PairOxdnaExcv::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -824,5 +824,5 @@ void *PairOxdnaExcv::extract(const char *str, int &dim) if (strcmp(str,"b_bb") == 0) return (void *) b_bb; if (strcmp(str,"cut_bb_c") == 0) return (void *) cut_bb_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index 7987210d7a..009b967173 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -986,58 +986,58 @@ void PairOxdnaHbond::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1112,9 +1112,9 @@ void PairOxdnaHbond::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1232,5 +1232,5 @@ void *PairOxdnaHbond::extract(const char *str, int &dim) if (strcmp(str,"b_hb8") == 0) return (void *) b_hb8; if (strcmp(str,"dtheta_hb8_c") == 0) return (void *) dtheta_hb8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index bf52d61182..87b22f4468 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -1094,49 +1094,49 @@ void PairOxdnaStk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1202,9 +1202,9 @@ void PairOxdnaStk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1308,5 +1308,5 @@ void *PairOxdnaStk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index 1751499683..29c78c103a 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -933,56 +933,56 @@ void PairOxdnaXstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1055,9 +1055,9 @@ void PairOxdnaXstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1173,5 +1173,5 @@ void *PairOxdnaXstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index fd02946134..fff552908e 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -1191,55 +1191,55 @@ void PairOxrna2Stk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1311,9 +1311,9 @@ void PairOxrna2Stk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1427,5 +1427,5 @@ void *PairOxrna2Stk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index 673ef1c9a3..9fe4bebab8 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -855,50 +855,50 @@ void PairOxrna2Xstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -965,9 +965,9 @@ void PairOxrna2Xstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1073,5 +1073,5 @@ void *PairOxrna2Xstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 6f97d2104f..bdcb03c3c3 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -290,7 +290,7 @@ void AngleSDK::init_style() if (repflag) { int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle style SDK requires use of a compatible with Pair style"); lj1 = (double **) force->pair->extract("lj1",itmp); @@ -333,9 +333,9 @@ void AngleSDK::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 8185e24876..6c3e15089f 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -374,14 +374,14 @@ void PairLJSDK::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -411,10 +411,10 @@ void PairLJSDK::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -484,7 +484,7 @@ void *PairLJSDK::extract(const char *str, int &dim) if (strcmp(str,"lj4") == 0) return (void *) lj4; if (strcmp(str,"rminsq") == 0) return (void *) rminsq; if (strcmp(str,"emin") == 0) return (void *) emin; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index 42f1ff3ce7..2e21bdd102 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -51,7 +51,7 @@ PairLJSDKCoulLong::PairLJSDKCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -361,13 +361,13 @@ void PairLJSDKCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables (no rRESPA support yet) - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -466,14 +466,14 @@ void PairLJSDKCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -505,13 +505,13 @@ void PairLJSDKCoulLong::write_restart_settings(FILE *fp) void PairLJSDKCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -643,7 +643,7 @@ void *PairLJSDKCoulLong::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp index 8aa16b4adb..9818b7c51c 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp @@ -37,7 +37,7 @@ PairLJSDKCoulMSM::PairLJSDKCoulMSM(LAMMPS *lmp) : PairLJSDKCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; respa_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,6 +308,6 @@ void *PairLJSDKCoulMSM::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp b/src/USER-COLVARS/colvarproxy_lammps.cpp index dabb0bf923..f265271bb2 100644 --- a/src/USER-COLVARS/colvarproxy_lammps.cpp +++ b/src/USER-COLVARS/colvarproxy_lammps.cpp @@ -179,9 +179,9 @@ int colvarproxy_lammps::read_state_file(char const *state_filename) colvarproxy_lammps::~colvarproxy_lammps() { delete _random; - if (colvars != NULL) { + if (colvars != nullptr) { delete colvars; - colvars = NULL; + colvars = nullptr; } } diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index fcbfb58456..eaa0d272c3 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -194,7 +194,7 @@ int inthash_lookup(void *ptr, int key) { /* find the entry in the hash table */ h=inthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -246,7 +246,7 @@ void inthash_destroy(inthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -254,7 +254,7 @@ void inthash_destroy(inthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(inthash_t)); } @@ -276,7 +276,7 @@ int FixColvars::instances=0; optional keyword value pairs: input (for restarting/continuing, defaults to - NULL, but set to at end) + nullptr, but set to at end) output (defaults to 'out') seed (seed for RNG, defaults to '1966') tstat (label of thermostatting fix) @@ -305,9 +305,9 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : rng_seed = 1966; unwrap_flag = 1; - inp_name = NULL; - out_name = NULL; - tmp_name = NULL; + inp_name = nullptr; + out_name = nullptr; + tmp_name = nullptr; /* parse optional arguments */ int argsdone = 4; @@ -346,10 +346,10 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : nlevels_respa = 0; init_flag = 0; num_coords = 0; - comm_buf = NULL; - force_buf = NULL; - proxy = NULL; - idmap = NULL; + comm_buf = nullptr; + force_buf = nullptr; + proxy = nullptr; + idmap = nullptr; /* storage required to communicate a single coordinate or force. */ size_one = sizeof(struct commdata); @@ -445,7 +445,7 @@ void FixColvars::one_time_init() if (inp_name) { if (strcmp(inp_name,"NULL") == 0) { memory->sfree(inp_name); - inp_name = NULL; + inp_name = nullptr; } } @@ -961,7 +961,7 @@ void FixColvars::write_restart(FILE *fp) proxy->serialize_status(rest_text); // TODO call write_output_files() const char *cvm_state = rest_text.c_str(); - int len = strlen(cvm_state) + 1; // need to include terminating NULL byte. + int len = strlen(cvm_state) + 1; // need to include terminating nullptr byte. fwrite(&len,sizeof(int),1,fp); fwrite(cvm_state,1,len,fp); } diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 07a8ac2d5c..37b853ba96 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -143,7 +143,7 @@ void Group2Ndx::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for writing"); if (screen) diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index bab1592b1e..e09084ebfd 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -36,13 +36,13 @@ static char *find_section(FILE *fp, const char *name) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - if ((t != NULL) && *t == '[') { - t = strtok(NULL," \t\n\r\f"); - if (t != NULL) { + if ((t != nullptr) && *t == '[') { + t = strtok(nullptr," \t\n\r\f"); + if (t != nullptr) { n = t; - t = strtok(NULL," \t\n\r\f"); - if ((t != NULL) && *t == ']') { - if ((name == NULL) || strcmp(name,n) == 0) { + t = strtok(nullptr," \t\n\r\f"); + if ((t != nullptr) && *t == ']') { + if ((name == nullptr) || strcmp(name,n) == 0) { int l = strlen(n); r = new char[l+1]; strncpy(r,n,l+1); @@ -52,7 +52,7 @@ static char *find_section(FILE *fp, const char *name) } } } - return NULL; + return nullptr; } static tagint *read_section(FILE *fp, bigint &num) @@ -68,7 +68,7 @@ static tagint *read_section(FILE *fp, bigint &num) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - while (t != NULL) { + while (t != nullptr) { // start of a new section. we are done here. if (*t == '[') return tagbuf; @@ -77,7 +77,7 @@ static tagint *read_section(FILE *fp, bigint &num) nmax += DELTA; tagbuf = (tagint *)realloc(tagbuf,sizeof(tagint)*nmax); } - t = strtok(NULL," \t\n\r\f"); + t = strtok(nullptr," \t\n\r\f"); } } return tagbuf; @@ -90,7 +90,7 @@ void Ndx2Group::command(int narg, char **arg) int len; bigint num; FILE *fp; - char *name = NULL; + char *name = nullptr; tagint *tags; if (narg < 1) error->all(FLERR,"Illegal ndx2group command"); @@ -100,7 +100,7 @@ void Ndx2Group::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for reading"); if (screen) @@ -117,15 +117,15 @@ void Ndx2Group::command(int narg, char **arg) // find the next section. // if we had processed a section, before we need to step back - if (name != NULL) { + if (name != nullptr) { rewind(fp); char *tmp = find_section(fp,name); delete[] tmp; delete[] name; - name = NULL; + name = nullptr; } - name = find_section(fp,NULL); - if (name != NULL) { + name = find_section(fp,nullptr); + if (name != nullptr) { len=strlen(name)+1; // skip over group "all", which is called "System" in gromacs @@ -171,10 +171,10 @@ void Ndx2Group::command(int narg, char **arg) len = 0; // find named section, search from beginning of file - if (name != NULL) delete[] name; + if (name != nullptr) delete[] name; rewind(fp); name = find_section(fp,arg[idx]); - if (name != NULL) len=strlen(name)+1; + if (name != nullptr) len=strlen(name)+1; if (screen) fprintf(screen," %s group '%s'\n", diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index d16fbf2876..f35ea66796 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -49,7 +49,7 @@ static const char cite_compute_saed_c[] = /* ---------------------------------------------------------------------- */ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_saed_c); diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index b48de49c81..633467fe36 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -50,7 +50,7 @@ static const char cite_compute_xrd_c[] = /* ---------------------------------------------------------------------- */ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_xrd_c); diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index 39382264c4..00cfcbf91a 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -40,8 +40,8 @@ enum{FIRST,MULTI}; /* ---------------------------------------------------------------------- */ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ids(NULL), fp(NULL), vector(NULL), - vector_total(NULL), vector_list(NULL), compute_saed(NULL), filename(NULL) + Fix(lmp, narg, arg), ids(nullptr), fp(nullptr), vector(nullptr), + vector_total(nullptr), vector_list(nullptr), compute_saed(nullptr), filename(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix saed/vtk command"); @@ -66,7 +66,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : options(narg,arg); which = 0; - ids = NULL; + ids = nullptr; nvalues = 0; @@ -136,8 +136,8 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; if (ave == WINDOW) memory->create(vector_list,nwindow,nvalues,"saed/vtk:vector_list"); @@ -145,7 +145,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : memory->create(vector,nrows,"saed/vtk:vector"); memory->create(vector_total,nrows,"saed/vtk:vector_total"); - extlist = NULL; + extlist = nullptr; vector_flag = 1; size_vector = nrows; @@ -425,7 +425,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); @@ -531,7 +531,7 @@ void FixSAEDVTK::options(int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; overwrite = 0; @@ -552,7 +552,7 @@ void FixSAEDVTK::options(int narg, char **arg) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); diff --git a/src/USER-DPD/compute_dpd_atom.cpp b/src/USER-DPD/compute_dpd_atom.cpp index 0fd732f669..95141e2de2 100644 --- a/src/USER-DPD/compute_dpd_atom.cpp +++ b/src/USER-DPD/compute_dpd_atom.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDpdAtom::ComputeDpdAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), dpdAtom(NULL) + Compute(lmp, narg, arg), dpdAtom(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dpd/atom command"); diff --git a/src/USER-DPD/fix_dpd_energy.cpp b/src/USER-DPD/fix_dpd_energy.cpp index 6ee88ea88a..674bf0e13d 100644 --- a/src/USER-DPD/fix_dpd_energy.cpp +++ b/src/USER-DPD/fix_dpd_energy.cpp @@ -28,12 +28,12 @@ FixDPDenergy::FixDPDenergy(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3 ) error->all(FLERR,"Illegal fix dpd/energy command"); - pairDPDE = NULL; + pairDPDE = nullptr; pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix dpd/energy"); if (!(atom->dpd_flag)) error->all(FLERR,"Must use atom_style dpd/fdt/energy with fix dpd/energy"); diff --git a/src/USER-DPD/fix_eos_table.cpp b/src/USER-DPD/fix_eos_table.cpp index 57cfe03dc8..00cbda1671 100644 --- a/src/USER-DPD/fix_eos_table.cpp +++ b/src/USER-DPD/fix_eos_table.cpp @@ -31,7 +31,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix eos/table command"); nevery = 1; @@ -43,7 +43,7 @@ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table entries"); ntables = 0; - tables = NULL; + tables = nullptr; int me; MPI_Comm_rank(world,&me); tables = (Table *) @@ -167,10 +167,10 @@ void FixEOStable::end_of_step() void FixEOStable::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -198,7 +198,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -207,7 +207,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -305,13 +305,13 @@ void FixEOStable::param_extract(Table *tb, Table *tb2, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); tb2->ninput = atoi(word); } else { error->one(FLERR,"Invalid keyword in fix eos/table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"fix eos/table parameters did not set N"); diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index c220d84a57..d01b2015d2 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -42,8 +42,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL), - tables2(NULL), dHf(NULL), eosSpecies(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr), + tables2(nullptr), dHf(nullptr), eosSpecies(nullptr) { if (narg != 8 && narg != 10) error->all(FLERR,"Illegal fix eos/table/rx command"); nevery = 1; @@ -64,9 +64,9 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table/rx entries"); ntables = 0; - tables = NULL; - tables2 = NULL; - eosSpecies = NULL; + tables = nullptr; + tables2 = nullptr; + eosSpecies = nullptr; int me; MPI_Comm_rank(world,&me); @@ -306,10 +306,10 @@ void FixEOStableRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open eos table/rx potential file %s",file); error->one(FLERR,str); @@ -324,7 +324,7 @@ void FixEOStableRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -346,7 +346,7 @@ void FixEOStableRX::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -366,7 +366,7 @@ void FixEOStableRX::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -388,10 +388,10 @@ void FixEOStableRX::read_file(char *file) void FixEOStableRX::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -419,7 +419,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -428,7 +428,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -482,7 +482,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) } nwords = 0; word = strtok(line," \t\n\r\f"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); for (int icolumn=0;icolumnrfile[i] = rtmp; @@ -574,11 +574,11 @@ void FixEOStableRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); if(rx_flag){ while (word) { @@ -592,7 +592,7 @@ void FixEOStableRX::param_extract(Table *tb, char *line) printf("name=%s not found in species list\n",word); error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } for (int icolumn = 0; icolumn < ncolumn; icolumn++) diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index d974d12473..07d39d0de7 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -67,23 +67,23 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; /* ---------------------------------------------------------------------- */ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mol2param(NULL), nreactions(0), - params(NULL), Arr(NULL), nArr(NULL), Ea(NULL), tempExp(NULL), - stoich(NULL), stoichReactants(NULL), stoichProducts(NULL), kR(NULL), - pairDPDE(NULL), dpdThetaLocal(NULL), sumWeights(NULL), sparseKinetics_nu(NULL), - sparseKinetics_nuk(NULL), sparseKinetics_inu(NULL), sparseKinetics_isIntegralReaction(NULL), - kineticsFile(NULL), id_fix_species(NULL), - id_fix_species_old(NULL), fix_species(NULL), fix_species_old(NULL) + Fix(lmp, narg, arg), mol2param(nullptr), nreactions(0), + params(nullptr), Arr(nullptr), nArr(nullptr), Ea(nullptr), tempExp(nullptr), + stoich(nullptr), stoichReactants(nullptr), stoichProducts(nullptr), kR(nullptr), + pairDPDE(nullptr), dpdThetaLocal(nullptr), sumWeights(nullptr), sparseKinetics_nu(nullptr), + sparseKinetics_nuk(nullptr), sparseKinetics_inu(nullptr), sparseKinetics_isIntegralReaction(nullptr), + kineticsFile(nullptr), id_fix_species(nullptr), + id_fix_species_old(nullptr), fix_species(nullptr), fix_species_old(nullptr) { if (narg < 7 || narg > 12) error->all(FLERR,"Illegal fix rx command"); nevery = 1; nreactions = maxparam = 0; - params = NULL; - mol2param = NULL; - pairDPDE = NULL; - id_fix_species = NULL; - id_fix_species_old = NULL; + params = nullptr; + mol2param = nullptr; + pairDPDE = nullptr; + id_fix_species = nullptr; + id_fix_species_old = nullptr; const int Verbosity = 1; @@ -166,7 +166,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : diagnosticFrequency = 0; for (int i = 0; i < numDiagnosticCounters; ++i){ diagnosticCounter[i] = 0; - diagnosticCounterPerODE[i] = NULL; + diagnosticCounterPerODE[i] = nullptr; } if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg==8){ @@ -189,8 +189,8 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : minSteps = atoi( arg[iarg++] ); maxIters = atoi( arg[iarg++] ); - relTol = strtod( arg[iarg++], NULL); - absTol = strtod( arg[iarg++], NULL); + relTol = strtod( arg[iarg++], nullptr); + absTol = strtod( arg[iarg++], nullptr); if (iarg < narg) diagnosticFrequency = atoi( arg[iarg++] ); @@ -207,10 +207,10 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : } // Initialize/Create the sparse matrix database. - sparseKinetics_nu = NULL; - sparseKinetics_nuk = NULL; - sparseKinetics_inu = NULL; - sparseKinetics_isIntegralReaction = NULL; + sparseKinetics_nu = nullptr; + sparseKinetics_nuk = nullptr; + sparseKinetics_inu = nullptr; + sparseKinetics_isIntegralReaction = nullptr; sparseKinetics_maxReactants = 0; sparseKinetics_maxProducts = 0; sparseKinetics_maxSpecies = 0; @@ -259,15 +259,15 @@ void FixRX::post_constructor() char **tmpspecies = new char*[maxspecies]; int tmpmaxstrlen = 0; for(int jj=0; jj < maxspecies; jj++) - tmpspecies[jj] = NULL; + tmpspecies[jj] = nullptr; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(kineticsFile,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",kineticsFile); error->one(FLERR,str); @@ -284,7 +284,7 @@ void FixRX::post_constructor() while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -304,8 +304,8 @@ void FixRX::post_constructor() nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ - word = strtok(NULL, " \t\n\r\f"); + while (word != nullptr){ + word = strtok(nullptr, " \t\n\r\f"); match=false; for(int jj=0;jjnspecies_dpd = nUniqueSpecies; @@ -332,8 +332,8 @@ void FixRX::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_species = NULL; - id_fix_species_old = NULL; + id_fix_species = nullptr; + id_fix_species_old = nullptr; n = strlen(id) + strlen("_SPECIES") + 1; id_fix_species = new char[n]; @@ -637,10 +637,10 @@ int FixRX::setmask() void FixRX::init() { pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); bool eos_flag = false; @@ -853,10 +853,10 @@ void FixRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",file); error->one(FLERR,str); @@ -872,7 +872,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -926,7 +926,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -946,9 +946,9 @@ void FixRX::read_file(char *file) nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ + while (word != nullptr){ tmpStoich = atof(word); - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); for (ispecies = 0; ispecies < nspecies; ispecies++){ if (strcmp(word,&atom->dname[ispecies][0]) == 0){ stoich[nreactions][ispecies] += sign*tmpStoich; @@ -965,22 +965,22 @@ void FixRX::read_file(char *file) } error->all(FLERR,"Illegal fix rx command"); } - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); if(strcmp(word,"=") == 0) sign = 1.0; if(strcmp(word,"+") != 0 && strcmp(word,"=") != 0){ - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Arr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); nArr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Ea[nreactions] = atof(word); sign = -1.0; break; } - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); } nreactions++; } @@ -1434,7 +1434,7 @@ void FixRX::odeDiagnostics(void) my_max[i] = 0; my_min[i] = DBL_MAX; - if (diagnosticCounterPerODE[i] != NULL){ + if (diagnosticCounterPerODE[i] != nullptr){ for (int j = 0; j < nlocal; ++j) if (mask[j] & groupbit){ double diff = double(diagnosticCounterPerODE[i][j]) - avg_per_atom[i]; @@ -1637,8 +1637,8 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) ode_counter[1] += nit; ode_counter[2] += nfe; - //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != NULL) - if (diagnosticCounterPerODE[StepSum] != NULL){ + //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != nullptr) + if (diagnosticCounterPerODE[StepSum] != nullptr){ diagnosticCounterPerODE[StepSum][id] = nst; diagnosticCounterPerODE[FuncSum][id] = nfe; } @@ -1708,7 +1708,7 @@ int FixRX::rhs_sparse(double /*t*/, const double *y, double *dydt, void *v_param const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index c4480a0373..6db13d3943 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -84,18 +84,18 @@ static const char cite_fix_shardlow[] = /* ---------------------------------------------------------------------- */ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pairDPD(NULL), pairDPDE(NULL), v_t0(NULL) - ,rand_state(NULL) + Fix(lmp, narg, arg), pairDPD(nullptr), pairDPDE(nullptr), v_t0(nullptr) + ,rand_state(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_shardlow); if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); - pairDPD = NULL; - pairDPDE = NULL; + pairDPD = nullptr; + pairDPDE = nullptr; pairDPD = (PairDPDfdt *) force->pair_match("dpd/fdt",1); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); maxRNG = 0; @@ -107,7 +107,7 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; } - if(pairDPD == NULL && pairDPDE == NULL) + if(pairDPD == nullptr && pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow"); } @@ -533,7 +533,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) const int nlocal = atom->nlocal; const int nghost = atom->nghost; - const bool useDPDE = (pairDPDE != NULL); + const bool useDPDE = (pairDPDE != nullptr); // NOTE: this logic is specific to orthogonal boxes, not triclinic @@ -640,7 +640,7 @@ fprintf(stdout, "\n%6d %6d,%6d %6d: " #endif memory->sfree(v_t0); - v_t0 = NULL; + v_t0 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index 4fb5714d11..e3f6f4e20d 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -37,9 +37,9 @@ NPairHalfBinNewtonSSA::NPairHalfBinNewtonSSA(LAMMPS *lmp) : NPair(lmp) ssa_maxPhaseCt = 0; ssa_maxPhaseLen = 0; ssa_phaseCt = 0; - ssa_phaseLen = NULL; - ssa_itemLoc = NULL; - ssa_itemLen = NULL; + ssa_phaseLen = nullptr; + ssa_itemLoc = nullptr; + ssa_itemLen = nullptr; ssa_gphaseCt = 7; memory->create(ssa_gphaseLen,ssa_gphaseCt,"NPairHalfBinNewtonSSA:ssa_gphaseLen"); memory->create(ssa_gitemLoc,ssa_gphaseCt,1,"NPairHalfBinNewtonSSA:ssa_gitemLoc"); diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 1d3d952e9f..822444f8c5 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; PairDPDfdt::PairDPDfdt(LAMMPS *lmp) : Pair(lmp) { - random = NULL; + random = nullptr; splitFDT_flag = false; a0_is_zero = false; } @@ -375,13 +375,13 @@ void PairDPDfdt::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -410,10 +410,10 @@ void PairDPDfdt::write_restart_settings(FILE *fp) void PairDPDfdt::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index b843e4601a..094e5732c7 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -39,9 +39,9 @@ using namespace LAMMPS_NS; PairDPDfdtEnergy::PairDPDfdtEnergy(LAMMPS *lmp) : Pair(lmp) { - random = NULL; - duCond = NULL; - duMech = NULL; + random = nullptr; + duCond = nullptr; + duMech = nullptr; splitFDT_flag = false; a0_is_zero = false; @@ -476,14 +476,14 @@ void PairDPDfdtEnergy::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -513,9 +513,9 @@ void PairDPDfdtEnergy::write_restart_settings(FILE *fp) void PairDPDfdtEnergy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 666a1b0ea9..9d7fcc1ab2 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -59,10 +59,10 @@ struct PairExp6ParamDataType // Default constructor -- nullify everything. PairExp6ParamDataType(void) - : n(0), epsilon1(NULL), alpha1(NULL), rm1(NULL), mixWtSite1(NULL), - epsilon2(NULL), alpha2(NULL), rm2(NULL), mixWtSite2(NULL), - epsilonOld1(NULL), alphaOld1(NULL), rmOld1(NULL), mixWtSite1old(NULL), - epsilonOld2(NULL), alphaOld2(NULL), rmOld2(NULL), mixWtSite2old(NULL) + : n(0), epsilon1(nullptr), alpha1(nullptr), rm1(nullptr), mixWtSite1(nullptr), + epsilon2(nullptr), alpha2(nullptr), rm2(nullptr), mixWtSite2(nullptr), + epsilonOld1(nullptr), alphaOld1(nullptr), rmOld1(nullptr), mixWtSite1old(nullptr), + epsilonOld2(nullptr), alphaOld2(nullptr), rmOld2(nullptr), mixWtSite2old(nullptr) {} }; @@ -74,8 +74,8 @@ PairExp6rx::PairExp6rx(LAMMPS *lmp) : Pair(lmp) nspecies = 0; nparams = maxparam = 0; - params = NULL; - mol2param = NULL; + params = nullptr; + mol2param = nullptr; fractionalWeighting = true; } @@ -85,7 +85,7 @@ PairExp6rx::~PairExp6rx() { if (copymode) return; - if (params != NULL) { + if (params != nullptr) { for (int i=0; i < nparams; ++i) { delete[] params[i].name; delete[] params[i].potential; @@ -659,7 +659,7 @@ void PairExp6rx::coeff(int narg, char **arg) } delete[] site1; delete[] site2; - site1 = site2 = NULL; + site1 = site2 = nullptr; setup(); @@ -717,16 +717,16 @@ void PairExp6rx::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -743,7 +743,7 @@ void PairExp6rx::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -765,7 +765,7 @@ void PairExp6rx::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -785,7 +785,7 @@ void PairExp6rx::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -839,10 +839,10 @@ void PairExp6rx::read_file2(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open polynomial file %s",file); error->one(FLERR,str); @@ -857,7 +857,7 @@ void PairExp6rx::read_file2(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -879,7 +879,7 @@ void PairExp6rx::read_file2(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -899,7 +899,7 @@ void PairExp6rx::read_file2(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; if (strcmp(words[0],"alpha") == 0){ for (int ii=1; iime; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -1004,10 +1004,10 @@ void PairExp6rx::write_restart_settings(FILE *fp) void PairExp6rx::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index ceb5c78eaf..2e556d82e4 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -57,14 +57,14 @@ static const char cite_pair_multi_lucy[] = /* ---------------------------------------------------------------------- */ PairMultiLucy::PairMultiLucy(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL) + ntables(0), tables(nullptr), tabindex(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -256,7 +256,7 @@ void PairMultiLucy::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -358,7 +358,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -481,26 +481,26 @@ void PairMultiLucy::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -582,15 +582,15 @@ void PairMultiLucy::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucy::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -707,8 +707,8 @@ void PairMultiLucy::write_restart_settings(FILE *fp) void PairMultiLucy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index d769d94783..e56743ea1d 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -68,14 +68,14 @@ static const char cite_pair_multi_lucy_rx[] = /* ---------------------------------------------------------------------- */ PairMultiLucyRX::PairMultiLucyRX(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL), site1(NULL), site2(NULL) + ntables(0), tables(nullptr), tabindex(nullptr), site1(nullptr), site2(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy_rx); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy/rx command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -134,10 +134,10 @@ void PairMultiLucyRX::compute(int eflag, int vflag) int jtable; double *rho = atom->rho; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = nlocal + nghost; @@ -355,7 +355,7 @@ void PairMultiLucyRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -494,7 +494,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -503,7 +503,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -626,26 +626,26 @@ void PairMultiLucyRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -727,15 +727,15 @@ void PairMultiLucyRX::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucyRX::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -852,8 +852,8 @@ void PairMultiLucyRX::write_restart_settings(FILE *fp) void PairMultiLucyRX::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index f791107f1d..05467346c8 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -46,8 +46,8 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTableRX::PairTableRX(LAMMPS *lmp) : PairTable(lmp) { fractionalWeighting = true; - site1 = NULL; - site2 = NULL; + site1 = nullptr; + site2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -93,10 +93,10 @@ void PairTableRX::compute(int eflag, int vflag) double *uCG = atom->uCG; double *uCGnew = atom->uCGnew; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = atom->nlocal + atom->nghost; @@ -290,7 +290,7 @@ void PairTableRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index b806b4434b..1c60805db2 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -43,9 +43,9 @@ ComputeTempDrude::ComputeTempDrude(LAMMPS *lmp, int narg, char **arg) : tempflag = 0; // because does not compute a single temperature (scalar and vector) vector = new double[size_vector]; - fix_drude = NULL; - id_temp = NULL; - temperature = NULL; + fix_drude = nullptr; + id_temp = nullptr; + temperature = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_drude.cpp b/src/USER-DRUDE/fix_drude.cpp index 313ac249d7..ea93731426 100644 --- a/src/USER-DRUDE/fix_drude.cpp +++ b/src/USER-DRUDE/fix_drude.cpp @@ -53,7 +53,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix drude command"); } - drudeid = NULL; + drudeid = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); @@ -147,7 +147,7 @@ void FixDrude::build_drudeid(){ // Loop on procs to fill my atoms' sets of bond partners comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 4, ring_build_partner, NULL, (void *)this, 1); + 4, ring_build_partner, nullptr, (void *)this, 1); // Build the list of my Drudes' tags // The only bond partners of a Drude particle is its core, @@ -163,7 +163,7 @@ void FixDrude::build_drudeid(){ // so that each core finds its Drude. comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 3, ring_search_drudeid, NULL, (void *)this, 1); + 3, ring_search_drudeid, nullptr, (void *)this, 1); delete [] partner_set; } @@ -338,11 +338,11 @@ void FixDrude::rebuild_special(){ // Remove Drude particles from the special lists of each proc comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 9, ring_remove_drude, NULL, (void *)this, 1); + 9, ring_remove_drude, nullptr, (void *)this, 1); // Add back Drude particles in the lists just after their core comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 10, ring_add_drude, NULL, (void *)this, 1); + 10, ring_add_drude, nullptr, (void *)this, 1); // Check size of special list nspecmax_loc = 0; @@ -373,7 +373,7 @@ void FixDrude::rebuild_special(){ // Copy core's list into their drude list comm->ring(core_special_vec.size(), sizeof(tagint), (char *) core_special_vec.data(), - 11, ring_copy_drude, NULL, (void *)this, 1); + 11, ring_copy_drude, nullptr, (void *)this, 1); } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index bdccaaebc8..fc89367323 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -29,11 +29,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ template FixDrudeTransform::FixDrudeTransform(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mcoeff(NULL) + Fix(lmp, narg, arg), mcoeff(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix drude/transform command"); comm_forward = 9; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index da74510821..3fd017444e 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -48,7 +48,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; // core temperature - tstr_core = NULL; + tstr_core = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr_core = new char[n]; @@ -63,7 +63,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : int seed_core = utils::inumeric(FLERR,arg[5],false,lmp); // drude temperature - tstr_drude = NULL; + tstr_drude = nullptr; if (strstr(arg[7],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; tstr_drude = new char[n]; @@ -102,9 +102,9 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : tflag = 0; // no external compute/temp is specified yet (for bias) energy = 0.; - fix_drude = NULL; - temperature = NULL; - id_temp = NULL; + fix_drude = nullptr; + temperature = nullptr; + id_temp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -379,7 +379,7 @@ void *FixLangevinDrude::extract(const char *str, int &dim) } else if (strcmp(str,"t_target_drude") == 0) { return &t_target_drude; } else error->all(FLERR, "Illegal extract string in fix langevin/drude"); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index 461f972885..c6662c423d 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -56,9 +56,9 @@ PairLJCutTholeLong::PairLJCutTholeLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; single_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -371,11 +371,11 @@ void PairLJCutTholeLong::init_style() // set rRESPA cutoffs - cut_respa = NULL; + cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -496,16 +496,16 @@ void PairLJCutTholeLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -541,15 +541,15 @@ void PairLJCutTholeLong::write_restart_settings(FILE *fp) void PairLJCutTholeLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -602,5 +602,5 @@ void *PairLJCutTholeLong::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 281317c076..e9c4f396d0 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairThole::PairThole(LAMMPS *lmp) : Pair(lmp) { - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -312,13 +312,13 @@ void PairThole::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); } MPI_Bcast(&polar[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairThole::write_restart_settings(FILE *fp) void PairThole::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&thole_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -400,5 +400,5 @@ void *PairThole::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-EFF/compute_ke_atom_eff.cpp b/src/USER-EFF/compute_ke_atom_eff.cpp index 001e1d4c43..e25f239adc 100644 --- a/src/USER-EFF/compute_ke_atom_eff.cpp +++ b/src/USER-EFF/compute_ke_atom_eff.cpp @@ -40,7 +40,7 @@ ComputeKEAtomEff::ComputeKEAtomEff(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - ke = NULL; + ke = nullptr; // error check diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 90e25ca3c8..979b47f50c 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -52,7 +52,7 @@ ComputeTempDeformEff::ComputeTempDeformEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index c95cf0de2d..f7c1bd5b68 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -55,7 +55,7 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index 3966bc7b98..a0aabb68a0 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -45,7 +45,7 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevinEff::FixLangevinEff(LAMMPS *lmp, int narg, char **arg) : FixLangevin(lmp, narg, arg) { - erforcelangevin = NULL; + erforcelangevin = nullptr; } /* ---------------------------------------------------------------------- */ @@ -399,7 +399,7 @@ void FixLangevinEff::end_of_step() double FixLangevinEff::compute_scalar() { - if (!tallyflag || flangevin == NULL || erforcelangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr || erforcelangevin == nullptr) return 0.0; // capture the very first energy transfer to thermal reservoir diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index f4e7af6584..817b2eb6eb 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -42,8 +42,8 @@ PairEffCut::PairEffCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_eradius = NULL; - min_erforce = NULL; + min_eradius = nullptr; + min_erforce = nullptr; nextra = 4; pvector = new double[nextra]; } @@ -979,10 +979,10 @@ void PairEffCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -1006,9 +1006,9 @@ void PairEffCut::write_restart_settings(FILE *fp) void PairEffCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index ff1e303a30..6ecf0795d7 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -158,14 +158,14 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : // allocate space for charge, force, energy, virial arrays - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; allocate_storage(); - fixgpu = NULL; + fixgpu = nullptr; } /* ---------------------------------------------------------------------- */ @@ -210,17 +210,17 @@ void ComputeFEP::init() if (!input->variable->equalstyle(pert->ivar)) error->all(FLERR,"Variable for compute fep is of invalid style"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"compute fep pair requires pair interactions"); if (pert->which == PAIR) { pairflag = 1; Pair *pair = force->pair_match(pert->pstyle,1); - if (pair == NULL) error->all(FLERR,"compute fep pair style " + if (pair == nullptr) error->all(FLERR,"compute fep pair style " "does not exist"); void *ptr = pair->extract(pert->pparam,pert->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"compute fep pair style param not supported"); pert->array = (double **) ptr; @@ -497,10 +497,10 @@ void ComputeFEP::deallocate_storage() memory->destroy(keatom_orig); memory->destroy(kvatom_orig); - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; } diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 2f97b5a0e3..ca9088836d 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -172,7 +172,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : if (adapt[m].which == PAIR) memory->create(adapt[m].array_orig,n+1,n+1,"adapt:array_orig"); - id_fix_diam = id_fix_chg = NULL; + id_fix_diam = id_fix_chg = nullptr; } /* ---------------------------------------------------------------------- */ @@ -220,8 +220,8 @@ void FixAdaptFEP::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; char **newarg = new char*[6]; newarg[1] = group->names[igroup]; @@ -307,7 +307,7 @@ void FixAdaptFEP::init() if (ad->which == PAIR) { anypair = 1; - Pair *pair = NULL; + Pair *pair = nullptr; if (lmp->suffix_enable) { char psuffix[128]; @@ -316,11 +316,11 @@ void FixAdaptFEP::init() strcat(psuffix,lmp->suffix); pair = force->pair_match(psuffix,1); } - if (pair == NULL) pair = force->pair_match(ad->pstyle,1); - if (pair == NULL) + if (pair == nullptr) pair = force->pair_match(ad->pstyle,1); + if (pair == nullptr) error->all(FLERR, "Fix adapt/fep pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt/fep pair style param not supported"); ad->pdim = 2; @@ -340,7 +340,7 @@ void FixAdaptFEP::init() } } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt/fep kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index b0a099a56f..a68c136993 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -275,12 +275,12 @@ void PairCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -309,12 +309,12 @@ void PairCoulCutSoft::write_restart_settings(FILE *fp) void PairCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -373,5 +373,5 @@ void *PairCoulCutSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index 80173f3f0f..2749fe8c71 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -236,7 +236,7 @@ void PairCoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -295,11 +295,11 @@ void PairCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); } } @@ -326,12 +326,12 @@ void PairCoulLongSoft::write_restart_settings(FILE *fp) void PairCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -388,5 +388,5 @@ void *PairCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"scale") == 0) return (void *) scale; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index e13b98329f..e6783b0228 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -728,11 +728,11 @@ void PairLJCharmmCoulLongSoft::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -819,15 +819,15 @@ void PairLJCharmmCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -862,15 +862,15 @@ void PairLJCharmmCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCharmmCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -990,5 +990,5 @@ void *PairLJCharmmCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index bfd5a630f6..f8719b8900 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -382,15 +382,15 @@ void PairLJClass2CoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -425,15 +425,15 @@ void PairLJClass2CoulCutSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -515,5 +515,5 @@ void *PairLJClass2CoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index e027a30185..9741dd24ca 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -285,7 +285,7 @@ void PairLJClass2CoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -397,14 +397,14 @@ void PairLJClass2CoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -438,15 +438,15 @@ void PairLJClass2CoulLongSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -537,5 +537,5 @@ void *PairLJClass2CoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index 0cd1fc9e87..81319d715c 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -321,14 +321,14 @@ void PairLJClass2Soft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -360,12 +360,12 @@ void PairLJClass2Soft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -432,5 +432,5 @@ void *PairLJClass2Soft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index a18256f98a..53f39523e1 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -378,15 +378,15 @@ void PairLJCutCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -421,15 +421,15 @@ void PairLJCutCoulCutSoft::write_restart_settings(FILE *fp) void PairLJCutCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -512,5 +512,5 @@ void *PairLJCutCoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index 4b3fae77b3..61db28fe16 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -656,11 +656,11 @@ void PairLJCutCoulLongSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -775,14 +775,14 @@ void PairLJCutCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -816,15 +816,15 @@ void PairLJCutCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCutCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -923,5 +923,5 @@ void *PairLJCutCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 786715d6c9..589e036420 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -532,7 +532,7 @@ void PairLJCutSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -636,14 +636,14 @@ void PairLJCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -676,13 +676,13 @@ void PairLJCutSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -748,5 +748,5 @@ void *PairLJCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 18f8db5021..748c616d64 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -53,8 +53,8 @@ PairLJCutTIP4PLongSoft::PairLJCutTIP4PLongSoft(LAMMPS *lmp) : respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -450,9 +450,9 @@ void PairLJCutTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/soft requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLongSoft::init_style(); @@ -517,17 +517,17 @@ void PairLJCutTIP4PLongSoft::read_restart_settings(FILE *fp) PairLJCutCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -579,7 +579,7 @@ void *PairLJCutTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index 85a30a5414..5154907ec3 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -313,15 +313,15 @@ void PairMorseSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -353,10 +353,10 @@ void PairMorseSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&shift_range,1,MPI_DOUBLE,0,world); @@ -450,5 +450,5 @@ void *PairMorseSoft::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index 9578befd37..18e2667150 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -52,8 +52,8 @@ PairTIP4PLongSoft::PairTIP4PLongSoft(LAMMPS *lmp) : PairCoulLongSoft(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -407,9 +407,9 @@ void PairTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLongSoft::init_style(); @@ -454,11 +454,11 @@ void PairTIP4PLongSoft::read_restart_settings(FILE *fp) PairCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); MPI_Bcast(&typeH,1,MPI_INT,0,world); @@ -501,7 +501,7 @@ void *PairTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-H5MD/dump_h5md.cpp b/src/USER-H5MD/dump_h5md.cpp index e9daf71867..11a4906263 100644 --- a/src/USER-H5MD/dump_h5md.cpp +++ b/src/USER-H5MD/dump_h5md.cpp @@ -68,11 +68,11 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) size_one = 6; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; datafile_from_dump = -1; - author_name=NULL; + author_name=nullptr; every_dump = utils::inumeric(FLERR,arg[3],false,lmp); every_position = every_image = -1; @@ -175,7 +175,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) if (iarg+1>=narg) { error->all(FLERR, "Invalid number of arguments in dump h5md"); } - if (author_name==NULL) { + if (author_name==nullptr) { author_name = new char[strlen(arg[iarg])+1]; strcpy(author_name, arg[iarg+1]); } else { @@ -271,10 +271,10 @@ void DumpH5MD::openfile() if (me == 0) { if (datafile_from_dump<0) { - if (author_name==NULL) { - datafile = h5md_create_file(filename, "N/A", NULL, "lammps", LAMMPS_VERSION); + if (author_name==nullptr) { + datafile = h5md_create_file(filename, "N/A", nullptr, "lammps", LAMMPS_VERSION); } else { - datafile = h5md_create_file(filename, author_name, NULL, "lammps", LAMMPS_VERSION); + datafile = h5md_create_file(filename, author_name, nullptr, "lammps", LAMMPS_VERSION); } group_name_length = strlen(group->names[igroup])+1; group_name = new char[group_name_length]; @@ -288,19 +288,19 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } else { @@ -318,26 +318,26 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } } - if (author_name!=NULL) delete [] author_name; + if (author_name!=nullptr) delete [] author_name; for (int i=0; i<3; i++) { delete [] boundary[i]; } @@ -536,7 +536,7 @@ void DumpH5MD::write_fixed_frame() edges[2] = boxzhi - boxzlo; if (every_position==0) { particles_data.position = h5md_create_fixed_data_simple(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, dump_position); - h5md_create_box(&particles_data, dims[1], boundary, false, edges, NULL); + h5md_create_box(&particles_data, dims[1], boundary, false, edges, nullptr); if (every_image==0) particles_data.image = h5md_create_fixed_data_simple(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, dump_image); } diff --git a/src/USER-INTEL/angle_charmm_intel.h b/src/USER-INTEL/angle_charmm_intel.h index 155ecfaff9..798e3d1523 100644 --- a/src/USER-INTEL/angle_charmm_intel.h +++ b/src/USER-INTEL/angle_charmm_intel.h @@ -61,7 +61,7 @@ class AngleCharmmIntel : public AngleCharmm { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/angle_harmonic_intel.h b/src/USER-INTEL/angle_harmonic_intel.h index c00292f7ce..7df4a98877 100644 --- a/src/USER-INTEL/angle_harmonic_intel.h +++ b/src/USER-INTEL/angle_harmonic_intel.h @@ -61,7 +61,7 @@ class AngleHarmonicIntel : public AngleHarmonic { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/bond_fene_intel.h b/src/USER-INTEL/bond_fene_intel.h index 58fcdb8669..92ec4097c0 100644 --- a/src/USER-INTEL/bond_fene_intel.h +++ b/src/USER-INTEL/bond_fene_intel.h @@ -61,7 +61,7 @@ class BondFENEIntel : public BondFENE { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/bond_harmonic_intel.h b/src/USER-INTEL/bond_harmonic_intel.h index 3c1d050a3b..449df3b7a8 100644 --- a/src/USER-INTEL/bond_harmonic_intel.h +++ b/src/USER-INTEL/bond_harmonic_intel.h @@ -61,7 +61,7 @@ class BondHarmonicIntel : public BondHarmonic { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_charmm_intel.h b/src/USER-INTEL/dihedral_charmm_intel.h index d80b32c8ac..bb830b7292 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.h +++ b/src/USER-INTEL/dihedral_charmm_intel.h @@ -66,7 +66,7 @@ class DihedralCharmmIntel : public DihedralCharmm { flt_t *weight; ForceConst() : _npairtypes(0), _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, 0, NULL); } + ~ForceConst() { set_ntypes(0, 0, nullptr); } void set_ntypes(const int npairtypes, const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_fourier_intel.h b/src/USER-INTEL/dihedral_fourier_intel.h index 26007f4118..f91d89f6bc 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.h +++ b/src/USER-INTEL/dihedral_fourier_intel.h @@ -63,7 +63,7 @@ class DihedralFourierIntel : public DihedralFourier { fc_packed1 **bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, NULL, NULL); } + ~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); } void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory); diff --git a/src/USER-INTEL/dihedral_harmonic_intel.h b/src/USER-INTEL/dihedral_harmonic_intel.h index 0a9cfaa042..cdbae365fd 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.h +++ b/src/USER-INTEL/dihedral_harmonic_intel.h @@ -63,7 +63,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_opls_intel.h b/src/USER-INTEL/dihedral_opls_intel.h index 1080bfa6c3..77fd8c4b95 100644 --- a/src/USER-INTEL/dihedral_opls_intel.h +++ b/src/USER-INTEL/dihedral_opls_intel.h @@ -62,7 +62,7 @@ class DihedralOPLSIntel : public DihedralOPLS { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index eacbc7ddcc..21cc106e31 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -303,7 +303,7 @@ void FixIntel::init() #endif const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != NULL) { + if (force->pair_match("^hybrid", 0) != nullptr) { _pair_hybrid_flag = 1; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR, @@ -513,9 +513,9 @@ void FixIntel::bond_init_check() "USER-INTEL package requires same setting for newton bond and non-bond."); int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -530,9 +530,9 @@ void FixIntel::bond_init_check() void FixIntel::kspace_init_check() { int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -855,7 +855,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, } } - if (ev_global != NULL) { + if (ev_global != nullptr) { force->pair->eng_vdwl += ev_global[0]; force->pair->eng_coul += ev_global[1]; force->pair->virial[0] += ev_global[2]; @@ -1168,7 +1168,7 @@ int FixIntel::set_host_affinity(const int nomp) sprintf(cmd, "lscpu -p | grep -v '#' |" "sort -t, -k 3,3n -k 2,2n | awk -F, '{print $1}'"); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; ncores = 0; while(fgets(readbuf, 512, p)) { proc_list[ncores] = atoi(readbuf); @@ -1190,7 +1190,7 @@ int FixIntel::set_host_affinity(const int nomp) int nthreads = nomp; if (nthreads == 0) { estring = getenv("OMP_NUM_THREADS"); - if (estring != NULL) { + if (estring != nullptr) { nthreads = atoi(estring); if (nthreads < 2) nthreads = 1; } else @@ -1222,7 +1222,7 @@ int FixIntel::set_host_affinity(const int nomp) if (coi_cores) { sprintf(cmd, "ps -Lp %d -o lwp | awk ' (NR > 2) {print}'", pid); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); @@ -1258,7 +1258,7 @@ int FixIntel::set_host_affinity(const int nomp) free(buf1); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); diff --git a/src/USER-INTEL/fix_intel.h b/src/USER-INTEL/fix_intel.h index 4c50164d31..df3aecbc81 100644 --- a/src/USER-INTEL/fix_intel.h +++ b/src/USER-INTEL/fix_intel.h @@ -167,8 +167,8 @@ class FixIntel : public Fix { inline void zero_timers() {} inline void start_watch(const int /*which*/) {} inline double stop_watch(const int /*which*/) { return 0.0; } - double * off_watch_pair() { return NULL; } - double * off_watch_neighbor() { return NULL; } + double * off_watch_pair() { return nullptr; } + double * off_watch_neighbor() { return nullptr; } inline void balance_stamp() {} inline void acc_timers() {} inline int separate_buffers() { return 0; } diff --git a/src/USER-INTEL/improper_cvff_intel.h b/src/USER-INTEL/improper_cvff_intel.h index 812b49d50c..94aa29c55f 100644 --- a/src/USER-INTEL/improper_cvff_intel.h +++ b/src/USER-INTEL/improper_cvff_intel.h @@ -62,7 +62,7 @@ class ImproperCvffIntel : public ImproperCvff { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/improper_harmonic_intel.h b/src/USER-INTEL/improper_harmonic_intel.h index 6d7c829961..ce1da11a33 100644 --- a/src/USER-INTEL/improper_harmonic_intel.h +++ b/src/USER-INTEL/improper_harmonic_intel.h @@ -62,7 +62,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index dc5b0fad5a..168074eb3e 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -123,9 +123,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, _buf_local_size = static_cast(nlocal) * 1.1 + 1; const int f_stride = get_stride(_buf_local_size); lmp->memory->create(_x, _buf_size,"intel_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_q, _buf_size, "intel_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_quat, _buf_size, "intel_quat"); #ifdef _LMP_INTEL_OFFLOAD if (lmp->force->newton_pair) @@ -139,9 +139,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) { lmp->memory->create(_host_x, _buf_size,"intel_host_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_host_q, _buf_size, "intel_host_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_host_quat, _buf_size, "intel_host_quat"); } @@ -154,24 +154,24 @@ void IntelBuffers::_grow(const int nall, const int nlocal, const flt_t * const q = get_q(); const vec3_acc_t * f_start = get_off_f(); acc_t * ev_global = get_ev_global(); - if (lmp->atom->q != NULL) { - if (x != NULL && q != NULL && f_start != NULL && ev_global != NULL) { + if (lmp->atom->q != nullptr) { + if (x != nullptr && q != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x,q:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } else { - if (x != NULL && f_start != NULL && ev_global != NULL) { + if (x != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } - if (lmp->atom->ellipsoid != NULL) { + if (lmp->atom->ellipsoid != nullptr) { const quat_t * const quat = get_quat(); - if (quat != NULL) { + if (quat != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(quat:length(_buf_size) alloc_if(1) free_if(0)) } @@ -252,7 +252,7 @@ void IntelBuffers::free_list_local() int * cnumneigh = _neigh_list_ptrs[0].cnumneigh; _neigh_list_ptrs[0].cnumneigh = 0; #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cnumneigh:alloc_if(0) free_if(1)) } @@ -261,11 +261,11 @@ void IntelBuffers::free_list_local() } #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { const int * ilist = _off_map_ilist; const int * numneigh = _off_map_numneigh; const int ** firstneigh = (const int **)_off_map_firstneigh; - _off_map_ilist = NULL; + _off_map_ilist = nullptr; #pragma offload_transfer target(mic:_cop) \ nocopy(ilist,firstneigh,numneigh:alloc_if(0) free_if(1)) } @@ -402,7 +402,7 @@ void IntelBuffers::_grow_nbor_list(NeighList * /*list*/, if (offload_end > 0) { int * list_alloc =_list_alloc; - if (list_alloc != NULL) { + if (list_alloc != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(list_alloc:length(list_alloc_size) alloc_if(1) free_if(0)) _off_list_alloc = true; @@ -497,8 +497,8 @@ void IntelBuffers::grow_ccache(const int off_flag, int *ccachei = _ccachei; int *ccachej = _ccachej; - if (ccachex != NULL && ccachey !=NULL && ccachez != NULL && - ccachew != NULL && ccachei != NULL && ccachej !=NULL) { + if (ccachex != nullptr && ccachey !=nullptr && ccachez != nullptr && + ccachew != nullptr && ccachei != nullptr && ccachej !=nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachex,ccachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ccachez,ccachew:length(vsize) alloc_if(1) free_if(0)) \ @@ -506,7 +506,7 @@ void IntelBuffers::grow_ccache(const int off_flag, in(ccachej:length(vsize) alloc_if(1) free_if(0)) } #ifdef LMP_USE_AVXCD - if (ccachef != NULL) { + if (ccachef != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachef:length(_ccache_stride3 * nt) alloc_if(1) free_if(0)) } @@ -595,8 +595,8 @@ void IntelBuffers::grow_ncache(const int off_flag, int *ncachej = _ncachej; int *ncachejtype = _ncachejtype; - if (ncachex != NULL && ncachey !=NULL && ncachez != NULL && - ncachej != NULL && ncachejtype != NULL) { + if (ncachex != nullptr && ncachey !=nullptr && ncachez != nullptr && + ncachej != nullptr && ncachejtype != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ncachex,ncachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ncachez,ncachej:length(vsize) alloc_if(1) free_if(0)) \ @@ -674,13 +674,13 @@ void IntelBuffers::set_ntypes(const int ntypes, #ifdef _LMP_INTEL_OFFLOAD flt_t * cutneighsqo = _cutneighsq[0]; const int ntypes2 = ntypes * ntypes; - if (_off_threads > 0 && cutneighsqo != NULL) { + if (_off_threads > 0 && cutneighsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighsqo:length(ntypes2) alloc_if(1) free_if(0)) } if (use_ghost_cut) { flt_t * cutneighghostsqo = _cutneighghostsq[0]; - if (_off_threads > 0 && cutneighghostsqo != NULL) { + if (_off_threads > 0 && cutneighghostsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighghostsqo:length(ntypes2) alloc_if(1) free_if(0)) } diff --git a/src/USER-INTEL/intel_buffers.h b/src/USER-INTEL/intel_buffers.h index f3c07da7c2..86fc921c9e 100644 --- a/src/USER-INTEL/intel_buffers.h +++ b/src/USER-INTEL/intel_buffers.h @@ -211,7 +211,7 @@ class IntelBuffers { _x[i].z = lmp->atom->x[i][2]; _x[i].w = lmp->atom->type[i]; } - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) #if defined(LMP_SIMD_COMPILER) #pragma vector aligned #pragma ivdep @@ -296,7 +296,7 @@ class IntelBuffers { _host_x[nall].y = INTEL_BIGP; _host_x[nall].z = INTEL_BIGP; _host_x[nall].w = 1; - if (lmp->atom->q != NULL) { + if (lmp->atom->q != nullptr) { memcpy(_host_q + host_min_local, _q + host_min_local, used_local * sizeof(flt_t)); memcpy(_host_q + host_min_local + used_local, _q + host_min_ghost, diff --git a/src/USER-INTEL/intel_preprocess.h b/src/USER-INTEL/intel_preprocess.h index 2515e47c52..3e547b58a0 100644 --- a/src/USER-INTEL/intel_preprocess.h +++ b/src/USER-INTEL/intel_preprocess.h @@ -528,7 +528,7 @@ inline double MIC_Wtime() { double time; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); time = 1.0 * tv.tv_sec + 1.0e-6 * tv.tv_usec; return time; } diff --git a/src/USER-INTEL/nbin_intel.cpp b/src/USER-INTEL/nbin_intel.cpp index 4a046bc845..9dfc3b8995 100644 --- a/src/USER-INTEL/nbin_intel.cpp +++ b/src/USER-INTEL/nbin_intel.cpp @@ -35,8 +35,8 @@ NBinIntel::NBinIntel(LAMMPS *lmp) : NBinStandard(lmp) { "The 'package intel' command is required for /intel styles"); _fix = static_cast(modify->fix[ifix]); _precision_mode = _fix->precision(); - _atombin = NULL; - _binpacked = NULL; + _atombin = nullptr; + _binpacked = nullptr; #ifdef _LMP_INTEL_OFFLOAD _cop = _fix->coprocessor_number(); _offload_alloc = 0; diff --git a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp index bd4a95f774..737c2d1333 100644 --- a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp @@ -119,8 +119,8 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular) { diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index 9aae0d27b7..392e7bd8c4 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -125,8 +125,8 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular) { diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index 6b576220fe..d5192f2008 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -159,10 +159,10 @@ void aut_frebo(KernelArgsAIREBOT * ka, int torsion_flag); PairAIREBOIntel::PairAIREBOIntel(LAMMPS *lmp) : PairAIREBO(lmp) { suffix_flag |= Suffix::INTEL; - REBO_cnumneigh = NULL; - REBO_num_skin = NULL; - REBO_list_data = NULL; - fix = NULL; + REBO_cnumneigh = nullptr; + REBO_num_skin = nullptr; + REBO_list_data = nullptr; + fix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -697,7 +697,7 @@ inline flt_t gSpline(KernelArgsAIREBOT * ka, int itype, flt_t cos, flt_t NCmin = ka->params.NCmin; flt_t NCmax = ka->params.NCmax; int index = 0; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; int offs = 0; if (itype == 0) { @@ -921,7 +921,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, if (pass == 0) { sum_pij += wik * g * ex_lam; sum_dpij_dN += wik * dgdN * ex_lam; - flt_t cutN = Sp(Nki, Nmin, Nmax, NULL); + flt_t cutN = Sp(Nki, Nmin, Nmax, nullptr); *sum_N += (1 - ktype) * wik * cutN; } else { flt_t tmp = -0.5 * pij * pij * pij; @@ -1583,9 +1583,9 @@ void ref_rebo_neigh(KernelArgsAIREBOT * ka) { flt_t rcmin = ka->params.rcmin[itype][jtype]; flt_t rcmax = ka->params.rcmax[itype][jtype]; if (jtype == CARBON) - ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); else - ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); } } ka->neigh_rebo.num[i] = n; @@ -2408,7 +2408,7 @@ static fvec aut_mask_gSpline_pd_2(KernelArgsAIREBOT * ka, bvec /*active_mask*/, int itype, fvec cosjik, fvec Nij, fvec *dgdc, fvec *dgdN) { int i; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; ivec offs = ivec::setzero(); fvec NCmin = fvec::set1(ka->params.NCmin); diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index a67db0ad32..41af529cab 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -502,8 +502,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -531,8 +531,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.h b/src/USER-INTEL/pair_buck_coul_cut_intel.h index 7204323903..4bc19ac157 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.h +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.h @@ -72,7 +72,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { c_cut_t **c_cut; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index d0cb1837c9..11ee79e5f2 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -617,10 +617,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -662,10 +662,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.h b/src/USER-INTEL/pair_buck_coul_long_intel.h index ec37c699c8..95492cd4e6 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.h +++ b/src/USER-INTEL/pair_buck_coul_long_intel.h @@ -73,7 +73,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index bb5b44d260..b4f57d2fae 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -449,8 +449,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: alloc_if(0) free_if(1)) \ @@ -473,8 +473,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_intel.h b/src/USER-INTEL/pair_buck_intel.h index ab5e135262..0e473c7c3f 100644 --- a/src/USER-INTEL/pair_buck_intel.h +++ b/src/USER-INTEL/pair_buck_intel.h @@ -69,7 +69,7 @@ private: c_energy_t **c_energy; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_dpd_intel.cpp b/src/USER-INTEL/pair_dpd_intel.cpp index 690496d546..40b6c891d0 100644 --- a/src/USER-INTEL/pair_dpd_intel.cpp +++ b/src/USER-INTEL/pair_dpd_intel.cpp @@ -37,7 +37,7 @@ PairDPDIntel::PairDPDIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - random_thread = NULL; + random_thread = nullptr; _nrandom_thread = 0; } diff --git a/src/USER-INTEL/pair_dpd_intel.h b/src/USER-INTEL/pair_dpd_intel.h index bce90a36b6..409e123f29 100644 --- a/src/USER-INTEL/pair_dpd_intel.h +++ b/src/USER-INTEL/pair_dpd_intel.h @@ -83,7 +83,7 @@ class PairDPDIntel : public PairDPD { int *rngi; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index 084714daf4..b93c9bc8c0 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 8786c0d782..2165f10aff 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -69,7 +69,7 @@ void PairEAMFSIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_intel.h b/src/USER-INTEL/pair_eam_intel.h index a9590f6b3d..b9ad11597a 100644 --- a/src/USER-INTEL/pair_eam_intel.h +++ b/src/USER-INTEL/pair_eam_intel.h @@ -76,7 +76,7 @@ class PairEAMIntel : public PairEAM { fc_packed2 *z2r_spline_t; ForceConst() : _ntypes(0), _nr(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index 30e61f67b9..423631ae87 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -958,7 +958,7 @@ void PairGayBerneIntel::pack_force_const(ForceConst &fc, FC_PACKED2_T *olj34 = fc.lj34[0]; FC_PACKED3_T *oic = fc.ic; int tp1sq = tp1 * tp1; - if (oijc != NULL && oic != NULL) { + if (oijc != nullptr && oic != nullptr) { #pragma offload_transfer target(mic:_cop) \ in(special_lj: length(4) alloc_if(0) free_if(0)) \ in(oijc,olj34: length(tp1sq) alloc_if(0) free_if(0)) \ @@ -990,9 +990,9 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int * ojtype_form = jtype_form[0]; int * ojlist_form = jlist_form[0]; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - orsq_form != NULL && odelx_form != NULL && odely_form != NULL && - odelz_form != NULL && ojtype_form != NULL && ojlist_form != NULL && + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + orsq_form != nullptr && odelx_form != nullptr && odely_form != nullptr && + odelz_form != nullptr && ojtype_form != nullptr && ojlist_form != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(ospecial_lj, oijc, olj34, oic: alloc_if(0) free_if(1)) \ @@ -1048,10 +1048,10 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int off_onel = one_length * nthreads; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - oic != NULL && orsq_form != NULL && odelx_form != NULL && - odely_form != NULL && odelz_form != NULL && ojtype_form !=NULL && - ojlist_form !=NULL && cop >= 0) { + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + oic != nullptr && orsq_form != nullptr && odelx_form != nullptr && + odely_form != nullptr && odelz_form != nullptr && ojtype_form !=nullptr && + ojlist_form !=nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(oijc,olj34: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_gayberne_intel.h b/src/USER-INTEL/pair_gayberne_intel.h index 07dfba14d1..ecdd93d353 100644 --- a/src/USER-INTEL/pair_gayberne_intel.h +++ b/src/USER-INTEL/pair_gayberne_intel.h @@ -74,7 +74,7 @@ class PairGayBerneIntel : public PairGayBerne { int **jtype_form, **jlist_form; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index c8e4a3d0ef..71f2e24557 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -555,8 +555,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ospecial_coul = special_coul; flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(ocutsq, olj: alloc_if(0) free_if(1)) @@ -577,8 +577,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h index a48a84b5ce..006dbaade2 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -69,7 +69,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { typename IntelBuffers::vec4_t **lj; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index 5a4069e199..8f106d8607 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -38,7 +38,7 @@ PairLJCharmmCoulLongIntel::PairLJCharmmCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -652,9 +652,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable != NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable != nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -693,9 +693,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable !=NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable !=nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h index 31b2182cb5..f5b46eaf76 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h @@ -72,7 +72,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { typename IntelBuffers::vec2_t **lj; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 34ab97fd35..ead3d5b5b4 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongIntel::PairLJCutCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -611,10 +611,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -652,10 +652,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h index 288a6a7bc4..6172313639 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h @@ -73,7 +73,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index b484cb68d9..281eef52db 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -36,7 +36,7 @@ PairLJCutIntel::PairLJCutIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-INTEL/pair_lj_cut_intel.h b/src/USER-INTEL/pair_lj_cut_intel.h index b577a04658..b88d213211 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.h +++ b/src/USER-INTEL/pair_lj_cut_intel.h @@ -67,7 +67,7 @@ class PairLJCutIntel : public PairLJCut { fc_packed2 **lj34; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp index 533252d018..ccde2d3a57 100644 --- a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp @@ -36,7 +36,7 @@ PairLJLongCoulLongIntel::PairLJLongCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 4ec2af40b0..d2a481a76e 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1277,8 +1277,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; #ifdef _LMP_INTEL_OFFLOAD - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && _cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(op2, op2f, op2f2, op2e, op3: alloc_if(0) free_if(1)) } @@ -1306,8 +1306,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; int tp1sq = ntypes * ntypes; int tp1cu = tp1sq * ntypes; - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(op2,op2f,op2f2,op2e: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(op3: length(tp1cu) alloc_if(1) free_if(0)) diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 5f7a511c9f..f345b3d4ff 100644 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -88,7 +88,7 @@ class PairSWIntel : public PairSW { fc_packed3 ***p3; ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 75f5f85f2d..db24692b6d 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -576,8 +576,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, c_cutoff_t * oc_cutoff_outer = c_cutoff_outer[0]; c_inner_t * oc_inner = c_inner[0][0]; c_outer_t * oc_outer = c_outer[0]; - if (c_first_loop != NULL && c_second_loop != NULL && - c_inner_loop != NULL && _cop >= 0) { + if (c_first_loop != nullptr && c_second_loop != nullptr && + c_inner_loop != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop, oc_second_loop, oc_inner_loop: alloc_if(0) free_if(1)) \ @@ -615,8 +615,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, int tp1sq = ntypes * ntypes; int tp1cb = ntypes * ntypes * ntypes; int tp1cb_pad = ntypes * ntypes * ntypes_pad; - if (oc_first_loop != NULL && oc_second_loop != NULL && - oc_inner_loop != NULL && cop >= 0) { + if (oc_first_loop != nullptr && oc_second_loop != nullptr && + oc_inner_loop != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(oc_second_loop: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_tersoff_intel.h b/src/USER-INTEL/pair_tersoff_intel.h index 6da478c10f..195efa74de 100644 --- a/src/USER-INTEL/pair_tersoff_intel.h +++ b/src/USER-INTEL/pair_tersoff_intel.h @@ -65,7 +65,7 @@ class PairTersoffIntel : public PairTersoff { c_outer_t * * c_outer; c_inner_t * * * c_inner; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 1149c9b2c3..8e958bf23b 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -68,18 +68,18 @@ PPPMDispIntel::PPPMDispIntel(LAMMPS *lmp) : PPPMDisp(lmp) order = 7; order_6 = 7; //sets default stencil sizes to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; - particle_ekx0 = particle_eky0 = particle_ekz0 = NULL; - particle_ekx1 = particle_eky1 = particle_ekz1 = NULL; - particle_ekx2 = particle_eky2 = particle_ekz2 = NULL; - particle_ekx3 = particle_eky3 = particle_ekz3 = NULL; - particle_ekx4 = particle_eky4 = particle_ekz4 = NULL; - particle_ekx5 = particle_eky5 = particle_ekz5 = NULL; - particle_ekx6 = particle_eky6 = particle_ekz6 = NULL; - - rho_lookup = drho_lookup = NULL; - rho6_lookup = drho6_lookup = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; + particle_ekx0 = particle_eky0 = particle_ekz0 = nullptr; + particle_ekx1 = particle_eky1 = particle_ekz1 = nullptr; + particle_ekx2 = particle_eky2 = particle_ekz2 = nullptr; + particle_ekx3 = particle_eky3 = particle_ekz3 = nullptr; + particle_ekx4 = particle_eky4 = particle_ekz4 = nullptr; + particle_ekx5 = particle_eky5 = particle_ekz5 = nullptr; + particle_ekx6 = particle_eky6 = particle_ekz6 = nullptr; + + rho_lookup = drho_lookup = nullptr; + rho6_lookup = drho6_lookup = nullptr; rho_points = 0; _use_table = _use_packing = _use_lrt = 0; diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index d596df4490..1a09522a2a 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -65,10 +65,10 @@ PPPMIntel::PPPMIntel(LAMMPS *lmp) : PPPM(lmp) order = 7; //sets default stencil size to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; - rho_lookup = drho_lookup = NULL; + rho_lookup = drho_lookup = nullptr; rho_points = 0; _use_table = _use_lrt = 0; diff --git a/src/USER-INTEL/verlet_lrt_intel.cpp b/src/USER-INTEL/verlet_lrt_intel.cpp index 4efed0d337..869330eadb 100644 --- a/src/USER-INTEL/verlet_lrt_intel.cpp +++ b/src/USER-INTEL/verlet_lrt_intel.cpp @@ -45,7 +45,7 @@ using namespace LAMMPS_NS; VerletLRTIntel::VerletLRTIntel(LAMMPS *lmp, int narg, char **arg) : Verlet(lmp, narg, arg) { #if defined(_LMP_INTEL_LRT_PTHREAD) - pthread_mutex_init(&_kmutex,NULL); + pthread_mutex_init(&_kmutex,nullptr); #endif } @@ -119,7 +119,7 @@ void VerletLRTIntel::setup(int flag) _kspace_ready = 0; _kspace_done = 0; - pthread_cond_init(&_kcond, NULL); + pthread_cond_init(&_kcond, nullptr); pthread_attr_init(&_kspace_attr); pthread_attr_setdetachstate(&_kspace_attr, PTHREAD_CREATE_JOINABLE); #endif @@ -377,7 +377,7 @@ void VerletLRTIntel::run(int n) _kspace_done = 0; pthread_cond_signal(&_kcond); pthread_mutex_unlock(&_kmutex); - pthread_join(_kspace_thread, NULL); + pthread_join(_kspace_thread, nullptr); pthread_attr_destroy(&_kspace_attr); } #endif @@ -428,8 +428,8 @@ void * VerletLRTIntel::k_launch_loop(void *context) pthread_mutex_unlock(&(c->_kmutex)); } - pthread_exit(NULL); - return NULL; + pthread_exit(nullptr); + return nullptr; } #endif diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index 204a9c073b..652b142b99 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -116,8 +116,8 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setArea = 0; numvel = 15; - Gamma = NULL; - NodeArea = NULL; + Gamma = nullptr; + NodeArea = nullptr; int iarg = 7; while (iarg < narg){ @@ -129,7 +129,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : double areafactor = atof(arg[iarg+2]); if(itype <= 0 || itype > atom->ntypes || areafactor < 0.0) error->all(FLERR,"Illegal fix lb/fluid command: setArea"); - if(NodeArea == NULL){ + if(NodeArea == nullptr){ NodeArea = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; } @@ -142,7 +142,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setGamma = 1; double Gammaone; Gammaone = atof(arg[iarg+1]); - if(Gamma == NULL) + if(Gamma == nullptr) Gamma = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) Gamma[i] = Gammaone; iarg += 2; @@ -240,7 +240,7 @@ a z wall velocity without implementing fixed BCs in z"); // perform initial allocation of atom-based array register // with Atom class //-------------------------------------------------------------------------- - hydroF = NULL; + hydroF = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -248,24 +248,24 @@ a z wall velocity without implementing fixed BCs in z"); for(int j=0; j<3; j++) hydroF[i][j] = 0.0; - Ng_lb = NULL; - w_lb = NULL; - mg_lb = NULL; - e = NULL; - feq = NULL; - feqold = NULL; - feqn = NULL; - feqoldn = NULL; - f_lb = NULL; - fnew = NULL; - density_lb = NULL; - u_lb = NULL; - altogether = NULL; - buf = NULL; - Ff = NULL; - Fftempx = NULL; - Fftempy = NULL; - Fftempz = NULL; + Ng_lb = nullptr; + w_lb = nullptr; + mg_lb = nullptr; + e = nullptr; + feq = nullptr; + feqold = nullptr; + feqn = nullptr; + feqoldn = nullptr; + f_lb = nullptr; + fnew = nullptr; + density_lb = nullptr; + u_lb = nullptr; + altogether = nullptr; + buf = nullptr; + Ff = nullptr; + Fftempx = nullptr; + Fftempy = nullptr; + Fftempz = nullptr; //-------------------------------------------------------------------------- // Set the lattice Boltzmann dt. diff --git a/src/USER-LB/fix_lb_pc.cpp b/src/USER-LB/fix_lb_pc.cpp index 2c7e8dbf47..3c31dc93f4 100644 --- a/src/USER-LB/fix_lb_pc.cpp +++ b/src/USER-LB/fix_lb_pc.cpp @@ -45,9 +45,9 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - force_old = NULL; - up = NULL; - up_old = NULL; + force_old = nullptr; + up = nullptr; + up_old = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index f714e31719..741a23c293 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -54,8 +54,8 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - body = NULL; - up = NULL; + body = nullptr; + up = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index 59fddebd67..602ec29f00 100644 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -88,7 +88,7 @@ void FixLbViscous::init() void FixLbViscous::setup(int vflag) { - if (strstr(update->integrate_style,"verlet") != NULL) + if (strstr(update->integrate_style,"verlet") != nullptr) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 732ba0909e..3193b23d6e 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -76,7 +76,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : } ptr_m->params = new double[nvars]; - if (ptr_m->params == NULL) { + if (ptr_m->params == nullptr) { error->all(FLERR,"Parameter pointer was NULL!"); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index b3122a68d4..abe903125b 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -129,7 +129,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, is_var[i] = 0; } tstrs[i] = new char[len]; - if (tstrs[i] == NULL ) error->all(FLERR,"Error allocating space for args."); + if (tstrs[i] == nullptr ) error->all(FLERR,"Error allocating space for args."); strcpy( tstrs[i], arg[i+6] + offset ); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h index 42da240abc..7ed1f75fa8 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h @@ -125,7 +125,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -136,7 +136,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h index f42902f721..69e4eb13e1 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h @@ -112,7 +112,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -123,7 +123,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/manifold.h b/src/USER-MANIFOLD/manifold.h index b0727c346d..9adf7055c7 100644 --- a/src/USER-MANIFOLD/manifold.h +++ b/src/USER-MANIFOLD/manifold.h @@ -46,7 +46,7 @@ namespace user_manifold { // Abstract base class. class manifold : protected Pointers { public: - manifold(class LAMMPS* lmp) : Pointers(lmp), params(NULL){ } + manifold(class LAMMPS* lmp) : Pointers(lmp), params(nullptr){ } virtual ~manifold(){ delete[] params; } virtual double g( const double * ) = 0; virtual void n( const double *, double * ) = 0; diff --git a/src/USER-MANIFOLD/manifold_factory.cpp b/src/USER-MANIFOLD/manifold_factory.cpp index 7df3e52ed7..fe9b7615b3 100644 --- a/src/USER-MANIFOLD/manifold_factory.cpp +++ b/src/USER-MANIFOLD/manifold_factory.cpp @@ -54,7 +54,7 @@ manifold* LAMMPS_NS::user_manifold::create_manifold(const char *mname, LAMMPS *lmp, int narg, char **arg ) { - manifold *man = NULL; + manifold *man = nullptr; make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); diff --git a/src/USER-MANIFOLD/manifold_factory.h b/src/USER-MANIFOLD/manifold_factory.h index 85ee4011be..1eac8bf644 100644 --- a/src/USER-MANIFOLD/manifold_factory.h +++ b/src/USER-MANIFOLD/manifold_factory.h @@ -94,7 +94,7 @@ class manifold; LAMMPS *lmp, int narg, char **arg ) { if( strcmp( m_type::type(), name ) == 0 ){ - if( *man_ptr == NULL ){ + if( *man_ptr == nullptr ){ *man_ptr = new m_type(lmp, narg, arg); } } diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index ef26999295..7b0d7d4d3a 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -136,7 +136,7 @@ public: // Manifold itself: manifold_gaussian_bump::manifold_gaussian_bump(class LAMMPS* lmp, int /*narg*/, char **/*arg*/) - : manifold(lmp), lut_z(NULL), lut_zp(NULL) {} + : manifold(lmp), lut_z(nullptr), lut_zp(nullptr) {} manifold_gaussian_bump::~manifold_gaussian_bump() diff --git a/src/USER-MANIFOLD/manifold_thylakoid.cpp b/src/USER-MANIFOLD/manifold_thylakoid.cpp index ee86a50bf2..a1d2c7a62f 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid.cpp @@ -123,14 +123,14 @@ thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_fla for( std::size_t i = 0; i < parts.size(); ++i ){ thyla_part *p = parts[i]; if (is_in_domain(p,x)) { - if (idx != NULL) *idx = i; + if (idx != nullptr) *idx = i; return p; } } char msg[2048]; sprintf(msg,"Could not find thyla_part for x = (%f,%f,%f)", x[0],x[1],x[2]); error->one(FLERR,msg); - return NULL; + return nullptr; } diff --git a/src/USER-MANIFOLD/manifold_thylakoid.h b/src/USER-MANIFOLD/manifold_thylakoid.h index 35ad4dfd9c..d3ffa67765 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.h +++ b/src/USER-MANIFOLD/manifold_thylakoid.h @@ -29,7 +29,7 @@ namespace user_manifold { private: void init_domains(); - thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = NULL ); + thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = nullptr ); int is_in_domain( thyla_part *p, const double *x ); void check_overlap(); std::vector parts; diff --git a/src/USER-MEAMC/meam_impl.cpp b/src/USER-MEAMC/meam_impl.cpp index a546aa0c7f..147be92463 100644 --- a/src/USER-MEAMC/meam_impl.cpp +++ b/src/USER-MEAMC/meam_impl.cpp @@ -28,15 +28,15 @@ using namespace LAMMPS_NS; MEAM::MEAM(Memory* mem) : memory(mem) { - phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = NULL; + phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = nullptr; nmax = 0; - rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL; - gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL; - arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = NULL; + rho = rho0 = rho1 = rho2 = rho3 = frhop = nullptr; + gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = nullptr; + arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = nullptr; maxneigh = 0; - scrfcn = dscrfcn = fcpair = NULL; + scrfcn = dscrfcn = fcpair = nullptr; neltypes = 0; for (int i = 0; i < maxelt; i++) { diff --git a/src/USER-MEAMC/meam_setup_done.cpp b/src/USER-MEAMC/meam_setup_done.cpp index ddbb40310c..f8703f10e5 100644 --- a/src/USER-MEAMC/meam_setup_done.cpp +++ b/src/USER-MEAMC/meam_setup_done.cpp @@ -186,21 +186,21 @@ MEAM::compute_pair_meam(void) double C, s111, s112, s221, S11, S22; // check for previously allocated arrays and free them - if (this->phir != NULL) + if (this->phir != nullptr) memory->destroy(this->phir); - if (this->phirar != NULL) + if (this->phirar != nullptr) memory->destroy(this->phirar); - if (this->phirar1 != NULL) + if (this->phirar1 != nullptr) memory->destroy(this->phirar1); - if (this->phirar2 != NULL) + if (this->phirar2 != nullptr) memory->destroy(this->phirar2); - if (this->phirar3 != NULL) + if (this->phirar3 != nullptr) memory->destroy(this->phirar3); - if (this->phirar4 != NULL) + if (this->phirar4 != nullptr) memory->destroy(this->phirar4); - if (this->phirar5 != NULL) + if (this->phirar5 != nullptr) memory->destroy(this->phirar5); - if (this->phirar6 != NULL) + if (this->phirar6 != nullptr) memory->destroy(this->phirar6); // allocate memory for array that defines the potential diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 6f674c9f45..133bb611ca 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -56,10 +56,10 @@ PairMEAMC::PairMEAMC(LAMMPS *lmp) : Pair(lmp) allocated = 0; nelements = 0; - elements = NULL; - mass = NULL; + elements = nullptr; + mass = nullptr; meam_inst = new MEAM(memory); - scale = NULL; + scale = nullptr; // set comm size needed by this Pair @@ -161,7 +161,7 @@ void PairMEAMC::compute(int eflag, int vflag) double **vptr; if (vflag_atom) vptr = vatom; - else vptr = NULL; + else vptr = nullptr; for (ii = 0; ii < inum_half; ii++) { i = ilist_half[ii]; @@ -365,7 +365,7 @@ void PairMEAMC::read_files(const std::string &globalfile, FILE *fp; if (comm->me == 0) { fp = utils::open_potential(globalfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", globalfile)); } @@ -408,7 +408,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (1) { char *ptr; ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -424,7 +424,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (nwords < params_per_line) { int n = strlen(line); ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -440,7 +440,7 @@ void PairMEAMC::read_files(const std::string &globalfile, nwords = 0; words[nwords++] = strtok(line,"' \t\n\r\f"); - while ((words[nwords++] = strtok(NULL,"' \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr,"' \t\n\r\f"))) continue; // skip if element name isn't in element list @@ -556,7 +556,7 @@ void PairMEAMC::read_files(const std::string &globalfile, delete [] rozero; delete [] found; - // done if user param file is NULL + // done if user param file is nullptr if (userfile == "NULL") return; @@ -564,7 +564,7 @@ void PairMEAMC::read_files(const std::string &globalfile, if (comm->me == 0) { fp = utils::open_potential(userfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", userfile)); } @@ -584,7 +584,7 @@ void PairMEAMC::read_files(const std::string &globalfile, char *ptr; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); nline = -1; } else nline = strlen(line) + 1; @@ -603,7 +603,7 @@ void PairMEAMC::read_files(const std::string &globalfile, int nparams = 0; params[nparams++] = strtok(line,"=(), '\t\n\r\f"); while (nparams < maxparams && - (params[nparams++] = strtok(NULL,"=(), '\t\n\r\f"))) + (params[nparams++] = strtok(nullptr,"=(), '\t\n\r\f"))) continue; nparams--; @@ -837,5 +837,5 @@ void *PairMEAMC::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MESODPD/compute_edpd_temp_atom.cpp b/src/USER-MESODPD/compute_edpd_temp_atom.cpp index 9eb6e9752b..02aa3e7311 100644 --- a/src/USER-MESODPD/compute_edpd_temp_atom.cpp +++ b/src/USER-MESODPD/compute_edpd_temp_atom.cpp @@ -34,7 +34,7 @@ ComputeEDPDTempAtom::ComputeEDPDTempAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - temp_vector = NULL; + temp_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp index 7e9d5eb29e..d87d645b6e 100644 --- a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp +++ b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp @@ -38,7 +38,7 @@ ComputeTDPDCCAtom::ComputeTDPDCCAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - cc_vector = NULL; + cc_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index 9c2e74b882..36ad434f42 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -65,8 +65,8 @@ PairEDPD::PairEDPD(LAMMPS *lmp) : Pair(lmp) { if (lmp->citeme) lmp->citeme->add(cite_pair_edpd); writedata = 1; - random = NULL; - randomT = NULL; + random = nullptr; + randomT = nullptr; } /* ---------------------------------------------------------------------- */ @@ -453,24 +453,24 @@ void PairEDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,nullptr,error); if(power_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,nullptr,error); if(kappa_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -508,9 +508,9 @@ void PairEDPD::write_restart_settings(FILE *fp) void PairEDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 88b6724a03..62a2ca8d1c 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -54,7 +54,7 @@ PairMDPD::PairMDPD(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_pair_mdpd); writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -348,15 +348,15 @@ void PairMDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&A_att[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&B_rep[i][j],1,MPI_DOUBLE,0,world); @@ -386,10 +386,10 @@ void PairMDPD::write_restart_settings(FILE *fp) void PairMDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index 65a518c07e..b1ffb5ce8d 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -57,7 +57,7 @@ PairTDPD::PairTDPD(LAMMPS *lmp) : Pair(lmp) cc_species = atom->cc_species; writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -395,19 +395,19 @@ void PairTDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,nullptr,error); for(int k=0; kme == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESONT/compute_mesont.cpp b/src/USER-MESONT/compute_mesont.cpp index 96792c8988..0321be7c56 100644 --- a/src/USER-MESONT/compute_mesont.cpp +++ b/src/USER-MESONT/compute_mesont.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeMesoNT::ComputeMesoNT(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), energy(NULL) { + Compute(lmp, narg, arg), energy(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute mesont command"); std::string ctype = arg[3]; if (ctype == "estretch") compute_type = ES; @@ -62,7 +62,7 @@ double ComputeMesoNT::compute_scalar() { error->all(FLERR,"Energy was not tallied on needed timestep"); int i; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es_tot",i)); else if (compute_type == EB) @@ -104,7 +104,7 @@ void ComputeMesoNT::compute_peratom() { int i; // clear local energy array for (int i = 0; i < ntotal; i++) energy[i] = 0.0; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es",i)); else if (compute_type == EB) diff --git a/src/USER-MESONT/pair_mesocnt.cpp b/src/USER-MESONT/pair_mesocnt.cpp index 96d53bd41a..a7b4bf0575 100644 --- a/src/USER-MESONT/pair_mesocnt.cpp +++ b/src/USER-MESONT/pair_mesocnt.cpp @@ -244,7 +244,7 @@ void PairMesoCNT::compute(int eflag, int vflag) // infinite CNT case if (endflag == 0) { - geometry(r1,r2,p1,p2,NULL,p,m,param,basis); + geometry(r1,r2,p1,p2,nullptr,p,m,param,basis); if (param[0] > cutoff) continue; finf(param,evdwl,flocal); @@ -760,7 +760,7 @@ void PairMesoCNT::read_file() // open file fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open mesocnt file: {}",file)); utils::sfgets(FLERR,line,MAXLINE,fp,file,error); @@ -846,7 +846,7 @@ void PairMesoCNT::read_data(FILE *fp, double *data, double x,xtemp,dxtemp; for (int i = 0; i < ninput; i++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (i > 0) xtemp = x; @@ -899,7 +899,7 @@ void PairMesoCNT::read_data(FILE *fp, double **data, for (int i = 0; i < ninput; i++) { if (i > 0) xtemp = x; for (int j = 0; j < ninput; j++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (j > 0) ytemp = y; diff --git a/src/USER-MESONT/pair_mesont_tpm.cpp b/src/USER-MESONT/pair_mesont_tpm.cpp index 6d8c8126ae..4e5f31c661 100644 --- a/src/USER-MESONT/pair_mesont_tpm.cpp +++ b/src/USER-MESONT/pair_mesont_tpm.cpp @@ -166,7 +166,7 @@ void vector_union(std::vector& v1, std::vector& v2, } MESONTList::MESONTList(const Atom* atom, const NeighList* nblist, double /* rc2 */){ - if (atom == NULL || nblist == NULL) return; + if (atom == nullptr || nblist == nullptr) return; //number of local atoms at the node int nlocal = atom->nlocal; //total number of atoms in the node and ghost shell @@ -305,12 +305,12 @@ PairMESONTTPM::PairMESONTTPM(LAMMPS *lmp) : Pair(lmp) { writedata=1; BendingMode = 0; // Harmonic bending model TPMType = 0; // Inter-tube segment-segment interaction - tab_path = NULL; + tab_path = nullptr; tab_path_length = 0; - eatom_s = NULL; - eatom_b = NULL; - eatom_t = NULL; + eatom_s = nullptr; + eatom_b = nullptr; + eatom_t = nullptr; instance_count++; if(instance_count > 1) error->all(FLERR, "only a single instance of mesont/tpm pair style can be created"); @@ -330,7 +330,7 @@ PairMESONTTPM::~PairMESONTTPM() memory->destroy(eatom_t); } instance_count--; - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); } /* ---------------------------------------------------------------------- */ @@ -597,7 +597,7 @@ void PairMESONTTPM::settings(int narg, char **arg){ } std::string TPMAFile = (narg > 1) ? arg[1] : "MESONT-TABTP.xrs"; tab_path_length = TPMAFile.length(); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); //c_str returns '\0' terminated string memory->create(tab_path,tab_path_length+1,"pair:path"); std::memcpy(tab_path, TPMAFile.c_str(), tab_path_length+1); @@ -738,7 +738,7 @@ void PairMESONTTPM::read_restart_settings(FILE *fp){ MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&tab_path_length,1,MPI_INT,0,world); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); memory->create(tab_path,tab_path_length+1,"pair:path"); if (me == 0) fread(tab_path,tab_path_length+1,1,fp); MPI_Bcast(tab_path,tab_path_length+1,MPI_CHAR,0,world); @@ -793,5 +793,5 @@ void* PairMESONTTPM::extract(const char *str, int &){ else if (strcmp(str,"mesonttpm_Es") == 0) return eatom_s; else if (strcmp(str,"mesonttpm_Eb") == 0) return eatom_b; else if (strcmp(str,"mesonttpm_Et") == 0) return eatom_t; - else return NULL; + else return nullptr; }; diff --git a/src/USER-MGPT/mgpt_readpot.cpp b/src/USER-MGPT/mgpt_readpot.cpp index 144c661b05..c5f7c75d73 100644 --- a/src/USER-MGPT/mgpt_readpot.cpp +++ b/src/USER-MGPT/mgpt_readpot.cpp @@ -66,7 +66,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub FILE *in = fopen(potin_file,"r"); char line[1024]; - if(in == NULL) { + if(in == nullptr) { fprintf(stderr,"@%s:%d: Error reading potin file. Can not open file \'%s\'.\n", __FILE__,__LINE__,potin_file); exit(1); @@ -75,7 +75,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub vsize = 10; volarr = (double *) malloc(sizeof(double) * vsize); n = 0; - while(fgets(line,sizeof(line),in) != NULL) { + while(fgets(line,sizeof(line),in) != nullptr) { double zval,ivol,rws,mass; double r0x,r1x,drx; int nrx,i; @@ -408,7 +408,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; if(0) if(fabs(vol-ivol) < 0.01) { - static FILE *xfile = NULL; + static FILE *xfile = nullptr; if(j == 0) { xfile = fopen("mgpt5-pot.dat","w"); fprintf(xfile,"%%%% vol = %15.5e ivol = %15.5e i = %d ii = %d\n", diff --git a/src/USER-MGPT/mgpt_readpot.h b/src/USER-MGPT/mgpt_readpot.h index 8f46592e8a..c2a6feabe0 100644 --- a/src/USER-MGPT/mgpt_readpot.h +++ b/src/USER-MGPT/mgpt_readpot.h @@ -172,7 +172,7 @@ struct potdata2 { strcpy(s,nametemplate); p = strchr(s,'{'); - if(p != NULL) { + if(p != nullptr) { if(sscanf(p+1,"%d:%d:%d",i0,stride,i1) != 3) { fprintf(stderr,"Error in template (\'%s\'), can not parse range.\n",nametemplate); exit(1); @@ -217,12 +217,12 @@ struct potdata2 { const char *parmin_suffix = strchr(parmin_template,'}')+1; const char * potin_suffix = strchr( potin_template,'}')+1; - if(parmin_suffix-1 == NULL) { + if(parmin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. parmin_template=\'%s\'\n", parmin_template); exit(1); } - if(potin_suffix-1 == NULL) { + if(potin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. potin_template=\'%s\'\n", potin_template); exit(1); diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 070e3cb61e..dd48295357 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -54,7 +54,7 @@ static double gettime(int x = 0) { if(1) { /* struct timeval tv; - gettimeofday(&tv,NULL); + gettimeofday(&tv,nullptr); return tv.tv_sec + 1e-6 * tv.tv_usec; */ /* @@ -1859,7 +1859,7 @@ void PairMGPT::coeff(int narg, char **arg) if(strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { nbody_flag = 0; for(int i = 0; i<4; i++) - if(strchr(arg[iarg+1],'1'+i) != NULL) { + if(strchr(arg[iarg+1],'1'+i) != nullptr) { nbody_flag = nbody_flag + (1<me == 0) printf("Explicitly adding %d-tuple forces.\n",i+1); } @@ -1906,7 +1906,7 @@ void PairMGPT::coeff(int narg, char **arg) if(comm->me == 0) { FILE *parmin_fp = utils::open_potential(arg[2],lmp,nullptr); FILE *potin_fp = utils::open_potential(arg[3],lmp,nullptr); - if (parmin_fp == NULL || potin_fp == NULL) { + if (parmin_fp == nullptr || potin_fp == nullptr) { char str[128]; sprintf(str,"Cannot open MGPT potential files %s %s",arg[2],arg[3]); error->one(FLERR,str); diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index a986cb8322..f6427171a7 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -37,7 +37,7 @@ using namespace MathConst; AngleCosineShift::AngleCosineShift(LAMMPS *lmp) : Angle(lmp) { - kcost = NULL; + kcost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -225,10 +225,10 @@ void AngleCosineShift::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&kcost[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index 52bfe751f1..9e98c319f4 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -37,13 +37,13 @@ using namespace MathConst; AngleCosineShiftExp::AngleCosineShiftExp(LAMMPS *lmp) : Angle(lmp) { - doExpansion = NULL; - umin = NULL; - a = NULL; - opt1 = NULL; - theta0 = NULL; - sint = NULL; - cost = NULL; + doExpansion = nullptr; + umin = nullptr; + a = nullptr; + opt1 = nullptr; + theta0 = nullptr; + sint = nullptr; + cost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -257,11 +257,11 @@ void AngleCosineShiftExp::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index 336638f25d..6715bd1186 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -35,8 +35,8 @@ using namespace MathConst; AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - gamma0 = NULL; + k = nullptr; + gamma0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -206,8 +206,8 @@ void AngleDipole::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&gamma0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index 907ee973bd..fc14736a07 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -38,10 +38,10 @@ using namespace MathConst; AngleFourier::AngleFourier(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C0 = NULL; - C1 = NULL; - C2 = NULL; + k = nullptr; + C0 = nullptr; + C1 = nullptr; + C2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -232,10 +232,10 @@ void AngleFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index 8894f7b4c9..abd02535cf 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -38,9 +38,9 @@ using namespace MathConst; AngleFourierSimple::AngleFourierSimple(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C = NULL; - N = NULL; + k = nullptr; + C = nullptr; + N = nullptr; } /* ---------------------------------------------------------------------- */ @@ -238,9 +238,9 @@ void AngleFourierSimple::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 93f45f9562..50a73af7b5 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -233,10 +233,10 @@ void AngleQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&k3[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index 5889400b97..28badce911 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -177,9 +177,9 @@ void BondHarmonicShift::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index 86e6263f93..b875fb71b2 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -179,9 +179,9 @@ void BondHarmonicShiftCut::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_special.cpp b/src/USER-MISC/bond_special.cpp index 87671655b1..4f79fea519 100644 --- a/src/USER-MISC/bond_special.cpp +++ b/src/USER-MISC/bond_special.cpp @@ -44,7 +44,7 @@ BondSpecial::~BondSpecial() void BondSpecial::init_style() { - if (force->pair == NULL) error->all(FLERR,"No pair style defined"); + if (force->pair == nullptr) error->all(FLERR,"No pair style defined"); else if ((force->pair->single_enable == 0) || force->pair->manybody_flag) error->all(FLERR,"Pair style does not support bond style special"); @@ -59,7 +59,7 @@ void BondSpecial::init_style() force->special_coul[3] != 1.0)) error->all(FLERR,"Invalid 1-4 setting for bond style special."); - if (force->kspace != NULL) + if (force->kspace != nullptr) error->all(FLERR,"Bond style special is not compatible with long range " "Coulombic interactions"); } diff --git a/src/USER-MISC/compute_ackland_atom.cpp b/src/USER-MISC/compute_ackland_atom.cpp index bcf41591eb..df0636d7b9 100644 --- a/src/USER-MISC/compute_ackland_atom.cpp +++ b/src/USER-MISC/compute_ackland_atom.cpp @@ -48,13 +48,13 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - structure = NULL; + structure = nullptr; maxneigh = 0; legacy = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; int iarg = 3; while (narg > iarg) { diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index 3b9b38343d..fa59a02575 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -44,12 +44,12 @@ ComputeBasalAtom::ComputeBasalAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 3; nmax = 0; - BPV = NULL; + BPV = nullptr; maxneigh = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/compute_cnp_atom.cpp b/src/USER-MISC/compute_cnp_atom.cpp index 52656ec9d6..5efab292b5 100644 --- a/src/USER-MISC/compute_cnp_atom.cpp +++ b/src/USER-MISC/compute_cnp_atom.cpp @@ -49,7 +49,7 @@ enum{NCOMMON}; ComputeCNPAtom::ComputeCNPAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), cnpv(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), cnpv(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cnp/atom command"); @@ -92,7 +92,7 @@ ComputeCNPAtom::~ComputeCNPAtom() void ComputeCNPAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cnp/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index d539d51e99..2a308c427f 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -40,7 +40,7 @@ using namespace MathConst; ComputeEntropyAtom:: ComputeEntropyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pair_entropy(NULL), pair_entropy_avg(NULL) + pair_entropy(nullptr), pair_entropy_avg(nullptr) { if (narg < 5 || narg > 10) error->all(FLERR,"Illegal compute entropy/atom command; wrong number" @@ -118,7 +118,7 @@ ComputeEntropyAtom::~ComputeEntropyAtom() void ComputeEntropyAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute entropy/atom requires a pair style be" " defined"); diff --git a/src/USER-MISC/compute_gyration_shape.cpp b/src/USER-MISC/compute_gyration_shape.cpp index aef5ef91a3..6aef8c80ec 100644 --- a/src/USER-MISC/compute_gyration_shape.cpp +++ b/src/USER-MISC/compute_gyration_shape.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShape::ComputeGyrationShape(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration(NULL) + Compute(lmp, narg, arg), id_gyration(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape command"); diff --git a/src/USER-MISC/compute_gyration_shape_chunk.cpp b/src/USER-MISC/compute_gyration_shape_chunk.cpp index 116d851024..2c9bf9d3ed 100644 --- a/src/USER-MISC/compute_gyration_shape_chunk.cpp +++ b/src/USER-MISC/compute_gyration_shape_chunk.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShapeChunk::ComputeGyrationShapeChunk(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration_chunk(NULL), shape_parameters(NULL) + Compute(lmp, narg, arg), id_gyration_chunk(nullptr), shape_parameters(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command"); diff --git a/src/USER-MISC/compute_hma.cpp b/src/USER-MISC/compute_hma.cpp index f2ccf2694d..f7a9f9fcfa 100644 --- a/src/USER-MISC/compute_hma.cpp +++ b/src/USER-MISC/compute_hma.cpp @@ -73,7 +73,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_temp(NULL), deltaR(NULL) + Compute(lmp, narg, arg), id_temp(nullptr), deltaR(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute hma command"); if (igroup) error->all(FLERR,"Compute hma must use group all"); @@ -199,7 +199,7 @@ ComputeHMA::~ComputeHMA() void ComputeHMA::init() { if (computeCv>-1) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute hma cv"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute hma cv"); @@ -222,7 +222,7 @@ void ComputeHMA::setup() int ifix = modify->find_fix(id_temp); if (ifix < 0) error->all(FLERR,"Could not find compute hma temperature ID"); double * temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); - if (temperat==NULL) error->all(FLERR,"Could not find compute hma temperature ID"); + if (temperat==nullptr) error->all(FLERR,"Could not find compute hma temperature ID"); finaltemp = * temperat; // set fix which stores original atom coords diff --git a/src/USER-MISC/compute_pressure_cylinder.cpp b/src/USER-MISC/compute_pressure_cylinder.cpp index 6cf375dd19..e050275f76 100644 --- a/src/USER-MISC/compute_pressure_cylinder.cpp +++ b/src/USER-MISC/compute_pressure_cylinder.cpp @@ -48,10 +48,10 @@ static const char cite_compute_pressure_cylinder[] = ComputePressureCyl::ComputePressureCyl(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - Pr_temp(NULL), Pr_all(NULL), Pz_temp(NULL), Pz_all(NULL), Pphi_temp(NULL), - Pphi_all(NULL), R(NULL), Rinv(NULL), R2(NULL), PrAinv(NULL), PzAinv(NULL), - R2kin(NULL), density_temp(NULL), invVbin(NULL), density_all(NULL), - tangent(NULL), ephi_x(NULL), ephi_y(NULL), binz(NULL) + Pr_temp(nullptr), Pr_all(nullptr), Pz_temp(nullptr), Pz_all(nullptr), Pphi_temp(nullptr), + Pphi_all(nullptr), R(nullptr), Rinv(nullptr), R2(nullptr), PrAinv(nullptr), PzAinv(nullptr), + R2kin(nullptr), density_temp(nullptr), invVbin(nullptr), density_all(nullptr), + tangent(nullptr), ephi_x(nullptr), ephi_y(nullptr), binz(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_pressure_cylinder); if (narg != 7) error->all(FLERR,"Illegal compute pressure/cylinder command"); @@ -143,7 +143,7 @@ ComputePressureCyl::~ComputePressureCyl() void ComputePressureCyl::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pressure/cylinder"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pressure/cylinder"); diff --git a/src/USER-MISC/compute_pressure_grem.cpp b/src/USER-MISC/compute_pressure_grem.cpp index ba949727b0..6a5c36a06f 100644 --- a/src/USER-MISC/compute_pressure_grem.cpp +++ b/src/USER-MISC/compute_pressure_grem.cpp @@ -55,7 +55,7 @@ void ComputePressureGrem::init() int dim; scale_grem = (double *)modify->fix[ifix]->extract("scale_grem",dim); - if (scale_grem == NULL || dim != 0) + if (scale_grem == nullptr || dim != 0) error->all(FLERR,"Cannot extract gREM scale factor from fix grem"); } diff --git a/src/USER-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index c733c929ba..2abe812f19 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -117,7 +117,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // Initialize some variables - values_local = values_global = vector = NULL; + values_local = values_global = vector = nullptr; // this fix produces a global vector @@ -173,7 +173,7 @@ void ComputeStressMop::init() // This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); @@ -185,15 +185,15 @@ void ComputeStressMop::init() //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 323aee851e..6beb3ffd83 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -112,8 +112,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // initialize some variables nbins = 0; - coord = coordp = NULL; - values_local = values_global = array = NULL; + coord = coordp = nullptr; + values_local = values_global = array = nullptr; // bin setup @@ -173,7 +173,7 @@ void ComputeStressMopProfile::init() //This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); @@ -185,15 +185,15 @@ void ComputeStressMopProfile::init() //Compute stress/mop/profile only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index c333357a93..5aafe19033 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -42,7 +42,7 @@ ComputeTempRotate::ComputeTempRotate(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-MISC/compute_viscosity_cos.cpp b/src/USER-MISC/compute_viscosity_cos.cpp index dae93a8d81..4a798eb158 100644 --- a/src/USER-MISC/compute_viscosity_cos.cpp +++ b/src/USER-MISC/compute_viscosity_cos.cpp @@ -45,7 +45,7 @@ ComputeViscosityCos::ComputeViscosityCos(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[7]; } diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 7c131682fa..d5cd27189d 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -322,11 +322,11 @@ void DihedralCosineShiftExp::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 066447f92d..cb620ae7d4 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -365,7 +365,7 @@ void DihedralFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -380,9 +380,9 @@ void DihedralFourier::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,NULL,error); - utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index bde8d84070..bf1b2fa75d 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -320,7 +320,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -330,7 +330,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) if (comm->me == 0) { for(int i = 1; i <= atom->ndihedraltypes; i++) - utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,nullptr,error); } for (int i = 1; i <= atom->ndihedraltypes; i++ ) diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index deafc8391f..68be198332 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -326,8 +326,8 @@ void DihedralQuadratic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&phi0[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 15bb458c48..d200482999 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -654,16 +654,16 @@ void DihedralSpherical::allocate() theta2_shift = new double * [n+1]; theta2_offset = new double * [n+1]; for (int i = 1; i <= n; i++) { - Ccoeff[i] = NULL; - phi_mult[i] = NULL; - phi_shift[i] = NULL; - phi_offset[i] = NULL; - theta1_mult[i] = NULL; - theta1_shift[i] = NULL; - theta1_offset[i] = NULL; - theta2_mult[i] = NULL; - theta2_shift[i] = NULL; - theta2_offset[i] = NULL; + Ccoeff[i] = nullptr; + phi_mult[i] = nullptr; + phi_shift[i] = nullptr; + phi_offset[i] = nullptr; + theta1_mult[i] = nullptr; + theta1_shift[i] = nullptr; + theta1_offset[i] = nullptr; + theta2_mult[i] = nullptr; + theta2_shift[i] = nullptr; + theta2_offset[i] = nullptr; } memory->create(setflag,n+1,"dihedral:setflag"); @@ -755,7 +755,7 @@ void DihedralSpherical::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -775,16 +775,16 @@ void DihedralSpherical::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 91a8642b10..d09684df98 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -788,7 +788,7 @@ void DihedralTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } @@ -1014,8 +1014,8 @@ void DihedralTable::write_restart_settings(FILE *fp) void DihedralTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1027,10 +1027,10 @@ void DihedralTable::read_restart_settings(FILE *fp) void DihedralTable::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index f8a2f02596..3933e39342 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -412,8 +412,8 @@ DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : Dihedral(lmp) { if (lmp->citeme) lmp->citeme->add(cite_dihedral_tablecut); ntables = 0; - tables = NULL; - checkU_fname = checkF_fname = NULL; + tables = nullptr; + checkU_fname = checkF_fname = nullptr; } /* ---------------------------------------------------------------------- */ @@ -779,7 +779,7 @@ void DihedralTableCut::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ void DihedralTableCut::write_restart_settings(FILE *fp) void DihedralTableCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1041,10 +1041,10 @@ void DihedralTableCut::read_restart_settings(FILE *fp) void DihedralTableCut::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1079,7 +1079,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { string err_msg = string("Cannot open file ") + string(file); error->one(FLERR,err_msg); } @@ -1087,7 +1087,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) { + if (fgets(line,MAXLINE,fp) == nullptr) { string err_msg=string("Did not find keyword \"") +string(keyword)+string("\" in dihedral table file."); error->one(FLERR, err_msg); @@ -1121,7 +1121,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // Skip blank lines and delete text following a '#' character char *pe = strchr(line, '#'); - if (pe != NULL) *pe = '\0'; //terminate string at '#' character + if (pe != nullptr) *pe = '\0'; //terminate string at '#' character char *pc = line; while ((*pc != '\0') && isspace(*pc)) pc++; @@ -1344,7 +1344,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"NOF") == 0) { @@ -1357,20 +1357,20 @@ void DihedralTableCut::param_extract(Table *tb, char *line) tb->use_degrees = false; } else if (strcmp(word,"CHECKU") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkU_fname); memory->create(checkU_fname,strlen(word)+1,"dihedral_table:checkU"); strcpy(checkU_fname, word); } else if (strcmp(word,"CHECKF") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkF_fname); memory->create(checkF_fname,strlen(word)+1,"dihedral_table:checkF"); strcpy(checkF_fname, word); } // COMMENTING OUT: equilibrium angles are not supported //else if (strcmp(word,"EQ") == 0) { - // word = strtok(NULL," \t\n\r\f"); + // word = strtok(nullptr," \t\n\r\f"); // tb->theta0 = atof(word); //} else { @@ -1378,7 +1378,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) err_msg += string(" (") + string(word) + string(")"); error->one(FLERR, err_msg); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index ed796280e7..f1b64817b1 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -51,7 +51,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index d92789f03f..57eb9705b7 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -118,13 +118,13 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): type = AUTO; startstep = 0; - fp = NULL; + fp = nullptr; overwrite = 0; numcorrelators=20; p = 16; m = 2; - char *title1 = NULL; - char *title2 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"type") == 0) { @@ -163,7 +163,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Illegal fix ave/correlate/long command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ave/correlate/long file %s",arg[iarg+1]); error->one(FLERR,str); diff --git a/src/USER-MISC/fix_electron_stopping.cpp b/src/USER-MISC/fix_electron_stopping.cpp index 952ffe7584..52ab44b0c8 100644 --- a/src/USER-MISC/fix_electron_stopping.cpp +++ b/src/USER-MISC/fix_electron_stopping.cpp @@ -242,7 +242,7 @@ void FixElectronStopping::read_table(const char *file) char line[MAXLINE]; FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str, 128, "Cannot open stopping range table %s", file); error->one(FLERR, str); @@ -252,21 +252,21 @@ void FixElectronStopping::read_table(const char *file) int l = 0; while (true) { - if (fgets(line, MAXLINE, fp) == NULL) break; // end of file + if (fgets(line, MAXLINE, fp) == nullptr) break; // end of file if (line[0] == '#') continue; // comment char *pch = strtok(line, " \t\n\r"); - if (pch == NULL) continue; // blank line + if (pch == nullptr) continue; // blank line if (l >= maxlines) grow_table(); int i = 0; - for ( ; i < ncol && pch != NULL; i++) { + for ( ; i < ncol && pch != nullptr; i++) { elstop_ranges[i][l] = utils::numeric(FLERR, pch,false,lmp); - pch = strtok(NULL, " \t\n\r"); + pch = strtok(nullptr, " \t\n\r"); } - if (i != ncol || pch != NULL) // too short or too long + if (i != ncol || pch != nullptr) // too short or too long error->one(FLERR, "fix electron/stopping: Invalid table line"); if (l >= 1 && elstop_ranges[0][l] <= elstop_ranges[0][l-1]) diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index fb111c1f27..c0f79869b4 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -106,11 +106,11 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"ffl:sqrt_m"); // allocates space for temporaries - ffl_tmp1=ffl_tmp2=NULL; + ffl_tmp1=ffl_tmp2=nullptr; grow_arrays(atom->nmax); @@ -426,7 +426,7 @@ void *FixFFL::extract(const char *str, int &dim) { if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 86650cd50d..6ed2632b43 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -149,22 +149,22 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : angle_distance = new double[atom->nangletypes+1]; //grow_arrays - array_atom = NULL; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + array_atom = nullptr; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); //calls grow_arrays - x_store = NULL; + x_store = nullptr; //STUFF - g = NULL; - help2 = NULL; + g = nullptr; + help2 = nullptr; - dn1dx = dn2dx = dn3dx = NULL; - n1 = n2 = n3 = del1 = del2 = del3 = NULL; + dn1dx = dn2dx = dn3dx = nullptr; + n1 = n2 = n3 = del1 = del2 = del3 = nullptr; memory->grow(help2,15,15,"FilterCorotate:help2"); memory->grow(n1,3,"FilterCorotate:n1"); @@ -188,11 +188,11 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : // initialize list of clusters to constrain maxlist = 0; - list = NULL; - clist_derv = NULL; - clist_q0 = NULL; //list for derivative and ref. config - clist_nselect1 = clist_nselect2 = NULL; - clist_select1 = clist_select2 = NULL; + list = nullptr; + clist_derv = nullptr; + clist_q0 = nullptr; //list for derivative and ref. config + clist_nselect1 = clist_nselect2 = nullptr; + clist_select1 = clist_select2 = nullptr; } @@ -284,7 +284,7 @@ void FixFilterCorotate::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for fix filter/corotate"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -1225,7 +1225,7 @@ void FixFilterCorotate::find_clusters() // cycle buffer around ring of procs back to self - comm->ring(size,sizeof(tagint),buf,3,ring_shake,NULL,(void *)this); + comm->ring(size,sizeof(tagint),buf,3,ring_shake,nullptr,(void *)this); memory->destroy(buf); diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index f4776c3d6c..04be665213 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -218,11 +218,11 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : int seed = utils::inumeric(FLERR,arg[6],false,lmp); // LOADING A matrix - FILE *fgle = NULL; + FILE *fgle = nullptr; char *fname = arg[7]; if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open A-matrix file %s",fname); error->one(FLERR,str); @@ -238,7 +238,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -258,9 +258,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { A[ndone] = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } fnoneq=0; gle_every=1; gle_step=0; @@ -292,7 +292,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : } else { if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open C-matrix file %s",fname); error->one(FLERR,str); @@ -310,7 +310,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -330,9 +330,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { C[ndone] = cfac*atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } } @@ -349,13 +349,13 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"gle:sqrt_m"); // allocates space for additional degrees of freedom - gle_s=NULL; + gle_s=nullptr; // allocates space for temporaries - gle_tmp1=gle_tmp2=NULL; + gle_tmp1=gle_tmp2=nullptr; grow_arrays(atom->nmax); init_gles(); @@ -720,7 +720,7 @@ void *FixGLE::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index b17c601f05..0a283522ea 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -132,7 +132,7 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) : pressflag = 0; int *p_flag = (int *)nh->extract("p_flag",ifix); - if ((p_flag == NULL) || (ifix != 1) || (p_flag[0] == 0) + if ((p_flag == nullptr) || (ifix != 1) || (p_flag[0] == 0) || (p_flag[1] == 0) || (p_flag[2] == 0)) { pressflag = 0; } else if ((p_flag[0] == 1) && (p_flag[1] == 1) @@ -203,7 +203,7 @@ void FixGrem::init() double *t_start = (double *)nh->extract("t_start",ifix); double *t_stop = (double *)nh->extract("t_stop",ifix); - if ((t_start != NULL) && (t_stop != NULL) && (ifix == 0)) { + if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) { tbath = *t_start; if (*t_start != *t_stop) error->all(FLERR,"Thermostat temperature ramp not allowed"); @@ -215,7 +215,7 @@ void FixGrem::init() int *p_flag = (int *)nh->extract("p_flag",ifix); double *p_start = (double *) nh->extract("p_start",ifix); double *p_stop = (double *) nh->extract("p_stop",ifix); - if ((p_flag != NULL) && (p_start != NULL) && (p_stop != NULL) + if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr) && (ifix == 1)) { ifix = 0; pressref = p_start[0]; @@ -291,5 +291,5 @@ void *FixGrem::extract(const char *str, int &dim) if (strcmp(str,"scale_grem") == 0) { return &scale_grem; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 7c3fac9c33..d772998b16 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -207,7 +207,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -229,7 +229,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -280,7 +280,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -288,7 +288,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -492,25 +492,25 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); /* initialize various imd state variables. */ - clientsock = NULL; - localsock = NULL; + clientsock = nullptr; + localsock = nullptr; nlevels_respa = 0; imd_inactive = 0; imd_terminate = 0; imd_forces = 0; - force_buf = NULL; + force_buf = nullptr; maxbuf = 0; - msgdata = NULL; + msgdata = nullptr; msglen = 0; - comm_buf = NULL; - idmap = NULL; - rev_idmap = NULL; + comm_buf = nullptr; + idmap = nullptr; + rev_idmap = nullptr; if (me == 0) { /* set up incoming socket on MPI rank 0. */ imdsock_init(); localsock = imdsock_create(); - clientsock = NULL; + clientsock = nullptr; if (imdsock_bind(localsock,imd_port)) { perror("bind to socket failed"); imdsock_destroy(localsock); @@ -536,9 +536,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : /* set up mutex and condition variable for i/o thread */ /* hold mutex before creating i/o thread to keep it waiting. */ - pthread_mutex_init(&read_mutex, NULL); - pthread_mutex_init(&write_mutex, NULL); - pthread_cond_init(&write_cond, NULL); + pthread_mutex_init(&read_mutex, nullptr); + pthread_mutex_init(&write_mutex, nullptr); + pthread_cond_init(&write_cond, nullptr); pthread_mutex_lock(&write_mutex); buf_has_data=0; @@ -564,7 +564,7 @@ FixIMD::~FixIMD() buf_has_data=-1; pthread_cond_signal(&write_cond); pthread_mutex_unlock(&write_mutex); - pthread_join(iothread, NULL); + pthread_join(iothread, nullptr); /* cleanup */ pthread_attr_destroy(&iot_attr); @@ -584,8 +584,8 @@ FixIMD::~FixIMD() imdsock_destroy(clientsock); imdsock_shutdown(localsock); imdsock_destroy(localsock); - clientsock=NULL; - localsock=NULL; + clientsock=nullptr; + localsock=nullptr; return; } @@ -627,7 +627,7 @@ int FixIMD::reconnect() } } connect_msg = 0; - clientsock = NULL; + clientsock = nullptr; if (nowait_flag) { int retval = imdsock_selread(localsock,0); if (retval > 0) { @@ -774,7 +774,7 @@ void *fix_imd_ioworker(void *t) { FixIMD *imd=(FixIMD *)t; imd->ioworker(); - return NULL; + return nullptr; } /* the real i/o worker thread */ @@ -787,7 +787,7 @@ void FixIMD::ioworker() fprintf(screen,"Asynchronous I/O thread is exiting.\n"); buf_has_data=0; pthread_mutex_unlock(&write_mutex); - pthread_exit(NULL); + pthread_exit(nullptr); } else if (buf_has_data > 0) { /* send coordinate data, if client is able to accept */ if (clientsock && imdsock_selwrite(clientsock,0)) { @@ -855,9 +855,9 @@ void FixIMD::post_force(int /*vflag*/) imd_paused = 0; imd_forces = 0; memory->destroy(force_buf); - force_buf = NULL; + force_buf = nullptr; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; if (screen) fprintf(screen, "IMD client detached. LAMMPS run continues.\n"); @@ -875,7 +875,7 @@ void FixIMD::post_force(int /*vflag*/) imd_terminate = 1; imd_paused = 0; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; break; case IMD_PAUSE: @@ -958,7 +958,7 @@ void FixIMD::post_force(int /*vflag*/) /* check if we need to readjust the forces comm buffer on the receiving nodes. */ if (me != 0) { if (old_imd_forces < imd_forces) { /* grow holding space for forces, if needed. */ - if (force_buf != NULL) + if (force_buf != nullptr) memory->sfree(force_buf); force_buf = memory->smalloc(imd_forces*size_one, "imd:force_buf"); } @@ -1200,14 +1200,14 @@ void * imdsock_create(void) { imdsocket * s; s = (imdsocket *) malloc(sizeof(imdsocket)); - if (s != NULL) + if (s != nullptr) memset(s, 0, sizeof(imdsocket)); - else return NULL; + else return nullptr; if ((s->sd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { printf("Failed to open socket."); free(s); - return NULL; + return nullptr; } return (void *) s; @@ -1229,7 +1229,7 @@ int imdsock_listen(void * v) { void *imdsock_accept(void * v) { int rc; - imdsocket *new_s = NULL, *s = (imdsocket *) v; + imdsocket *new_s = nullptr, *s = (imdsocket *) v; #if defined(ARCH_AIX5) || defined(ARCH_AIX5_64) || defined(ARCH_AIX6_64) unsigned int len; #define _SOCKLEN_TYPE unsigned int @@ -1248,7 +1248,7 @@ void *imdsock_accept(void * v) { rc = accept(s->sd, (struct sockaddr *) &s->addr, ( _SOCKLEN_TYPE * ) &len); if (rc >= 0) { new_s = (imdsocket *) malloc(sizeof(imdsocket)); - if (new_s != NULL) { + if (new_s != nullptr) { *new_s = *s; new_s->sd = rc; } @@ -1277,7 +1277,7 @@ int imdsock_read(void * v, void *buf, int len) { void imdsock_shutdown(void *v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1289,7 +1289,7 @@ void imdsock_shutdown(void *v) { void imdsock_destroy(void * v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1306,14 +1306,14 @@ int imdsock_selread(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&rfd); FD_SET(s->sd, &rfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd+1, &rfd, NULL, NULL, &tv); + rc = select(s->sd+1, &rfd, nullptr, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; @@ -1325,14 +1325,14 @@ int imdsock_selwrite(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&wfd); FD_SET(s->sd, &wfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd + 1, NULL, &wfd, NULL, &tv); + rc = select(s->sd + 1, nullptr, &wfd, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; } diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index b8045a9ff1..2ddc965bb5 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -167,7 +167,7 @@ static void readbuffer(int sockfd, char *data, int len, Error* error) /* ---------------------------------------------------------------------- */ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), irregular(NULL) + Fix(lmp, narg, arg), irregular(nullptr) { /* format for fix: * fix num group_id ipi host port [unix] diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 9361d9ebd6..a613ceb9be 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -53,10 +53,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL), id_store(NULL),init_store(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr), id_store(nullptr),init_store(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix npt/cauchy command"); @@ -583,10 +583,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -794,7 +794,7 @@ void FixNPTCauchy::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -821,7 +821,7 @@ void FixNPTCauchy::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1812,7 +1812,7 @@ void *FixNPTCauchy::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index 5f1582d580..2d8d16e405 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -61,7 +61,7 @@ struct FixOrientECO::Nbr { FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - dir_filename(NULL), order(NULL), nbr(NULL), list(NULL) + dir_filename(nullptr), order(nullptr), nbr(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_eco); @@ -96,7 +96,7 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : int count; FILE *infile = utils::open_potential(dir_filename,lmp,nullptr); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open fix orient/eco file {}: {}", dir_filename, utils::getsyserror())); for (int i = 0; i < 6; ++i) { diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index 1ac0ffb188..4b107c6486 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -58,8 +58,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixPAFI::FixPAFI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), computename(NULL), random(NULL), - h(NULL), step_respa(NULL) + Fix(lmp, narg, arg), computename(nullptr), random(nullptr), + h(nullptr), step_respa(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_pafi_package); diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index 5be9bf162b..998dcdadf6 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -87,27 +87,27 @@ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) /* Initiation */ max_nsend = 0; - tag_send = NULL; - buf_send = NULL; + tag_send = nullptr; + buf_send = nullptr; max_nlocal = 0; - buf_recv = NULL; - buf_beads = NULL; + buf_recv = nullptr; + buf_beads = nullptr; size_plan = 0; - plan_send = plan_recv = NULL; + plan_send = plan_recv = nullptr; - M_x2xp = M_xp2x = M_f2fp = M_fp2f = NULL; - lam = NULL; - mode_index = NULL; + M_x2xp = M_xp2x = M_f2fp = M_fp2f = nullptr; + lam = nullptr; + mode_index = nullptr; - mass = NULL; + mass = nullptr; - array_atom = NULL; - nhc_eta = NULL; - nhc_eta_dot = NULL; - nhc_eta_dotdot = NULL; - nhc_eta_mass = NULL; + array_atom = nullptr; + nhc_eta = nullptr; + nhc_eta_dot = nullptr; + nhc_eta_dotdot = nullptr; + nhc_eta_mass = nullptr; size_peratom_cols = 12 * nhc_nchain + 3; @@ -601,7 +601,7 @@ void FixPIMD::comm_init() } buf_beads = new double* [np]; - for(int i=0; iall(FLERR, "Illegal fix propel/self command"); diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index 97bf1fb07b..ad96ec712c 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -55,7 +55,7 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // initial allocation of atom-based array // register with Atom class - array = NULL; + array = nullptr; grow_arrays(atom->nmax); // extends pack_exchange() @@ -100,7 +100,7 @@ int FixSRP::setmask() void FixSRP::init() { - if (force->pair_match("hybrid",1) == NULL && force->pair_match("hybrid/overlay",1) == NULL) + if (force->pair_match("hybrid",1) == nullptr && force->pair_match("hybrid/overlay",1) == nullptr) error->all(FLERR,"Cannot use pair srp without pair_style hybrid"); int has_rigid = 0; diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index bc10b5284c..f2638f8a91 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -74,7 +74,7 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : // Perform initial allocation of atom-based array // Register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index c12019528c..728a509990 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -67,11 +67,11 @@ static const char cite_fix_ttm_mod[] = FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); @@ -103,7 +103,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); if (comm->me == 0) { fp = fopen(arg[10],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ttm/mod file %s",arg[10]); error->one(FLERR,str); @@ -151,7 +151,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : "ttm/mod:net_energy_transfer"); memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "ttm/mod:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -560,7 +560,7 @@ void FixTTMMod::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/USER-MISC/fix_wall_reflect_stochastic.cpp b/src/USER-MISC/fix_wall_reflect_stochastic.cpp index 9a8454b017..6c3a58bc38 100644 --- a/src/USER-MISC/fix_wall_reflect_stochastic.cpp +++ b/src/USER-MISC/fix_wall_reflect_stochastic.cpp @@ -38,7 +38,7 @@ enum{NONE,DIFFUSIVE,MAXWELL,CCL}; FixWallReflectStochastic:: FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : - FixWallReflect(lmp, narg, arg), random(NULL) + FixWallReflect(lmp, narg, arg), random(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/reflect/stochastic command"); diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index 5714931215..9f6e7f114b 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -302,8 +302,8 @@ void ImproperCossq::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 476cf8ab43..cbdb5130e9 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -248,8 +248,8 @@ void ImproperDistance::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index 85f7809a02..8f54c8b7aa 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -326,11 +326,11 @@ void ImproperFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index c85e4850c8..b2a71b10a2 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -326,8 +326,8 @@ void ImproperRing::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 41f9bc9531..afd600594b 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -85,11 +85,11 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nelements = 0; - elements = NULL; - elem2param = NULL; + elements = nullptr; + elem2param = nullptr; nparams = 0; - params = NULL; - map = NULL; + params = nullptr; + map = nullptr; cutmax = 0.0; } @@ -114,7 +114,7 @@ PairAGNI::~PairAGNI() delete [] params[i].yU; } memory->destroy(params); - params = NULL; + params = nullptr; } if (allocated) { @@ -266,7 +266,7 @@ void PairAGNI::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -275,7 +275,7 @@ void PairAGNI::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -348,7 +348,7 @@ double PairAGNI::init_one(int i, int j) void PairAGNI::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = 0; // open file on proc 0 only @@ -357,7 +357,7 @@ void PairAGNI::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open AGNI potential file %s",file); error->one(FLERR,str); @@ -373,7 +373,7 @@ void PairAGNI::read_file(char *file) n = 0; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -396,7 +396,7 @@ void PairAGNI::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; --nwords; if ((nwords == 2) && (strcmp(words[0],"generation") == 0)) { diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 9ef96f1188..8c1114c4dd 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -304,15 +304,15 @@ void PairBuckMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -343,11 +343,11 @@ void PairBuckMDF::write_restart_settings(FILE *fp) void PairBuckMDF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); @@ -396,5 +396,5 @@ void *PairBuckMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_cosine_squared.cpp b/src/USER-MISC/pair_cosine_squared.cpp index 1203cea5f2..84383c102f 100644 --- a/src/USER-MISC/pair_cosine_squared.cpp +++ b/src/USER-MISC/pair_cosine_squared.cpp @@ -271,14 +271,14 @@ void PairCosineSquared::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { if (me == 0) - utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,nullptr,error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,nullptr,error); } MPI_Bcast(&epsilon[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&sigma[i][j], 1, MPI_DOUBLE, 0, world); @@ -306,7 +306,7 @@ void PairCosineSquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,NULL,error); + utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,nullptr,error); } MPI_Bcast(&cut_global, 1, MPI_DOUBLE, 0, world); } diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index 5a3e12f1a5..35995717bd 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -281,13 +281,13 @@ void PairCoulDiel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&rme[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairCoulDiel::write_restart_settings(FILE *fp) void PairCoulDiel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 44ab555b02..54e3dbddb8 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -297,12 +297,12 @@ void PairCoulShield::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -328,9 +328,9 @@ void PairCoulShield::write_restart_settings(FILE *fp) void PairCoulShield::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_slater_long.cpp b/src/USER-MISC/pair_coul_slater_long.cpp index 0c94254f48..0f5ee9bd11 100644 --- a/src/USER-MISC/pair_coul_slater_long.cpp +++ b/src/USER-MISC/pair_coul_slater_long.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; PairCoulSlaterLong::PairCoulSlaterLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - //ftable = NULL; + //ftable = nullptr; qdist = 0.0; } @@ -250,13 +250,13 @@ void PairCoulSlaterLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - // if (ncoultablebits) init_tables(cut_coul,NULL); + // if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -415,5 +415,5 @@ void *PairCoulSlaterLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 7b56caa205..449cf86699 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -49,11 +49,11 @@ PairDRIP::PairDRIP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; manybody_flag = 1; - params = NULL; - nearest3neigh = NULL; - elements = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + nearest3neigh = nullptr; + elements = nullptr; + elem2param = nullptr; + map = nullptr; nelements = 0; cutmax = 0.0; } @@ -68,10 +68,10 @@ PairDRIP::~PairDRIP() delete [] map; } - if (elements != NULL) { + if (elements != nullptr) { for (int i = 0; i < nelements; i++) delete [] elements[i]; delete [] elements; - elements = NULL; + elements = nullptr; } memory->destroy(params); memory->destroy(elem2param); @@ -139,7 +139,7 @@ void PairDRIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -148,7 +148,7 @@ void PairDRIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -224,7 +224,7 @@ void PairDRIP::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open DRIP potential file %s",filename); error->one(FLERR,str); @@ -241,7 +241,7 @@ void PairDRIP::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -263,7 +263,7 @@ void PairDRIP::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -283,7 +283,7 @@ void PairDRIP::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index a7ed0fcaad..96aeea66f6 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -50,12 +50,12 @@ PairE3B::PairE3B(LAMMPS *lmp) : Pair(lmp),pairPerAtom(10) pvector = new double[nextra]; allocatedE3B = false; - pairO = NULL; - pairH = NULL; - exps = NULL; - del3 = NULL; - fpair3 = NULL; - sumExp = NULL; + pairO = nullptr; + pairH = nullptr; + exps = nullptr; + del3 = nullptr; + fpair3 = nullptr; + sumExp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 6ccaded35d..31dda8bb03 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -52,12 +52,12 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairEDIP::PairEDIP(LAMMPS *lmp) : - Pair(lmp), preInvR_ij(NULL), preExp3B_ij(NULL), preExp3BDerived_ij(NULL), - preExp2B_ij(NULL), preExp2BDerived_ij(NULL), prePow2B_ij(NULL), - preForceCoord(NULL), cutoffFunction(NULL), cutoffFunctionDerived(NULL), - pow2B(NULL), exp2B(NULL), exp3B(NULL), qFunctionGrid(NULL), - expMinusBetaZeta_iZeta_iGrid(NULL), tauFunctionGrid(NULL), - tauFunctionDerivedGrid(NULL) + Pair(lmp), preInvR_ij(nullptr), preExp3B_ij(nullptr), preExp3BDerived_ij(nullptr), + preExp2B_ij(nullptr), preExp2BDerived_ij(nullptr), prePow2B_ij(nullptr), + preForceCoord(nullptr), cutoffFunction(nullptr), cutoffFunctionDerived(nullptr), + pow2B(nullptr), exp2B(nullptr), exp3B(nullptr), qFunctionGrid(nullptr), + expMinusBetaZeta_iZeta_iGrid(nullptr), tauFunctionGrid(nullptr), + tauFunctionDerivedGrid(nullptr) { single_enable = 0; restartinfo = 0; @@ -65,10 +65,10 @@ PairEDIP::PairEDIP(LAMMPS *lmp) : manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -779,7 +779,7 @@ void PairEDIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -788,7 +788,7 @@ void PairEDIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -876,7 +876,7 @@ void PairEDIP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -884,7 +884,7 @@ void PairEDIP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -902,7 +902,7 @@ void PairEDIP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -924,7 +924,7 @@ void PairEDIP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -944,7 +944,7 @@ void PairEDIP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 4a81a41a26..1a5d4925d9 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -70,10 +70,10 @@ PairEDIPMulti::PairEDIPMulti(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -539,7 +539,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -548,7 +548,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -633,7 +633,7 @@ void PairEDIPMulti::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -641,7 +641,7 @@ void PairEDIPMulti::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -659,7 +659,7 @@ void PairEDIPMulti::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -681,7 +681,7 @@ void PairEDIPMulti::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -701,7 +701,7 @@ void PairEDIPMulti::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 0db7f8739a..6d9f74de8e 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -52,20 +52,20 @@ PairExTeP::PairExTeP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - map = NULL; + map = nullptr; - Nt = NULL; - Nd = NULL; + Nt = nullptr; + Nd = nullptr; } /* ---------------------------------------------------------------------- @@ -467,7 +467,7 @@ void PairExTeP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -476,7 +476,7 @@ void PairExTeP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -544,7 +544,7 @@ void PairExTeP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -582,7 +582,7 @@ void PairExTeP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -590,7 +590,7 @@ void PairExTeP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ExTeP potential file %s",file); error->one(FLERR,str); @@ -607,7 +607,7 @@ void PairExTeP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -629,7 +629,7 @@ void PairExTeP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -649,7 +649,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line @@ -737,7 +737,7 @@ void PairExTeP::read_file(char *file) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); //fputs(line,stdout); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -758,7 +758,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); while ((nwords < params_per_line) - && (words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + && (words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // skip line if it is a leftover from the previous section, // which can be identified by having 3 elements (instead of 2) diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index c9601c416e..d7d7f68645 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -301,14 +301,14 @@ void PairGaussCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&hgauss[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rmh[i][j],1,MPI_DOUBLE,0,world); @@ -337,9 +337,9 @@ void PairGaussCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 671dcb309d..f0c197ca3d 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -54,23 +54,23 @@ PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutILPsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutILPsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - ILP_numneigh = NULL; - ILP_firstneigh = NULL; - ipage = NULL; + ILP_numneigh = nullptr; + ILP_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -167,7 +167,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -176,7 +176,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -249,7 +249,7 @@ void PairILPGrapheneHBN::read_file(char *filename) int params_per_line = 13; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -257,7 +257,7 @@ void PairILPGrapheneHBN::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ILP potential file %s",filename); error->one(FLERR,str); @@ -274,7 +274,7 @@ void PairILPGrapheneHBN::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -296,7 +296,7 @@ void PairILPGrapheneHBN::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -316,7 +316,7 @@ void PairILPGrapheneHBN::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -414,7 +414,7 @@ void PairILPGrapheneHBN::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index 9f986fa101..c308990839 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -54,23 +54,23 @@ PairKolmogorovCrespiFull::PairKolmogorovCrespiFull(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutKCsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutKCsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - KC_numneigh = NULL; - KC_firstneigh = NULL; - ipage = NULL; + KC_numneigh = nullptr; + KC_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -168,7 +168,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -177,7 +177,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -250,7 +250,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -258,7 +258,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -275,7 +275,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -297,7 +297,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -317,7 +317,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -415,7 +415,7 @@ void PairKolmogorovCrespiFull::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 7ce6f8652a..80f57fb5dc 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -48,11 +48,11 @@ PairKolmogorovCrespiZ::PairKolmogorovCrespiZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -232,7 +232,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -241,7 +241,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -308,7 +308,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) int params_per_line = 11; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -316,7 +316,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -333,7 +333,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -355,7 +355,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -375,7 +375,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index b8f9e5c38f..cb65dc85f6 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -49,11 +49,11 @@ PairLebedevaZ::PairLebedevaZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -228,7 +228,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -237,7 +237,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -304,7 +304,7 @@ void PairLebedevaZ::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -312,7 +312,7 @@ void PairLebedevaZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; sprintf(str,"Cannot open Lebedeva potential file %s",filename); error->one(FLERR,str); @@ -329,7 +329,7 @@ void PairLebedevaZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -351,7 +351,7 @@ void PairLebedevaZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -371,7 +371,7 @@ void PairLebedevaZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 31d32db505..23c12ea9dd 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -304,14 +304,14 @@ void PairLennardMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&aparm[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&bparm[i][j],1,MPI_DOUBLE,0,world); @@ -340,9 +340,9 @@ void PairLennardMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -413,5 +413,5 @@ void *PairLennardMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) aparm; if (strcmp(str,"b") == 0) return (void *) bparm; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index a93e0a81af..f46c061e40 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; static const char * const stylename[] = { - "none", "harmonic", "morse", "lj126", NULL + "none", "harmonic", "morse", "lj126", nullptr }; // fast power function for integer exponent > 0 @@ -54,8 +54,8 @@ PairList::PairList(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; respa_enable = 0; cut_global = 0.0; - style = NULL; - params = NULL; + style = nullptr; + params = nullptr; check_flag = 1; } @@ -211,7 +211,7 @@ void PairList::settings(int narg, char **arg) FILE *fp = utils::open_potential(arg[0],lmp,nullptr); char line[1024]; - if (fp == NULL) + if (fp == nullptr) error->all(FLERR,"Cannot open pair list file"); // count lines in file for upper limit of storage needed @@ -238,13 +238,13 @@ void PairList::settings(int narg, char **arg) // get atom ids of pair id1 = ATOTAGINT(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); id2 = ATOTAGINT(ptr); // get potential type - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); @@ -257,13 +257,13 @@ void PairList::settings(int narg, char **arg) if (strcmp(ptr,stylename[HARM]) == 0) { style[npairs] = HARM; - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.k = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -273,17 +273,17 @@ void PairList::settings(int narg, char **arg) } else if (strcmp(ptr,stylename[MORSE]) == 0) { style[npairs] = MORSE; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.d0 = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.alpha = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -294,12 +294,12 @@ void PairList::settings(int narg, char **arg) // 12-6 lj potential style[npairs] = LJ126; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.epsilon = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.sigma = utils::numeric(FLERR,ptr,false,lmp); @@ -311,8 +311,8 @@ void PairList::settings(int narg, char **arg) } // optional cutoff parameter. if not specified use global value - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr != NULL) && (*ptr != '#')) { + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr != nullptr) && (*ptr != '#')) { double cut = utils::numeric(FLERR,ptr,false,lmp); par.cutsq = cut*cut; } else { diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 92e869e58c..8951af77cd 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -51,9 +51,9 @@ PairLJExpandCoulLong::PairLJExpandCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -710,11 +710,11 @@ void PairLJExpandCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -838,14 +838,14 @@ void PairLJExpandCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -877,13 +877,13 @@ void PairLJExpandCoulLong::write_restart_settings(FILE *fp) void PairLJExpandCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -997,5 +997,5 @@ void *PairLJExpandCoulLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index baa0e233f2..07f58aced1 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -311,14 +311,14 @@ void PairLJMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -345,7 +345,7 @@ void PairLJMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } @@ -414,5 +414,5 @@ void *PairLJMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index ab845e69d5..42a2d4bb7c 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -487,15 +487,15 @@ void PairLJSFDipoleSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,9 +524,9 @@ void PairLJSFDipoleSF::write_restart_settings(FILE *fp) void PairLJSFDipoleSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -638,5 +638,5 @@ void *PairLJSFDipoleSF::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index 404f6e2db1..61346a7fdc 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -62,28 +62,28 @@ PairLocalDensity::PairLocalDensity(LAMMPS *lmp) : Pair(lmp) // stuff read from tabulated file nLD = 0; nrho = 0; - rho_min = NULL; - rho_max = NULL; - a = NULL; - b = NULL; - c0 = NULL; - c2 = NULL; - c4 = NULL; - c6 = NULL; - uppercut = NULL; - lowercut = NULL; - uppercutsq = NULL; - lowercutsq = NULL; - frho = NULL; - rho = NULL; + rho_min = nullptr; + rho_max = nullptr; + a = nullptr; + b = nullptr; + c0 = nullptr; + c2 = nullptr; + c4 = nullptr; + c6 = nullptr; + uppercut = nullptr; + lowercut = nullptr; + uppercutsq = nullptr; + lowercutsq = nullptr; + frho = nullptr; + rho = nullptr; // splined arrays - frho_spline = NULL; + frho_spline = nullptr; // per-atom arrays nmax = 0; - fp = NULL; - localrho = NULL; + fp = nullptr; + localrho = nullptr; // set comm size needed by this pair comm_forward = 1; @@ -667,7 +667,7 @@ void PairLocalDensity::parse_file(char *filename) { if (me == 0) { fptr = fopen(filename, "r"); - if (fptr == NULL) { + if (fptr == nullptr) { char str[128]; sprintf(str,"Cannot open Local Density potential file %s",filename); error->one(FLERR,str); @@ -724,23 +724,23 @@ void PairLocalDensity::parse_file(char *filename) { for (k = 0; k < nLD; k++) { // parse upper and lower cut values - if (fgets(line,MAXLINE,fptr)==NULL) break; + if (fgets(line,MAXLINE,fptr)==nullptr) break; sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]); // parse and broadcast central atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); char *tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { a[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse neighbor atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { b[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse min, max and delta rho values diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 4d9b3866b7..455a21ada3 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -56,24 +56,24 @@ PairMEAMSpline::PairMEAMSpline(LAMMPS *lmp) : Pair(lmp) one_coeff = 1; nelements = 0; - elements = NULL; - map = NULL; + elements = nullptr; + map = nullptr; - Uprime_values = NULL; + Uprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; - phis = NULL; - Us = NULL; - rhos = NULL; - fs = NULL; - gs = NULL; + phis = nullptr; + Us = nullptr; + rhos = nullptr; + fs = nullptr; + gs = nullptr; - zero_atom_energies = NULL; + zero_atom_energies = nullptr; } /* ---------------------------------------------------------------------- */ @@ -398,7 +398,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -459,7 +459,7 @@ void PairMEAMSpline::read_file(const char* filename) if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,128,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -480,8 +480,8 @@ void PairMEAMSpline::read_file(const char* filename) if (strcmp(ptr, "meam/spline") == 0) { isNewFormat = true; // parse the rest of the line! - ptr = strtok(NULL," \t\n\r\f"); - if (ptr == NULL) + ptr = strtok(nullptr," \t\n\r\f"); + if (ptr == nullptr) error->one(FLERR,"Need to include number of atomic species on" " meam/spline line in multi-element potential file"); nelements = atoi(ptr); @@ -493,8 +493,8 @@ void PairMEAMSpline::read_file(const char* filename) delete [] elements; elements = new char*[nelements]; for (int i=0; ione(FLERR, "Not enough atomic species in meam/spline" " line of multi-element potential file"); elements[i] = new char[strlen(ptr)+1]; @@ -674,27 +674,27 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, // If new format, read the spline format. Should always be "spline3eq" for now. if (isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line in old format if (!isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index 2e6e7e00f3..31be826d0d 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -74,7 +74,7 @@ protected: class SplineFunction { public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -205,7 +205,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 0a8aae233a..0013fa5577 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -49,13 +49,13 @@ PairMEAMSWSpline::PairMEAMSWSpline(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; - Uprime_values = NULL; - //ESWprime_values = NULL; + Uprime_values = nullptr; + //ESWprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; @@ -393,7 +393,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -402,7 +402,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -461,7 +461,7 @@ void PairMEAMSWSpline::read_file(const char* filename) { if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,1024,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -601,23 +601,23 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error) char line[MAXLINE]; // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index b4480050db..1fd59b34a5 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -62,7 +62,7 @@ protected: public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -188,7 +188,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index d534284b57..997e334537 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -308,16 +308,16 @@ void PairMomb::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -349,11 +349,11 @@ void PairMomb::write_restart_settings(FILE *fp) void PairMomb::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&sscale,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index 9f895800df..73e0bb3c69 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -269,14 +269,14 @@ void PairMorseSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -303,8 +303,8 @@ void PairMorseSmoothLinear::write_restart_settings(FILE *fp) void PairMorseSmoothLinear::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairMorseSmoothLinear::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index 150895108e..d26a0b28df 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -76,7 +76,7 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_srp); nextra = 1; - segment = NULL; + segment = nullptr; // generate unique fix-id for this pair style instance @@ -704,12 +704,12 @@ void PairSRP::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -737,12 +737,12 @@ void PairSRP::write_restart_settings(FILE *fp) void PairSRP::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bptype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&btype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&min,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&exclude,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bptype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&btype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&min,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&exclude,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 1f5cfddff1..6e0cacaff7 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -755,7 +755,7 @@ void PairTersoffTable::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -764,7 +764,7 @@ void PairTersoffTable::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 8d7a4ee2c9..c3c6d89fb6 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -167,7 +167,7 @@ void TemperGrem::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 69f4559cac..288be333f7 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -148,7 +148,7 @@ void TemperNPT::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index 7ef134405d..4909746571 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -386,21 +386,21 @@ void AngleClass2P6::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index 1bede58751..7d08467be4 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -281,7 +281,7 @@ void AngleCosineBuck6d::init_style() { // set local ptrs to buck6d 13 arrays setup by Pair int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle cosine/buck6d is incompatible with Pair style"); cut_ljsq = (double **) force->pair->extract("cut_ljsq",itmp); buck6d1 = (double **) force->pair->extract("buck6d1",itmp); @@ -332,9 +332,9 @@ void AngleCosineBuck6d::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index bbe6e48a35..96faebc85c 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -313,8 +313,8 @@ void ImproperInversionHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 0de5423d30..1e6a0417e9 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -415,16 +415,16 @@ void PairBuck6dCoulGaussDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -457,12 +457,12 @@ void PairBuck6dCoulGaussDSF::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -584,5 +584,5 @@ void *PairBuck6dCoulGaussDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index c6ba832fff..3286abe773 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -331,7 +331,7 @@ void PairBuck6dCoulGaussLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -447,16 +447,16 @@ void PairBuck6dCoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -490,13 +490,13 @@ void PairBuck6dCoulGaussLong::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&coul_smooth,1,MPI_DOUBLE,0,world); @@ -639,5 +639,5 @@ void *PairBuck6dCoulGaussLong::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOLFILE/dump_molfile.cpp b/src/USER-MOLFILE/dump_molfile.cpp index e0e92f9339..a06d83a78d 100644 --- a/src/USER-MOLFILE/dump_molfile.cpp +++ b/src/USER-MOLFILE/dump_molfile.cpp @@ -72,10 +72,10 @@ DumpMolfile::DumpMolfile(LAMMPS *lmp, int narg, char **arg) ntotal = 0; me = comm->me; - coords = vels = masses = charges = radiuses = NULL; - types = molids = NULL; + coords = vels = masses = charges = radiuses = nullptr; + types = molids = nullptr; ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; // allocate global array for atom coords @@ -132,7 +132,7 @@ DumpMolfile::~DumpMolfile() delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -146,7 +146,7 @@ void DumpMolfile::init_style() if (me == 0) { /* initialize typenames array to numeric types by default */ - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { /* a 32-bit int can be maximally 10 digits plus sign */ @@ -408,7 +408,7 @@ void DumpMolfile::write_data(int n, double *mybuf) need_structure = 0; } double simtime = update->ntimestep * update->dt; - mf->timestep(coords,NULL,cell,&simtime); + mf->timestep(coords,nullptr,cell,&simtime); } } } @@ -433,7 +433,7 @@ int DumpMolfile::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 90a5781fff..485be5172d 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -175,7 +175,7 @@ extern "C" { int i, ind; char atom[3]; - if (label != NULL) { + if (label != nullptr) { /* zap string */ atom[0] = atom[1] = atom[2] = '\0'; @@ -217,8 +217,8 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) - return NULL; + if (dirname == nullptr) + return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -237,7 +237,7 @@ extern "C" { delete[] d->searchname; delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -248,13 +248,13 @@ extern "C" { if (FindNextFile(d->h, &(d->fd))) { return d->fd.cFileName; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->h != NULL) { + if (d->h != nullptr) { FindClose(d->h); } delete[] d->searchname; @@ -293,7 +293,7 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) return NULL; + if (dirname == nullptr) return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -303,10 +303,10 @@ extern "C" { d->dlen = len; d->d = opendir(d->name); - if (d->d == NULL) { + if (d->d == nullptr) { delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -316,17 +316,17 @@ extern "C" { { struct dirent *p; - if ((p = readdir(d->d)) != NULL) { + if ((p = readdir(d->d)) != nullptr) { return p->d_name; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->d != NULL) { + if (d->d != nullptr) { closedir(d->d); } delete[] d->name; @@ -374,7 +374,7 @@ MolfileInterface::~MolfileInterface() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } delete[] _name; delete[] _type; @@ -392,7 +392,7 @@ int MolfileInterface::find_plugin(const char *pluginpath) #else #define MY_PATHSEP ':' #endif - if (pluginpath == NULL) return E_DIR; + if (pluginpath == nullptr) return E_DIR; plugindir = path = strdup(pluginpath); while (plugindir) { @@ -413,11 +413,11 @@ int MolfileInterface::find_plugin(const char *pluginpath) int len; filename = my_readdir(dir); - if (filename == NULL) break; + if (filename == nullptr) break; // only look at .so files ext = strrchr(filename, '.'); - if (ext == NULL) continue; + if (ext == nullptr) continue; if (strcasecmp(ext,".so") != 0) continue; // construct full pathname of potential DSO @@ -450,14 +450,14 @@ int MolfileInterface::load_plugin(const char *filename) // access shared object dso = my_dlopen(filename); - if (dso == NULL) + if (dso == nullptr) return E_FILE; // check for required plugin symbols void *ifunc = my_dlsym(dso,"vmdplugin_init"); void *rfunc = my_dlsym(dso,"vmdplugin_register"); void *ffunc = my_dlsym(dso,"vmdplugin_fini"); - if (ifunc == NULL || rfunc == NULL || ffunc == NULL) { + if (ifunc == nullptr || rfunc == nullptr || ffunc == nullptr) { my_dlclose(dso); return E_SYMBOL; } @@ -472,7 +472,7 @@ int MolfileInterface::load_plugin(const char *filename) // the callback will be called for each plugin in the DSO and // check the file type. plugin->name will change if successful. plugin_reginfo_t reginfo; - reginfo.p = NULL; + reginfo.p = nullptr; reginfo.name=_type; ((regfunc)rfunc)(®info, plugin_register_cb); @@ -481,7 +481,7 @@ int MolfileInterface::load_plugin(const char *filename) // if the callback found a matching plugin and copied the struct, // its name element will point to a different location now. - if (plugin == NULL) { + if (plugin == nullptr) { retval = E_TYPE; // check if the ABI matches the one used to compile this code @@ -490,16 +490,16 @@ int MolfileInterface::load_plugin(const char *filename) // check if (basic) reading is supported } else if ((_mode & M_READ) && - ( (plugin->open_file_read == NULL) || - (plugin->read_next_timestep == NULL) || - (plugin->close_file_read == NULL) )) { + ( (plugin->open_file_read == nullptr) || + (plugin->read_next_timestep == nullptr) || + (plugin->close_file_read == nullptr) )) { retval = E_MODE; // check if (basic) writing is supported } else if ( (_mode & M_WRITE) && - ( (plugin->open_file_write == NULL) || - (plugin->write_timestep == NULL) || - (plugin->close_file_write == NULL) )) { + ( (plugin->open_file_write == nullptr) || + (plugin->write_timestep == nullptr) || + (plugin->close_file_write == nullptr) )) { retval = E_MODE; // make some additional check, if we @@ -579,7 +579,7 @@ void MolfileInterface::forget_plugin() close(); if (_plugin) - _plugin = NULL; + _plugin = nullptr; if (_dso) { void *ffunc = my_dlsym(_dso,"vmdplugin_fini"); @@ -587,7 +587,7 @@ void MolfileInterface::forget_plugin() ((finifunc)ffunc)(); my_dlclose(_dso); } - _dso = NULL; + _dso = nullptr; delete[] _name; _name = new char[5]; @@ -608,7 +608,7 @@ int MolfileInterface::open(const char *name, int *natoms) else if (_mode & M_READ) _ptr = p->open_file_read(name,_type,natoms); - if (_ptr == NULL) + if (_ptr == nullptr) return E_FILE; _natoms = *natoms; @@ -681,9 +681,9 @@ int MolfileInterface::close() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } - _ptr = NULL; + _ptr = nullptr; _natoms = 0; return E_NONE; @@ -704,7 +704,7 @@ int MolfileInterface::timestep(float *coords, float *vels, if (_mode & M_WRITE) { t->coords = coords; t->velocities = vels; - if (cell != NULL) { + if (cell != nullptr) { t->A = cell[0]; t->B = cell[1]; t->C = cell[2]; @@ -729,8 +729,8 @@ int MolfileInterface::timestep(float *coords, float *vels, } else { // no coordinate storage => skip step - if (coords == NULL) { - rv = p->read_next_timestep(_ptr, _natoms, NULL); + if (coords == nullptr) { + rv = p->read_next_timestep(_ptr, _natoms, nullptr); } else { t->coords = coords; t->velocities = vels; @@ -742,7 +742,7 @@ int MolfileInterface::timestep(float *coords, float *vels, t->gamma = 90.0f; t->physical_time = 0.0; rv = p->read_next_timestep(_ptr, _natoms, t); - if (cell != NULL) { + if (cell != nullptr) { cell[0] = t->A; cell[1] = t->B; cell[2] = t->C; @@ -823,7 +823,7 @@ static int read_int_property(molfile_atom_t &a, const int propid) static const char *read_string_property(molfile_atom_t &a, const int propid) { - const char *prop = NULL; + const char *prop = nullptr; int iprop = 0; PROPUPDATE(MolfileInterface::P_NAME,name,prop); PROPUPDATE(MolfileInterface::P_TYPE,type,prop); @@ -910,7 +910,7 @@ static int write_atom_property(molfile_atom_t &a, // set/get atom floating point property int MolfileInterface::property(int propid, int idx, float *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -927,7 +927,7 @@ int MolfileInterface::property(int propid, int idx, float *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, float *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -947,7 +947,7 @@ int MolfileInterface::property(int propid, int *types, float *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, float *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -968,7 +968,7 @@ int MolfileInterface::property(int propid, float *prop) // set/get atom floating point property int MolfileInterface::property(int propid, int idx, double *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -985,7 +985,7 @@ int MolfileInterface::property(int propid, int idx, double *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, double *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1005,7 +1005,7 @@ int MolfileInterface::property(int propid, int *types, double *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, double *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1040,7 +1040,7 @@ int MolfileInterface::property(int propid, double *prop) // set/get atom integer property int MolfileInterface::property(int propid, int idx, int *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1065,7 +1065,7 @@ int MolfileInterface::property(int propid, int idx, int *prop) // set/get per type integer property int MolfileInterface::property(int propid, int *types, int *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1094,7 +1094,7 @@ int MolfileInterface::property(int propid, int *types, int *prop) // set/get per atom integer property int MolfileInterface::property(int propid, int *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1125,7 +1125,7 @@ int MolfileInterface::property(int propid, int *prop) // set/get atom string property int MolfileInterface::property(int propid, int idx, char *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1143,7 +1143,7 @@ int MolfileInterface::property(int propid, int idx, char *prop) // set/get per type string property int MolfileInterface::property(int propid, int *types, char **prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1164,7 +1164,7 @@ int MolfileInterface::property(int propid, int *types, char **prop) // set/get per atom string property int MolfileInterface::property(int propid, char **prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index d26a4d4ba0..c991318118 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -42,11 +42,11 @@ static bool is_smalldiff(const float &val1, const float &val2) ReaderMolfile::ReaderMolfile(LAMMPS *lmp) : Reader(lmp) { - mf = NULL; - coords = NULL; - vels = NULL; - types = NULL; - fieldindex = NULL; + mf = nullptr; + coords = nullptr; + vels = nullptr; + types = nullptr; + fieldindex = nullptr; nstep = 0; needvels = 0; me = comm->me; @@ -156,7 +156,7 @@ int ReaderMolfile::read_time(bigint &ntimestep) int rv; // try to read in the time step (coordinates, velocities and cell only) - rv = mf->timestep(coords, vels, cell, NULL); + rv = mf->timestep(coords, vels, cell, nullptr); if (rv != 0) return 1; // we fake time step numbers. @@ -187,7 +187,7 @@ void ReaderMolfile::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index f936de6d02..c48688df4d 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -193,13 +193,13 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp index 19b0632922..4288bf6bab 100644 --- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp +++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -190,13 +190,13 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } @@ -767,7 +767,7 @@ void DumpNetCDFMPIIO::write() // pack my data into buf - pack(NULL); + pack(nullptr); // each process writes its data diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 9c52bdb281..866538dacb 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -56,7 +56,7 @@ void BondClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index 38df4f50da..b881ae3b10 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -57,7 +57,7 @@ void BondFENEExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index 5dde355a76..54a6cd5b3c 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -57,7 +57,7 @@ void BondFENEOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_gromos_omp.cpp b/src/USER-OMP/bond_gromos_omp.cpp index 012737f77d..2469329a52 100644 --- a/src/USER-OMP/bond_gromos_omp.cpp +++ b/src/USER-OMP/bond_gromos_omp.cpp @@ -53,7 +53,7 @@ void BondGromosOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index e8f17d5eae..e9b2d5b103 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 61a60fa995..3d81098d4b 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 50b4ed98a7..ff85a9f009 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 51586370f5..352a7e1e41 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -55,7 +55,7 @@ void BondMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 720d660eae..f7330d1f3e 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -55,7 +55,7 @@ void BondNonlinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_quartic_omp.cpp b/src/USER-OMP/bond_quartic_omp.cpp index bc1ae96ac9..c48c8ae65f 100644 --- a/src/USER-OMP/bond_quartic_omp.cpp +++ b/src/USER-OMP/bond_quartic_omp.cpp @@ -61,7 +61,7 @@ void BondQuarticOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index 3ccc65441a..34f678a224 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -55,7 +55,7 @@ void BondTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index d5480d2a9f..5f27c04e63 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -120,7 +120,7 @@ void EwaldOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, nlocal, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, 0, NULL, NULL, NULL, thr); + ev_setup_thr(eflag, vflag, 0, nullptr, nullptr, nullptr, thr); for (i = ifrom; i < ito; i++) { ek[i][0] = 0.0; diff --git a/src/USER-OMP/fix_neigh_history_omp.cpp b/src/USER-OMP/fix_neigh_history_omp.cpp index 7acded0ab2..02da93ab7d 100644 --- a/src/USER-OMP/fix_neigh_history_omp.cpp +++ b/src/USER-OMP/fix_neigh_history_omp.cpp @@ -138,7 +138,7 @@ void FixNeighHistoryOMP::pre_exchange_onesided() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -276,7 +276,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -289,7 +289,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -444,7 +444,7 @@ void FixNeighHistoryOMP::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index f3c86a7746..7c3591322a 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -61,7 +61,7 @@ static int get_tid() FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), + thr(nullptr), last_omp_style(nullptr), last_pair_hybrid(nullptr), _nthr(-1), _neighbor(true), _mixed(false), _reduced(true), _pair_compute_flag(false), _kspace_compute_flag(false) { @@ -203,8 +203,8 @@ void FixOMP::init() thr[i]->_timer_active=-1; } - if ((strstr(update->integrate_style,"respa") != NULL) - && (strstr(update->integrate_style,"respa/omp") == NULL)) + if ((strstr(update->integrate_style,"respa") != nullptr) + && (strstr(update->integrate_style,"respa/omp") == nullptr)) error->all(FLERR,"Need to use respa/omp for r-RESPA with /omp styles"); if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; @@ -213,18 +213,18 @@ void FixOMP::init() else _kspace_compute_flag = false; int check_hybrid, kspace_split; - last_pair_hybrid = NULL; - last_omp_style = NULL; - const char *last_omp_name = NULL; - const char *last_hybrid_name = NULL; - const char *last_force_name = NULL; + last_pair_hybrid = nullptr; + last_omp_style = nullptr; + const char *last_omp_name = nullptr; + const char *last_hybrid_name = nullptr; + const char *last_force_name = nullptr; // support for verlet/split operation. // kspace_split == 0 : regular processing // kspace_split < 0 : master partition, does not do kspace // kspace_split > 0 : slave partition, only does kspace - if (strstr(update->integrate_style,"verlet/split") != NULL) { + if (strstr(update->integrate_style,"verlet/split") != nullptr) { if (universe->iworld == 0) kspace_split = -1; else kspace_split = 1; } else { diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 5b2ee88420..f88dada706 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -48,13 +48,13 @@ void FixQEQCombOMP::init() if (!atom->q_flag) error->all(FLERR,"Fix qeq/comb/omp requires atom attribute q"); - if (NULL != force->pair_match("comb3",0)) + if (nullptr != force->pair_match("comb3",0)) error->all(FLERR,"No support for comb3 currently available in USER-OMP"); comb = (PairComb *) force->pair_match("comb/omp",1); - if (comb == NULL) + if (comb == nullptr) comb = (PairComb *) force->pair_match("comb",1); - if (comb == NULL) + if (comb == nullptr) error->all(FLERR,"Must use pair_style comb or " "comb/omp with fix qeq/comb/omp"); diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 92c1b73e13..9a4e900840 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -63,7 +63,7 @@ using namespace FixConst; FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : FixQEqReax(lmp, narg, arg) { - b_temp = NULL; + b_temp = nullptr; // ASPC: Kolafa, J. Comp. Chem., 25(3), 335 (2003) do_aspc = 0; @@ -71,7 +71,7 @@ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : // Must be consistent with nprev to store history: nprev = aspc_order + 2 aspc_order_max = nprev - 2; aspc_omega = 0.0; - aspc_b = NULL; + aspc_b = nullptr; } FixQEqReaxOMP::~FixQEqReaxOMP() diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index c42aa8e0c1..81aa380cef 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -46,7 +46,7 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ MSMCGOMP::MSMCGOMP(LAMMPS *lmp) : MSMOMP(lmp), - is_charged(NULL) + is_charged(nullptr) { triclinic_support = 0; diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 97d94e5513..1197e9ebbe 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -71,7 +71,7 @@ void PairADPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_adp(nall, rho, mu, lambda); diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index de6903aab9..401f4a668b 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -56,7 +56,7 @@ void PairAGNIOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) eval<1>(ifrom, ito, thr); else eval<0>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index 837734d6e4..d2c3ef6a09 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -67,7 +67,7 @@ void PairAIREBOOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); FREBO_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv0,thr); if (ljflag) FLJ_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv1,thr); diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 01e33dc5c5..617c237dd9 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -54,7 +54,7 @@ void PairBeckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index b410c998e1..be88df3e7a 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBornCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index 4adba396e8..b161250df8 100644 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBornCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 9bc6507c6a..a426bc93d1 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairBornCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index e74f0139c1..237685b9d2 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -52,7 +52,7 @@ void PairBornOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index b7b82c3dac..afd41668ad 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -48,7 +48,7 @@ PairBrownianOMP::PairBrownianOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianOMP::~PairBrownianOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -127,7 +127,7 @@ void PairBrownianOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial Brownian style // we use is random number generator instance for thread 0 @@ -143,11 +143,11 @@ void PairBrownianOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 4d8b457281..6abd276bff 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -48,7 +48,7 @@ PairBrownianPolyOMP::PairBrownianPolyOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianPolyOMP::~PairBrownianPolyOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -128,7 +128,7 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial BrownianPoly style // we use is random number generator instance for thread 0 @@ -144,11 +144,11 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 1c433f8083..20a4953ef8 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairBuckCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 264073a07e..f0e7edf710 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBuckCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index 631a1ee61d..dd112ba99c 100644 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBuckCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index 00ab1c248c..2b55700972 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -41,7 +41,7 @@ PairBuckLongCoulLongOMP::PairBuckLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -66,7 +66,7 @@ void PairBuckLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -330,7 +330,7 @@ void PairBuckLongCoulLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -355,7 +355,7 @@ void PairBuckLongCoulLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -385,7 +385,7 @@ void PairBuckLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index bddacaf5b5..ab037a204f 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -52,7 +52,7 @@ void PairBuckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index 94325232fc..4509579549 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -56,7 +56,7 @@ void PairColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 9a0155d6d3..c07a6948ae 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -63,7 +63,7 @@ void PairCombOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 57b821cb8b..5f4a792c9d 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -52,7 +52,7 @@ void PairCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index f8b3a36e39..36453b1b32 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 1bb8676998..8a3549b730 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -52,7 +52,7 @@ void PairCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index 62f2580426..f6bdcf8cf8 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -53,7 +53,7 @@ void PairCoulDielOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index 3a8db45634..f7bb7adace 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -61,7 +61,7 @@ void PairCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 92cb51f7a4..12b8fdb2f6 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairCoulLongOMP::PairCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index 28ba13d5cf..0d4dd729db 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -61,7 +61,7 @@ void PairCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index e907d63eb1..4c77b85ae4 100644 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairCoulMSMOMP::PairCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index 71e8148a50..20d45102bd 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 6e3da77cbe..615908f06c 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -35,7 +35,7 @@ PairDPDOMP::PairDPDOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -48,7 +48,7 @@ PairDPDOMP::~PairDPDOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -73,7 +73,7 @@ void PairDPDOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 823367109b..844c79771f 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -36,7 +36,7 @@ PairDPDTstatOMP::PairDPDTstatOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -49,7 +49,7 @@ PairDPDTstatOMP::~PairDPDTstatOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -74,7 +74,7 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index c7559420bc..9a797dafa2 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index 66a7581c21..d474e039bf 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -69,7 +69,7 @@ void PairEAMFSOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index e6ba299a4d..cbdf03a411 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -67,7 +67,7 @@ void PairEAMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eam(nall, rho); diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 864ff68f7a..d0e84be4cf 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -58,7 +58,7 @@ void PairEDIPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 74b460a788..7e25a14a02 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -65,7 +65,7 @@ void PairEIMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eim(nall, rho, fp); diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index a453915738..d2a197291a 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -53,7 +53,7 @@ void PairGaussCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 3e5777e4ec..919ffbe796 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -55,7 +55,7 @@ void PairGaussOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 991c72a9be..d4ee5b2684 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -53,7 +53,7 @@ void PairGayBerneOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 9ad84afb92..2506c4e5b3 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -78,7 +78,7 @@ void PairGranHertzHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 3e519fc0d0..ec87108716 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -79,7 +79,7 @@ void PairGranHookeHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index 8de959a91d..1965c1676b 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -74,7 +74,7 @@ void PairGranHookeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (force->newton_pair) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 338eb52453..8b8dea2a13 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingLJOMP::PairHbondDreidingLJOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingLJOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 5094d5c193..9731972a4b 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingMorseOMP::PairHbondDreidingMorseOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 5aeec25d13..ddbb7ae8e9 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -32,7 +32,7 @@ PairLJ96CutOMP::PairLJ96CutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJ96CutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 3ff02b6109..a7cd7aa76f 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -51,7 +51,7 @@ void PairLJCharmmCoulCharmmImplicitOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 77caf63f18..03d33a6a8a 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -53,7 +53,7 @@ void PairLJCharmmCoulCharmmOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index 56cf0a68dd..ed199dbfd7 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index e19632dc7e..932460a6b9 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongSoftOMP::PairLJCharmmCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index a39ef0aa81..1d9391206c 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCharmmCoulMSMOMP::PairLJCharmmCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCharmmCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 63fb4fe529..50baa7eb86 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2CoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index f618f7f423..85712f22cb 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJClass2CoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 39cc320e44..ae2243daa1 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 27f6132491..1ccade4e62 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -54,7 +54,7 @@ void PairLJCubicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index 2f46e0bfe7..2ab0a4e8c0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index 03f0852b06..d8080656b0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 82031f91ab..d154563344 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index 7ab6f31b3f..fe47e947e5 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -63,7 +63,7 @@ void PairLJCutCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index c7b6de8022..1edeb94b17 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongOMP::PairLJCutCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index 6e804bd8ae..a024db5fc0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongSoftOMP::PairLJCutCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 0e6d11327a..04afd428a0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSMOMP::PairLJCutCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCutCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp index 0e9a333121..9f0577daca 100644 --- a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -55,7 +55,7 @@ void PairLJCutCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index 2cc915a435..b486ba33dd 100644 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutDipoleCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 2aa71026e3..4f8c95a972 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -30,7 +30,7 @@ PairLJCutOMP::PairLJCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 406c5f41d9..dc2441fed2 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -30,7 +30,7 @@ PairLJCutSoftOMP::PairLJCutSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index b921c8f1c1..d79980493a 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -53,7 +53,7 @@ PairLJCutTholeLongOMP::PairLJCutTholeLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -75,7 +75,7 @@ void PairLJCutTholeLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp index 2d1b828822..d11a018a82 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PCutOMP::PairLJCutTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index a60f9d6a57..b712ef8435 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongOMP::PairLJCutTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp index f4a75b9af8..d498da3e86 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongSoftOMP::PairLJCutTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 89077ba6af..ba624ae7d0 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -53,7 +53,7 @@ void PairLJExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 26a6e979b4..7e8a38935d 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsCoulGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index 3082091539..d179831e30 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index cdd62ff96e..76768276c6 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -42,7 +42,7 @@ PairLJLongCoulLongOMP::PairLJLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ void PairLJLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -329,7 +329,7 @@ void PairLJLongCoulLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -354,7 +354,7 @@ void PairLJLongCoulLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -384,7 +384,7 @@ void PairLJLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index af24e93a41..4ba412c66e 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -44,9 +44,9 @@ PairLJLongTIP4PLongOMP::PairLJLongTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; - newsite_thr = NULL; - hneigh_thr = NULL; + cut_respa = nullptr; + newsite_thr = nullptr; + hneigh_thr = nullptr; tip4pflag = dispersionflag = 1; no_virial_fdotr_compute = 1; single_enable = 0; @@ -106,7 +106,7 @@ void PairLJLongTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -389,7 +389,7 @@ void PairLJLongTIP4PLongOMP::compute_inner() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -414,7 +414,7 @@ void PairLJLongTIP4PLongOMP::compute_middle() loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(0, 0, nall, 0, 0, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -468,7 +468,7 @@ void PairLJLongTIP4PLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index 4a53f2c083..f3af43cd50 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -54,7 +54,7 @@ void PairLJSDKCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 4b89375b5b..f05f5e1200 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -60,7 +60,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index d5146c6798..a88a1ded03 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -56,7 +56,7 @@ void PairLJSDKOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 8828b40b98..130ac6e5e7 100644 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -53,7 +53,7 @@ void PairLJSFDipoleSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 2c0c028189..d69cfea0a0 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index 0b4ea4e5f8..1adccbf3cb 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index caf5a11124..17496830f1 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -116,7 +116,7 @@ void PairLubricateOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (evflag) { diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index feb110194f..227c943007 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -113,7 +113,7 @@ void PairLubricatePolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (shearing) { diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index 782371e843..e093e925f1 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -65,7 +65,7 @@ void PairMEAMSplineOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); thr->init_eam(nall,Uprime_values); diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index 48687781ef..aa79a0f05a 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -53,7 +53,7 @@ void PairMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp index 220fb9481d..1896fdcbad 100644 --- a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp @@ -55,7 +55,7 @@ void PairMorseSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index 1cfe576a32..ecdba46e05 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index d9e1231827..09ec46d1c4 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairNMCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index a232da1a90..faa3acefb7 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index 9bf707ad91..b2be373918 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -71,7 +71,7 @@ void PairPeriLPSOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 28df45b67f..b58cadc20c 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -67,7 +67,7 @@ void PairPeriPMBOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index dfc1f428eb..54417f9536 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -92,7 +92,7 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) system->pair_ptr = this; system->omp_active = 1; - num_nbrs_offset = NULL; + num_nbrs_offset = nullptr; #ifdef OMP_TIMING for (int i=0;iget_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index f733b5106f..382a995e2a 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -57,7 +57,7 @@ void PairSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index c2eb4cb156..dac2527053 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -51,7 +51,7 @@ void PairSWOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index f5fbabccab..79128bea8f 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -51,7 +51,7 @@ void PairTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index 83baa56e44..6d2cbf71ac 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -50,7 +50,7 @@ void PairTersoffMODCOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index ab2f07322d..45669dc601 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -52,7 +52,7 @@ void PairTersoffMODOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index a367749978..efafa7949b 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -53,7 +53,7 @@ void PairTersoffOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 8321ad9d9f..277b79b9e7 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -43,8 +43,8 @@ PairTersoffTableOMP::PairTersoffTableOMP(LAMMPS *lmp) : suffix_flag |= Suffix::OMP; respa_enable = 0; - thrGtetaFunction = thrGtetaFunctionDerived = NULL; - thrCutoffFunction = thrCutoffFunctionDerived = NULL; + thrGtetaFunction = thrGtetaFunctionDerived = nullptr; + thrCutoffFunction = thrCutoffFunctionDerived = nullptr; } /* ---------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ void PairTersoffTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (vflag_atom) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 5b983d3db5..a7e087e208 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PCutOMP::PairTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -101,7 +101,7 @@ void PairTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tip4p_long_omp.cpp b/src/USER-OMP/pair_tip4p_long_omp.cpp index 86bebdbeff..75f6850ac3 100644 --- a/src/USER-OMP/pair_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongOMP::PairTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (!ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp index 26e0420955..e408cb7ccb 100644 --- a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongSoftOMP::PairTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_ufm_omp.cpp b/src/USER-OMP/pair_ufm_omp.cpp index e1c2ff457e..202cce567d 100644 --- a/src/USER-OMP/pair_ufm_omp.cpp +++ b/src/USER-OMP/pair_ufm_omp.cpp @@ -55,7 +55,7 @@ void PairUFMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 0637fe3dfc..c1dd45d8b6 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -53,7 +53,7 @@ void PairVashishtaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index 9650a57e72..caf4bb4930 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -51,7 +51,7 @@ void PairVashishtaTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index 227ec0744f..4b595365fd 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 347575e283..78f2a12131 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 9679a00b24..2faf6d1bb0 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -54,7 +54,7 @@ void PairZBLOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp index 80e9b90ecc..bcef3a3c87 100644 --- a/src/USER-OMP/reaxc_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_bonds_omp.cpp @@ -88,7 +88,7 @@ void BondsOMP( reax_system *system, control_params * /* control */, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, system->pair_ptr->vflag_either, system->N, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index ad6ea35eb8..ad474a1cc8 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -165,7 +165,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/thr_data.cpp b/src/USER-OMP/thr_data.cpp index 612c36053c..0ce2c3718a 100644 --- a/src/USER-OMP/thr_data.cpp +++ b/src/USER-OMP/thr_data.cpp @@ -82,33 +82,33 @@ void ThrData::init_force(int nall, double **f, double **torque, memset(virial_imprp,0,6*sizeof(double)); memset(virial_kspce,0,6*sizeof(double)); - eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=NULL; - vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=NULL; + eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=nullptr; + vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=nullptr; if (nall >= 0 && f) { _f = f + _tid*nall; memset(&(_f[0][0]),0,nall*3*sizeof(double)); - } else _f = NULL; + } else _f = nullptr; if (nall >= 0 && torque) { _torque = torque + _tid*nall; memset(&(_torque[0][0]),0,nall*3*sizeof(double)); - } else _torque = NULL; + } else _torque = nullptr; if (nall >= 0 && erforce) { _erforce = erforce + _tid*nall; memset(&(_erforce[0]),0,nall*sizeof(double)); - } else _erforce = NULL; + } else _erforce = nullptr; if (nall >= 0 && de) { _de = de + _tid*nall; memset(&(_de[0]),0,nall*sizeof(double)); - } else _de = NULL; + } else _de = nullptr; if (nall >= 0 && drho) { _drho = drho + _tid*nall; memset(&(_drho[0]),0,nall*sizeof(double)); - } else _drho = NULL; + } else _drho = nullptr; } /* ---------------------------------------------------------------------- @@ -191,8 +191,8 @@ void ThrData::init_pppm(int order, Memory *memory) drho1d = static_cast(_drho1d); if (rho1d) memory->destroy2d_offset(rho1d,-order/2); if (drho1d) memory->destroy2d_offset(drho1d,-order/2); - _rho1d = NULL; - _drho1d = NULL; + _rho1d = nullptr; + _drho1d = nullptr; } } diff --git a/src/USER-OMP/thr_data.h b/src/USER-OMP/thr_data.h index 4b87357101..c942083ef5 100644 --- a/src/USER-OMP/thr_data.h +++ b/src/USER-OMP/thr_data.h @@ -31,7 +31,7 @@ class ThrData { public: ThrData(int tid, class Timer *t); - ~ThrData() { delete _timer; _timer = NULL; }; + ~ThrData() { delete _timer; _timer = nullptr; }; void check_tid(int); // thread id consistency check int get_tid() const { return _tid; }; // our thread id. @@ -140,7 +140,7 @@ class ThrData { // disabled default methods private: - ThrData() : _tid(-1), _timer(NULL) {}; + ThrData() : _tid(-1), _timer(nullptr) {}; }; //////////////////////////////////////////////////////////////////////// diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index 6e096defa8..01e54d3bda 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ThrOMP::ThrOMP(LAMMPS *ptr, int style) - : lmp(ptr), fix(NULL), thr_style(style), thr_error(0) + : lmp(ptr), fix(nullptr), thr_style(style), thr_error(0) { // register fix omp with this class int ifix = lmp->modify->find_fix("package_omp"); @@ -88,7 +88,7 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom, if (nall > 0) memset(&(thr->cvatom_pair[0][0]),0,nall*9*sizeof(double)); } else { - thr->cvatom_pair = NULL; + thr->cvatom_pair = nullptr; } } @@ -199,7 +199,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, if (lmp->force->pair->vflag_fdotr) { // this is a non-hybrid pair style. compute per thread fdotr - if (fix->last_pair_hybrid == NULL) { + if (fix->last_pair_hybrid == nullptr) { if (lmp->neighbor->includegroup == 0) thr->virial_fdotr_compute(x, nlocal, nghost, -1); else diff --git a/src/USER-PHONON/dynamical_matrix.cpp b/src/USER-PHONON/dynamical_matrix.cpp index 238aa7c96e..5451ffba5e 100644 --- a/src/USER-PHONON/dynamical_matrix.cpp +++ b/src/USER-PHONON/dynamical_matrix.cpp @@ -32,7 +32,7 @@ enum{REGULAR,ESKM}; /* ---------------------------------------------------------------------- */ -DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -43,7 +43,7 @@ DynamicalMatrix::~DynamicalMatrix() { if (fp && me == 0) fclose(fp); memory->destroy(groupmap); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ void DynamicalMatrix::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index 382eabe82d..c80073f3c7 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -162,7 +162,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fft = new FFT3d(lmp,world,nz,ny,nx,0,nz-1,0,ny-1,nxlo,nxhi,0,nz-1,0,ny-1,nxlo,nxhi,0,0,&mysize,0); memory->create(fft_data, MAX(1,mynq)*2, "fix_phonon:fft_data"); - // allocate variables; MAX(1,... is used because NULL buffer will result in error for MPI + // allocate variables; MAX(1,... is used because nullptr buffer will result in error for MPI memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); @@ -184,7 +184,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // output some information on the system to log file if (me == 0){ flog = fopen(logfile, "w"); - if (flog == NULL) { + if (flog == nullptr) { char str[MAXLINE]; sprintf(str,"Can not open output file %s",logfile); error->one(FLERR,str); @@ -563,34 +563,34 @@ void FixPhonon::readmap() // read from map file for others char line[MAXLINE]; FILE *fp = fopen(mapfile, "r"); - if (fp == NULL){ + if (fp == nullptr){ sprintf(line,"Cannot open input map file %s", mapfile); error->all(FLERR,line); } - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading header of mapping file!"); nx = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - ny = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nucell = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + ny = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nucell = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); ntotal = nx*ny*nz; if (ntotal*nucell != ngroup) error->all(FLERR,"FFT mesh and number of atoms in group mismatch!"); // second line of mapfile is comment - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading comment of mapping file!"); int ix, iy, iz, iu; // the remaining lines carry the mapping info for (int i = 0; i < ngroup; ++i){ - if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} + if (fgets(line,MAXLINE,fp) == nullptr) {info = 1; break;} ix = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - iy = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iu = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - itag = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + iy = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iu = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + itag = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); // check if index is in correct range if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || diff --git a/src/USER-PHONON/third_order.cpp b/src/USER-PHONON/third_order.cpp index e7997d6397..e72ac0fdf4 100644 --- a/src/USER-PHONON/third_order.cpp +++ b/src/USER-PHONON/third_order.cpp @@ -32,7 +32,7 @@ enum{REGULAR,BALLISTICO}; /* ---------------------------------------------------------------------- */ -ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -42,7 +42,7 @@ ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) ThirdOrder::~ThirdOrder() { if (fp && me == 0) fclose(fp); - fp = NULL; + fp = nullptr; memory->destroy(groupmap); } @@ -220,7 +220,7 @@ void ThirdOrder::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index b7a29c7bc9..3d2acacc1e 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -53,8 +53,8 @@ using namespace FixConst; FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - p(NULL), nlocal(0), gatindex(NULL), masses(NULL), charges(NULL), - id_pe(NULL), id_press(NULL) + p(nullptr), nlocal(0), gatindex(nullptr), masses(nullptr), charges(nullptr), + id_pe(nullptr), id_press(nullptr) { if (!atom->tag_enable) @@ -68,7 +68,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : "Group will be ignored."); #if defined(__PLUMED_DEFAULT_KERNEL) - if (getenv("PLUMED_KERNEL") == NULL) + if (getenv("PLUMED_KERNEL") == nullptr) putenv(plumed_default_kernel); #endif @@ -101,7 +101,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // it is defined inside plumed. p->cmd("GREX setMPIIntercomm",&inter_comm); } - p->cmd("GREX init",NULL); + p->cmd("GREX init",nullptr); } // The general communicator is independent of the existence of partitions, diff --git a/src/USER-PTM/compute_ptm_atom.cpp b/src/USER-PTM/compute_ptm_atom.cpp index 309dd75c19..508c3d0ffd 100644 --- a/src/USER-PTM/compute_ptm_atom.cpp +++ b/src/USER-PTM/compute_ptm_atom.cpp @@ -61,7 +61,7 @@ static const char cite_user_ptm_package[] = /* ---------------------------------------------------------------------- */ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) - : Compute(lmp, narg, arg), list(NULL), output(NULL) { + : Compute(lmp, narg, arg), list(nullptr), output(nullptr) { if (narg < 5 || narg > 6) error->all(FLERR, "Illegal compute ptm/atom command"); @@ -144,7 +144,7 @@ ComputePTMAtom::~ComputePTMAtom() { memory->destroy(output); } /* ---------------------------------------------------------------------- */ void ComputePTMAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR, "Compute ptm/atom requires a pair style be defined"); int count = 0; @@ -201,7 +201,7 @@ static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, double **x = data->x; double *pos = x[atom_index]; - int *jlist = NULL; + int *jlist = nullptr; int jnum = 0; if (atom_index < data->nlocal) { jlist = data->firstneigh[atom_index]; @@ -307,7 +307,7 @@ void ComputePTMAtom::compute_peratom() { ptm_index(local_handle, i, get_neighbours, (void*)&nbrlist, input_flags, standard_orientations, &type, &alloy_type, &scale, &rmsd, q, - NULL, NULL, NULL, NULL, &interatomic_distance, NULL, NULL); + nullptr, nullptr, nullptr, nullptr, &interatomic_distance, nullptr, nullptr); if (rmsd > rmsd_threshold) { type = PTM_MATCH_NONE; diff --git a/src/USER-PTM/ptm_index.cpp b/src/USER-PTM/ptm_index.cpp index cedd35126d..7c912ed5b9 100644 --- a/src/USER-PTM/ptm_index.cpp +++ b/src/USER-PTM/ptm_index.cpp @@ -95,11 +95,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], double *P, double *p_interatomic_distance, double *p_lattice_constant, size_t *output_indices) { const ptm::refdata_t *ref = res->ref_struct; - if (ref == NULL) + if (ref == nullptr) return; *p_type = ref->type; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = ptm::find_alloy_type(ref, res->mapping, numbers); int8_t temp[PTM_MAX_POINTS]; @@ -123,7 +123,7 @@ static void output_data(ptm::result_t *res, double (*points)[3], memcpy(res->mapping, temp, (ref->num_nbrs + 1) * sizeof(int8_t)); - if (F != NULL && F_res != NULL) { + if (F != nullptr && F_res != nullptr) { double scaled_points[PTM_MAX_INPUT_POINTS][3]; ptm::subtract_barycentre(ref->num_nbrs + 1, points, scaled_points); @@ -160,11 +160,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], if (ref->type == PTM_MATCH_GRAPHENE) // hack for pseudo-2d structures F[8] = 1; - if (P != NULL && U != NULL) + if (P != nullptr && U != nullptr) ptm::polar_decomposition_3x3(F, false, U, P); } - if (output_indices != NULL) + if (output_indices != nullptr) for (int i = 0; i < ref->num_nbrs + 1; i++) output_indices[i] = ordering[res->mapping[i]]; @@ -173,10 +173,10 @@ static void output_data(ptm::result_t *res, double (*points)[3], double lattice_constant = calculate_lattice_constant(ref->type, interatomic_distance); - if (p_interatomic_distance != NULL) + if (p_interatomic_distance != nullptr) *p_interatomic_distance = interatomic_distance; - if (p_lattice_constant != NULL) + if (p_lattice_constant != nullptr) *p_lattice_constant = lattice_constant; *p_rmsd = res->rmsd; @@ -200,7 +200,7 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, int ret = 0; ptm::result_t res; - res.ref_struct = NULL; + res.ref_struct = nullptr; res.rmsd = INFINITY; size_t ordering[PTM_MAX_INPUT_POINTS]; @@ -269,13 +269,13 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, } *p_type = PTM_MATCH_NONE; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = PTM_ALLOY_NONE; - if (output_indices != NULL) + if (output_indices != nullptr) memset(output_indices, -1, PTM_MAX_INPUT_POINTS * sizeof(size_t)); - if (res.ref_struct == NULL) + if (res.ref_struct == nullptr) return PTM_NO_ERROR; if (res.ref_struct->type == PTM_MATCH_DCUB || diff --git a/src/USER-PTM/ptm_initialize_data.h b/src/USER-PTM/ptm_initialize_data.h index 87111b1282..dd1cddd9f2 100644 --- a/src/USER-PTM/ptm_initialize_data.h +++ b/src/USER-PTM/ptm_initialize_data.h @@ -50,17 +50,17 @@ const refdata_t structure_sc = { PTM_MATCH_SC, //. NUM_SC_GRAPHS, //.num_graphs graphs_sc, //.graphs ptm_template_sc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_sc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_sc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_fcc = { PTM_MATCH_FCC, //.type @@ -70,17 +70,17 @@ const refdata_t structure_fcc = { PTM_MATCH_FCC, / NUM_FCC_GRAPHS, //.num_graphs graphs_fcc, //.graphs ptm_template_fcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_fcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_fcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_hcp = { PTM_MATCH_HCP, //.type @@ -91,12 +91,12 @@ const refdata_t structure_hcp = { PTM_MATCH_HCP, / graphs_hcp, //.graphs ptm_template_hcp, //.points ptm_template_hcp_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_hcp, //.penrose penrose_hcp_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_HEX_MAPPINGS, //.num_mappings mapping_hcp, //.mapping mapping_hcp_conventional, //.mapping_conventional @@ -110,17 +110,17 @@ const refdata_t structure_ico = { PTM_MATCH_ICO, / NUM_ICO_GRAPHS, //.num_graphs graphs_ico, //.graphs ptm_template_ico, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_ico, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_ICO_MAPPINGS, //.num_mappings mapping_ico, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_bcc = { PTM_MATCH_BCC, //.type @@ -130,17 +130,17 @@ const refdata_t structure_bcc = { PTM_MATCH_BCC, / NUM_BCC_GRAPHS, //.num_graphs graphs_bcc, //.graphs ptm_template_bcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_bcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_bcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_dcub = { PTM_MATCH_DCUB, //.type @@ -151,12 +151,12 @@ const refdata_t structure_dcub = { PTM_MATCH_DCUB, graphs_dcub, //.graphs ptm_template_dcub, //.points ptm_template_dcub_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_dcub, //.penrose penrose_dcub_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_DCUB_MAPPINGS, //.num_mappings mapping_dcub, //.mapping mapping_dcub_conventional, //.mapping_conventional @@ -188,15 +188,15 @@ const refdata_t structure_graphene = { PTM_MATCH_GRAPHENE, -1, //.num_facets -1, //.max_degree -1, //.num_graphs - NULL, //.graphs + nullptr, //.graphs ptm_template_graphene, //.points ptm_template_graphene_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_graphene, //.penrose penrose_graphene_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 -1, //.num_mappings mapping_graphene, //.mapping mapping_graphene_conventional, //.mapping_conventional diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 9f07030004..f6d0f9300a 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -169,7 +169,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -191,7 +191,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -242,7 +242,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -250,7 +250,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -353,11 +353,11 @@ FixQMMM::FixQMMM(LAMMPS *lmp, int narg, char **arg) : mm_comm = MPI_Comm_f2c(qmmmcfg.mm_comm); /* initialize storage */ - qm_idmap = mm_idmap = NULL; - qm_remap = mm_remap = NULL; - qm_coord = mm_coord = qm_force = mm_force = NULL; - qm_charge =NULL; - mm_type = NULL; + qm_idmap = mm_idmap = nullptr; + qm_remap = mm_remap = nullptr; + qm_coord = mm_coord = qm_force = mm_force = nullptr; + qm_charge =nullptr; + mm_type = nullptr; do_init = 1; diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 034738023c..2b05ce5436 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -246,19 +246,19 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : peflag = 1; // allocate qbmsst - temperature = NULL; - pressure = NULL; - pe = NULL; - old_velocity = NULL; - rfix = NULL; - gfactor = NULL; - random = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; + old_velocity = nullptr; + rfix = nullptr; + gfactor = nullptr; + random = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; // initialize Marsagxlia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -331,7 +331,7 @@ void FixQBMSST::init() boltz = force->boltz; nktv2p = force->nktv2p; mvv2e = force->mvv2e; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix qbmsst without per-type mass defined"); // set compute ptrs diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index 3f29229beb..ff36326edb 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -94,16 +94,16 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : maxexchange = 6*N_f+3; // allocate qtb - gfactor1 = NULL; - gfactor3 = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; - id_temp = NULL; - temperature = NULL; + gfactor1 = nullptr; + gfactor3 = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; + id_temp = nullptr; + temperature = nullptr; // initialize Marsaglia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -158,7 +158,7 @@ void FixQTB::init() { // copy parameters from other classes double dtv = update->dt; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); //initiate the counter \mu diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 5511efe681..d2093941a0 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -45,10 +45,10 @@ PairQUIP::PairQUIP(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; manybody_flag = 1; - map = NULL; - quip_potential = NULL; - quip_file = NULL; - quip_string = NULL; + map = nullptr; + quip_potential = nullptr; + quip_file = nullptr; + quip_string = nullptr; } PairQUIP::~PairQUIP() diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 5d57b74056..41a2244d44 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -92,10 +92,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_react); - fix1 = NULL; - fix2 = NULL; - fix3 = NULL; - reset_mol_ids = NULL; + fix1 = nullptr; + fix2 = nullptr; + fix3 = nullptr; + reset_mol_ids = nullptr; if (narg < 8) error->all(FLERR,"Illegal fix bond/react command: " "too few arguments"); @@ -116,12 +116,12 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : narrhenius = 0; status = PROCEED; - nxspecial = NULL; - onemol_nxspecial = NULL; - twomol_nxspecial = NULL; - xspecial = NULL; - onemol_xspecial = NULL; - twomol_xspecial = NULL; + nxspecial = nullptr; + onemol_nxspecial = nullptr; + twomol_nxspecial = nullptr; + xspecial = nullptr; + onemol_xspecial = nullptr; + twomol_xspecial = nullptr; // these group names are reserved for use exclusively by bond/react master_group = (char *) "bond_react_MASTER_group"; @@ -472,16 +472,16 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; - probability = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; + probability = nullptr; maxcreate = 0; - created = NULL; - ncreate = NULL; + created = nullptr; + ncreate = nullptr; allncreate = 0; local_num_mega = 0; ghostly_num_mega = 0; - restore = NULL; + restore = nullptr; // zero out stats global_megasize = 0; @@ -489,17 +489,17 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : glove_counter = 0; guess_branch = new int[MAXGUESS](); pioneer_count = new int[max_natoms]; - local_mega_glove = NULL; - ghostly_mega_glove = NULL; - global_mega_glove = NULL; + local_mega_glove = nullptr; + ghostly_mega_glove = nullptr; + global_mega_glove = nullptr; // these are merely loop indices that became important pion = neigh = trace = 0; - id_fix1 = NULL; - id_fix2 = NULL; - id_fix3 = NULL; - statted_id = NULL; + id_fix1 = nullptr; + id_fix2 = nullptr; + id_fix3 = nullptr; + statted_id = nullptr; custom_exclude_flag = 0; // used to store restart info @@ -708,7 +708,7 @@ void FixBondReact::post_constructor() int unused; char * idprop; idprop = (char *) fix->extract("property",unused); - if (idprop == NULL) + if (idprop == nullptr) error->all(FLERR,"Exclude group must be a per-atom property group"); len = strlen(idprop) + 1; @@ -750,7 +750,7 @@ void FixBondReact::init() // check cutoff for iatomtype,jatomtype for (int i = 0; i < nreacts; i++) { - if (force->pair == NULL || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) + if (force->pair == nullptr || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) error->all(FLERR,"Bond/react: Fix bond/react cutoff is longer than pairwise cutoff"); } @@ -3132,7 +3132,7 @@ void FixBondReact::read(int myrxn) // skip 1st line of file eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); + if (eof == nullptr) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); // read header lines // skip blank lines or lines that start with "#" @@ -3403,7 +3403,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int mode, int myID) void FixBondReact::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Bond/react: Cannot open map file %s",file); error->one(FLERR,str); @@ -3414,7 +3414,7 @@ void FixBondReact::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -3431,11 +3431,11 @@ void FixBondReact::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return @@ -3477,7 +3477,7 @@ int FixBondReact::parse(char *line, char **words, int max) int nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((ptr = strtok(NULL," \t\n\r\f"))) { + while ((ptr = strtok(nullptr," \t\n\r\f"))) { if (nwords < max) words[nwords] = ptr; nwords++; } diff --git a/src/USER-REAXC/compute_spec_atom.cpp b/src/USER-REAXC/compute_spec_atom.cpp index bc5b26b699..1c4856d728 100644 --- a/src/USER-REAXC/compute_spec_atom.cpp +++ b/src/USER-REAXC/compute_spec_atom.cpp @@ -117,8 +117,8 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index fea8b39f54..08bf75b76f 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -60,7 +60,7 @@ static const char cite_fix_qeq_reax[] = /* ---------------------------------------------------------------------- */ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pertype_option(NULL) + Fix(lmp, narg, arg), pertype_option(nullptr) { if (narg<8 || narg>11) error->all(FLERR,"Illegal fix qeq/reax command"); @@ -90,33 +90,33 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix qeq/reax command"); iarg++; } - shld = NULL; + shld = nullptr; nn = n_cap = 0; NN = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 4; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; - b_prc = NULL; - b_prm = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; + b_prc = nullptr; + b_prm = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // dual CG support // Update comm sizes for this fix @@ -126,10 +126,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - reaxc = NULL; + reaxc = nullptr; reaxc = (PairReaxC *) force->pair_match("^reax/c",0); - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; atom->add_callback(0); } @@ -194,13 +194,13 @@ void FixQEqReax::pertype_parameters(char *arg) if (strcmp(arg,"reax/c") == 0) { reaxflag = 1; Pair *pair = force->pair_match("reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/reax"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/reax"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/reax could not extract params from pair reax/c"); return; @@ -218,7 +218,7 @@ void FixQEqReax::pertype_parameters(char *arg) memory->create(gamma,ntypes+1,"qeq/reax:gamma"); if (comm->me == 0) { - if ((pf = fopen(arg,"r")) == NULL) + if ((pf = fopen(arg,"r")) == nullptr) error->one(FLERR,"Fix qeq/reax parameter file could not be found"); for (i = 1; i <= ntypes && !feof(pf); i++) { @@ -389,7 +389,7 @@ void FixQEqReax::init_shielding() int ntypes; ntypes = atom->ntypes; - if (shld == NULL) + if (shld == nullptr) memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); for (i = 1; i <= ntypes; ++i) diff --git a/src/USER-REAXC/fix_reaxc.cpp b/src/USER-REAXC/fix_reaxc.cpp index c98adf5b45..14f4762ce1 100644 --- a/src/USER-REAXC/fix_reaxc.cpp +++ b/src/USER-REAXC/fix_reaxc.cpp @@ -41,8 +41,8 @@ FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : // register with atom class oldnmax = 0; - num_bonds = NULL; - num_hbonds = NULL; + num_bonds = nullptr; + num_hbonds = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index c0ffd4c17e..a16446e769 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -65,7 +65,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[4],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/bonds file %s",arg[4]); error->one(FLERR,str); @@ -75,9 +75,9 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : if (atom->tag_consecutive() == 0) error->all(FLERR,"Atom IDs must be consecutive for fix reax/c bonds"); - abo = NULL; - neighid = NULL; - numneigh = NULL; + abo = nullptr; + neighid = nullptr; + numneigh = nullptr; allocate(); } @@ -114,7 +114,7 @@ void FixReaxCBonds::setup(int /*vflag*/) void FixReaxCBonds::init() { reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); } @@ -235,7 +235,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) } j += (5+numbonds); - if (atom->molecule == NULL ) buf[j] = 0.0; + if (atom->molecule == nullptr ) buf[j] = 0.0; else buf[j] = atom->molecule[i]; j ++; diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index ec03ab1808..9527485705 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -97,7 +97,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : error->warning(FLERR,"Resetting reneighboring criteria for fix reax/c/species"); } - tmparg = NULL; + tmparg = nullptr; memory->create(tmparg,4,4,"reax/c/species:tmparg"); strcpy(tmparg[0],arg[3]); strcpy(tmparg[1],arg[4]); @@ -119,28 +119,28 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[6],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/species file %s",arg[6]); error->one(FLERR,str); } } - x0 = NULL; - clusterID = NULL; + x0 = nullptr; + clusterID = nullptr; int ntmp = 1; memory->create(x0,ntmp,"reax/c/species:x0"); memory->create(clusterID,ntmp,"reax/c/species:clusterID"); vector_atom = clusterID; - BOCut = NULL; - Name = NULL; - MolName = NULL; - MolType = NULL; - NMol = NULL; - nd = NULL; - molmap = NULL; + BOCut = nullptr; + Name = nullptr; + MolName = nullptr; + MolType = nullptr; + NMol = nullptr; + nd = nullptr; + molmap = nullptr; nmax = 0; setupflag = 0; @@ -156,8 +156,8 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : BOCut[i][j] = bg_cut; // optional args - eletype = NULL; - ele = filepos = NULL; + eletype = nullptr; + ele = filepos = nullptr; eleflag = posflag = padflag = 0; singlepos_opened = multipos_opened = 0; @@ -213,7 +213,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else { if (me == 0) { pos = fopen(filepos, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); } singlepos_opened = 1; multipos = 0; @@ -278,7 +278,7 @@ int FixReaxCSpecies::setmask() void FixReaxCSpecies::setup(int /*vflag*/) { ntotal = static_cast (atom->natoms); - if (Name == NULL) + if (Name == nullptr) memory->create(Name,ntypes,"reax/c/species:Name"); post_integrate(); @@ -292,7 +292,7 @@ void FixReaxCSpecies::init() error->all(FLERR,"Cannot use fix reax/c/species unless atoms have IDs"); reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/species without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/species without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); reaxc->fixspecies_flag = 1; @@ -579,7 +579,7 @@ void FixReaxCSpecies::FindMolecule () void FixReaxCSpecies::SortMolecule(int &Nmole) { memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; int n, idlo, idhi; int *mask =atom->mask; @@ -641,7 +641,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) } memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; } @@ -656,11 +656,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) int *Nameall, *NMolall; memory->destroy(MolName); - MolName = NULL; + MolName = nullptr; memory->create(MolName,Nmole*(ntypes+1),"reax/c/species:MolName"); memory->destroy(NMol); - NMol = NULL; + NMol = nullptr; memory->create(NMol,Nmole,"reax/c/species:NMol"); for (m = 0; m < Nmole; m ++) NMol[m] = 1; @@ -705,11 +705,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) memory->destroy(Nameall); memory->destroy(nd); - nd = NULL; + nd = nullptr; memory->create(nd,Nspec,"reax/c/species:nd"); memory->destroy(MolType); - MolType = NULL; + MolType = nullptr; memory->create(MolType,Nspec*(ntypes+2),"reax/c/species:MolType"); } @@ -793,8 +793,8 @@ void FixReaxCSpecies::OpenPos() if (me == 0) { pos = fopen(filecurrent, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); - } else pos = NULL; + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); + } else pos = nullptr; multipos_opened = 1; free(filecurrent); @@ -831,7 +831,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) fprintf(pos,"ID\tAtom_Count\tType\tAve_q\t\tCoM_x\t\tCoM_y\t\tCoM_z\n"); } - Nameall = NULL; + Nameall = nullptr; memory->create(Nameall,ntypes,"reax/c/species:Nameall"); for (m = 1; m <= Nmole; m ++) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c38257ae30..6a2ba7d754 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -117,16 +117,16 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->bndry_cuts.ghost_hbond = 0; system->bndry_cuts.ghost_bond = 0; system->bndry_cuts.ghost_cutoff = 0; - system->my_atoms = NULL; + system->my_atoms = nullptr; system->pair_ptr = this; system->error_ptr = error; control->error_ptr = error; system->omp_active = 0; - fix_reax = NULL; - tmpid = NULL; - tmpbo = NULL; + fix_reax = nullptr; + tmpid = nullptr; + tmpbo = nullptr; nextra = 14; pvector = new double[nextra]; @@ -318,7 +318,7 @@ void PairReaxC::coeff( int nargs, char **args ) char *file = args[2]; FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if (fp != NULL) + if (fp != nullptr) Read_Force_Field(fp, &(system->reax_param), control); else { char str[128]; @@ -327,7 +327,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr int itmp = 0; int nreax_types = system->reax_param.num_atom_types; @@ -424,7 +424,7 @@ void PairReaxC::init_style( ) if (lists[i].allocated != 1) lists[i].allocated = 0; - if (fix_reax == NULL) { + if (fix_reax == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) fix_id; fixarg[1] = (char *) "all"; @@ -819,7 +819,7 @@ void *PairReaxC::extract(const char *str, int &dim) else gamma[i] = 0.0; return (void *) gamma; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index f0b0e82299..0390769b53 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -57,10 +57,10 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); #ifdef LMP_USER_OMP - workspace->CdDeltaReduction = NULL; - workspace->forceReduction = NULL; - workspace->valence_angle_atom_myoffset = NULL; - workspace->my_ext_pressReduction = NULL; + workspace->CdDeltaReduction = nullptr; + workspace->forceReduction = nullptr; + workspace->valence_angle_atom_myoffset = nullptr; + workspace->my_ext_pressReduction = nullptr; #else LMP_UNUSED_PARAM(workspace); #endif diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 12aa989fa2..1c8c24c315 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -41,7 +41,7 @@ char Read_Control_File( char *control_file, control_params* control, double val; /* open control file */ - if ( (fp = fopen( control_file, "r" ) ) == NULL ) { + if ( (fp = fopen( control_file, "r" ) ) == nullptr ) { control->error_ptr->all(FLERR, "The control file cannot be opened"); } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index f68a2a2abb..866e3c9891 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -50,7 +50,7 @@ int Init_Output_Files( reax_system *system, control_params *control, /* init potentials file */ sprintf( temp, "%s.pot", control->sim_name ); - if ((out_control->pot = fopen( temp, "w" )) != NULL) { + if ((out_control->pot = fopen( temp, "w" )) != nullptr) { fflush( out_control->pot ); } else { strcpy( msg, "init_out_controls: .pot file could not be opened\n" ); @@ -65,7 +65,7 @@ int Init_Output_Files( reax_system *system, control_params *control, control->ensemble == iNPT || control->ensemble == sNPT ) { sprintf( temp, "%s.prs", control->sim_name ); - if ((out_control->prs = fopen( temp, "w" )) != NULL) { + if ((out_control->prs = fopen( temp, "w" )) != nullptr) { fprintf(out_control->prs,"%8s%13s%13s%13s%13s%13s%13s%13s\n", "step", "Pint/norm[x]", "Pint/norm[y]", "Pint/norm[z]", "Pext/Ptot[x]", "Pext/Ptot[y]", "Pext/Ptot[z]", "Pkin/V" ); @@ -91,12 +91,12 @@ int Close_Output_Files( reax_system *system, control_params * /* control */, if (system->my_rank == MASTER_NODE) { if (out_control->pot) { fclose( out_control->pot ); - out_control->pot = NULL; + out_control->pot = nullptr; } if (out_control->prs) { fclose(out_control->prs); - out_control->prs = NULL; + out_control->prs = nullptr; } } diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 0880d96311..ea59b84ff9 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -106,37 +106,37 @@ void Delete_List( reax_list *l ) sfree(l->error_ptr, l->index, "list:index" ); sfree(l->error_ptr, l->end_index, "list:end_index" ); - l->index = NULL; - l->end_index = NULL; + l->index = nullptr; + l->end_index = nullptr; switch(l->type) { case TYP_VOID: sfree(l->error_ptr, l->select.v, "list:v" ); - l->select.v = NULL; + l->select.v = nullptr; break; case TYP_HBOND: sfree(l->error_ptr, l->select.hbond_list, "list:hbonds" ); - l->select.hbond_list = NULL; + l->select.hbond_list = nullptr; break; case TYP_FAR_NEIGHBOR: sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs" ); - l->select.far_nbr_list = NULL; + l->select.far_nbr_list = nullptr; break; case TYP_BOND: sfree(l->error_ptr, l->select.bond_list, "list:bonds" ); - l->select.bond_list = NULL; + l->select.bond_list = nullptr; break; case TYP_DBO: sfree(l->error_ptr, l->select.dbo_list, "list:dbos" ); - l->select.dbo_list = NULL; + l->select.dbo_list = nullptr; break; case TYP_DDELTA: sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas" ); - l->select.dDelta_list = NULL; + l->select.dDelta_list = nullptr; break; case TYP_THREE_BODY: sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies" ); - l->select.three_body_list = NULL; + l->select.three_body_list = nullptr; break; default: diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index 07a45b9467..b78b00568d 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -48,7 +48,7 @@ double Get_Time( ) t /= 1000.0; return t; #else - gettimeofday(&tim, NULL ); + gettimeofday(&tim, nullptr ); return( tim.tv_sec + (tim.tv_usec / 1000000.0) ); #endif } @@ -62,7 +62,7 @@ int Tokenize( char* s, char*** tok ) strncpy( test, s, MAX_LINE-1); - for( word = strtok(test, sep); word; word = strtok(NULL, sep) ) { + for( word = strtok(test, sep); word; word = strtok(nullptr, sep) ) { strncpy( (*tok)[count], word, MAX_LINE ); count++; } @@ -84,11 +84,11 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = malloc( n ); - if (ptr == NULL) { + if (ptr == nullptr) { snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); @@ -109,7 +109,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL.\n", n, name ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } if (size <= 0) { @@ -117,11 +117,11 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL", name, size ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = calloc( n, size ); - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -135,7 +135,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c /* safe free */ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) { - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -144,6 +144,6 @@ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) } free( ptr ); - ptr = NULL; + ptr = nullptr; } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 717bf741e7..698715de22 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -41,7 +41,7 @@ int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_ out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (out_control->buffer == NULL) { + if (out_control->buffer == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*REAX_SAFE_ZONE)); error_ptr->one(FLERR,errmsg); @@ -341,7 +341,7 @@ int Init_Traj( reax_system *system, control_params *control, /* allocate line & buffer space */ out_control->line = (char*) calloc( MAX_TRJ_LINE_LEN + 1, sizeof(char) ); out_control->buffer_len = 0; - out_control->buffer = NULL; + out_control->buffer = nullptr; /* write trajectory header and atom info, if applicable */ if (out_control->traj_method == REG_TRAJ) { diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index c49f99a5a0..4dd796a340 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -42,10 +42,10 @@ Scafacos::Scafacos(LAMMPS *lmp) : KSpace(lmp) initialized = 0; maxatom = 0; - xpbc = NULL; - epot = NULL; - efield = NULL; - fcs = NULL; + xpbc = nullptr; + epot = nullptr; + efield = nullptr; + fcs = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SDPD/fix_meso_move.cpp b/src/USER-SDPD/fix_meso_move.cpp index c39d142a6e..45843268f0 100644 --- a/src/USER-SDPD/fix_meso_move.cpp +++ b/src/USER-SDPD/fix_meso_move.cpp @@ -43,9 +43,9 @@ enum{EQUAL,ATOM}; FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), - vxvarstr(NULL), vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), displace(NULL), velocity(NULL) { + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), + vxvarstr(nullptr), vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), displace(nullptr), velocity(nullptr) { if ((atom->esph_flag != 1) || (atom->rho_flag != 1)) error->all(FLERR, "fix meso/move command requires atom_style with both energy and density"); @@ -126,37 +126,37 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix meso/move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -237,7 +237,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : atom->add_callback(0); atom->add_callback(1); - displace = velocity = NULL; + displace = velocity = nullptr; // xoriginal = initial unwrapped positions of atoms @@ -353,9 +353,9 @@ void FixMesoMove::init () { memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; } void FixMesoMove::setup_pre_force (int /*vflag*/) { @@ -731,7 +731,7 @@ void FixMesoMove::initial_integrate (int /*vflag*/) { } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMesoMove::final_integrate () { diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index bf2fc73b01..b3a084ab1d 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -307,7 +307,7 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { void PairSDPDTaitwaterIsothermal::init_style() { - if ((!atom->rho_flag) || (atom->drho == NULL)) + if ((!atom->rho_flag) || (atom->drho == nullptr)) error->all(FLERR,"Pair style dpd/taitwater/isothermal requires atom " "attributes rho and drho"); diff --git a/src/USER-SMD/compute_smd_contact_radius.cpp b/src/USER-SMD/compute_smd_contact_radius.cpp index 46cbc602f2..ccab79f85e 100644 --- a/src/USER-SMD/compute_smd_contact_radius.cpp +++ b/src/USER-SMD/compute_smd_contact_radius.cpp @@ -46,7 +46,7 @@ ComputeSMDContactRadius::ComputeSMDContactRadius(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - contact_radius_vector = NULL; + contact_radius_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_damage.cpp b/src/USER-SMD/compute_smd_damage.cpp index 96a936cd82..9e58903c95 100644 --- a/src/USER-SMD/compute_smd_damage.cpp +++ b/src/USER-SMD/compute_smd_damage.cpp @@ -46,7 +46,7 @@ ComputeSMDDamage::ComputeSMDDamage(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - damage_vector = NULL; + damage_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_hourglass_error.cpp b/src/USER-SMD/compute_smd_hourglass_error.cpp index 3b6b900004..4118025039 100644 --- a/src/USER-SMD/compute_smd_hourglass_error.cpp +++ b/src/USER-SMD/compute_smd_hourglass_error.cpp @@ -49,7 +49,7 @@ ComputeSMDHourglassError::ComputeSMDHourglassError(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - hourglass_error_vector = NULL; + hourglass_error_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void ComputeSMDHourglassError::compute_peratom() { int itmp = 0; double *hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); - if (hourglass_error == NULL) { + if (hourglass_error == nullptr) { error->all(FLERR, "compute smd/hourglass_error failed to access hourglass_error array"); } diff --git a/src/USER-SMD/compute_smd_internal_energy.cpp b/src/USER-SMD/compute_smd_internal_energy.cpp index 90ddb74839..c7b11e22cf 100644 --- a/src/USER-SMD/compute_smd_internal_energy.cpp +++ b/src/USER-SMD/compute_smd_internal_energy.cpp @@ -46,7 +46,7 @@ ComputeSMDInternalEnergy::ComputeSMDInternalEnergy(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - internal_energy_vector = NULL; + internal_energy_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain.cpp b/src/USER-SMD/compute_smd_plastic_strain.cpp index c1c001a5dd..842d848890 100644 --- a/src/USER-SMD/compute_smd_plastic_strain.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrain::ComputeSMDPlasticStrain(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - plastic_strain_vector = NULL; + plastic_strain_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp index 272a2c59e5..907e503f54 100644 --- a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrainRate::ComputeSMDPlasticStrainRate(LAMMPS *lmp, int narg, size_peratom_cols = 0; nmax = 0; - plastic_strain_rate_vector = NULL; + plastic_strain_rate_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_rho.cpp b/src/USER-SMD/compute_smd_rho.cpp index d9c0a99b07..89db0b0acd 100644 --- a/src/USER-SMD/compute_smd_rho.cpp +++ b/src/USER-SMD/compute_smd_rho.cpp @@ -46,7 +46,7 @@ ComputeSMDRho::ComputeSMDRho(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp index 81792355e0..b283a41c4f 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp @@ -49,7 +49,7 @@ ComputeSMDTLSPHDefgrad::ComputeSMDTLSPHDefgrad(LAMMPS *lmp, int narg, char **arg size_peratom_cols = 10; nmax = 0; - defgradVector = NULL; + defgradVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_dt.cpp b/src/USER-SMD/compute_smd_tlsph_dt.cpp index 7752436b8a..a02ff838d4 100644 --- a/src/USER-SMD/compute_smd_tlsph_dt.cpp +++ b/src/USER-SMD/compute_smd_tlsph_dt.cpp @@ -49,7 +49,7 @@ ComputeSMDTlsphDt::ComputeSMDTlsphDt(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMDTlsphDt::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/tlsph_dt failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp index 347b138412..f5f14fa500 100644 --- a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDTLSPHNumNeighs::ComputeSMDTLSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsRefConfigOutput = NULL; + numNeighsRefConfigOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDTLSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighsRefConfig = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (numNeighsRefConfig == NULL) { + if (numNeighsRefConfig == nullptr) { error->all(FLERR, "compute smd/tlsph_num_neighs failed to access numNeighsRefConfig array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_shape.cpp b/src/USER-SMD/compute_smd_tlsph_shape.cpp index a3727871de..a978fd2e9e 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.cpp +++ b/src/USER-SMD/compute_smd_tlsph_shape.cpp @@ -51,7 +51,7 @@ ComputeSmdTlsphShape::ComputeSmdTlsphShape(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 7; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,12 +89,12 @@ void ComputeSmdTlsphShape::compute_peratom() { int itmp = 0; Matrix3d *R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); - if (R == NULL) { + if (R == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access rotation array"); } Matrix3d *F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (F == NULL) { + if (F == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access deformation gradient array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain.cpp b/src/USER-SMD/compute_smd_tlsph_strain.cpp index db51ca4125..5e86f4fd38 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHstrain::ComputeSMDTLSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ void ComputeSMDTLSPHstrain::compute_peratom() { // copy data to output array int itmp = 0; Matrix3d *Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (Fincr == NULL) { + if (Fincr == nullptr) { error->all(FLERR, "compute smd/tlsph_strain failed to access Fincr array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp index 577dc0e40f..3d9f467694 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHStrainRate::ComputeSMDTLSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,7 +89,7 @@ void ComputeSMDTLSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); - if (D == NULL) { + if (D == nullptr) { error->all(FLERR, "compute smd/tlsph_strain_rate could not access strain rate. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_tlsph_stress.cpp b/src/USER-SMD/compute_smd_tlsph_stress.cpp index 9c78b192ce..f668a7f82b 100644 --- a/src/USER-SMD/compute_smd_tlsph_stress.cpp +++ b/src/USER-SMD/compute_smd_tlsph_stress.cpp @@ -60,7 +60,7 @@ ComputeSMDTLSPHStress::ComputeSMDTLSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDTLSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/tlsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_triangle_vertices.cpp b/src/USER-SMD/compute_smd_triangle_vertices.cpp index 06706a85ad..46555559d3 100644 --- a/src/USER-SMD/compute_smd_triangle_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_vertices.cpp @@ -46,7 +46,7 @@ ComputeSMDTriangleVertices::ComputeSMDTriangleVertices(LAMMPS *lmp, int narg, ch size_peratom_cols = 9; nmax = 0; - outputVector = NULL; + outputVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_effm.cpp b/src/USER-SMD/compute_smd_ulsph_effm.cpp index fc8637bbf0..4285d1c981 100644 --- a/src/USER-SMD/compute_smd_ulsph_effm.cpp +++ b/src/USER-SMD/compute_smd_ulsph_effm.cpp @@ -49,7 +49,7 @@ ComputeSMD_Ulsph_Effm::ComputeSMD_Ulsph_Effm(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMD_Ulsph_Effm::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/ulsph_effm failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp index 4ef339db98..57460c2929 100644 --- a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDULSPHNumNeighs::ComputeSMDULSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsOutput = NULL; + numNeighsOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDULSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighs = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (numNeighs == NULL) { + if (numNeighs == nullptr) { error->all(FLERR, "compute smd/ulsph_num_neighs failed to access numNeighs array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_strain.cpp b/src/USER-SMD/compute_smd_ulsph_strain.cpp index cf1535759c..a4211a6b60 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDULSPHstrain::ComputeSMDULSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp index f5ff4fef98..9118e6dded 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp @@ -49,7 +49,7 @@ ComputeSMDULSPHStrainRate::ComputeSMDULSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ void ComputeSMDULSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->all(FLERR, "compute smd/ulsph_strain_rate could not access any velocity gradients. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_ulsph_stress.cpp b/src/USER-SMD/compute_smd_ulsph_stress.cpp index ea477375ce..c7078a5741 100644 --- a/src/USER-SMD/compute_smd_ulsph_stress.cpp +++ b/src/USER-SMD/compute_smd_ulsph_stress.cpp @@ -59,7 +59,7 @@ ComputeSMDULSPHStress::ComputeSMDULSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDULSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/ulsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_vol.cpp b/src/USER-SMD/compute_smd_vol.cpp index 5999dfaa5d..46aa7ea3c4 100644 --- a/src/USER-SMD/compute_smd_vol.cpp +++ b/src/USER-SMD/compute_smd_vol.cpp @@ -48,7 +48,7 @@ ComputeSMDVol::ComputeSMDVol(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - volVector = NULL; + volVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index b5dab3d3a1..ccb64b8f2f 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -108,28 +108,28 @@ void FixSMDTlsphDtReset::end_of_step() { double *dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); double *dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); - if ((dtCFL_TLSPH == NULL) && (dtCFL_ULSPH == NULL) && (dt_TRI == NULL) && (dt_HERTZ == NULL) - && (dt_PERI_IPMB == NULL)) { + if ((dtCFL_TLSPH == nullptr) && (dtCFL_ULSPH == nullptr) && (dt_TRI == nullptr) && (dt_HERTZ == nullptr) + && (dt_PERI_IPMB == nullptr)) { error->all(FLERR, "fix smd/adjust_dt failed to access a valid dtCFL"); } - if (dtCFL_TLSPH != NULL) { + if (dtCFL_TLSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_TLSPH); } - if (dtCFL_ULSPH != NULL) { + if (dtCFL_ULSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_ULSPH); } - if (dt_TRI != NULL) { + if (dt_TRI != nullptr) { dtmin = MIN(dtmin, *dt_TRI); } - if (dt_HERTZ != NULL) { + if (dt_HERTZ != nullptr) { dtmin = MIN(dtmin, *dt_HERTZ); } - if (dt_PERI_IPMB != NULL) { + if (dt_PERI_IPMB != nullptr) { dtmin = MIN(dtmin, *dt_PERI_IPMB); } diff --git a/src/USER-SMD/fix_smd_integrate_tlsph.cpp b/src/USER-SMD/fix_smd_integrate_tlsph.cpp index 7d5e89f895..743cd09f0d 100644 --- a/src/USER-SMD/fix_smd_integrate_tlsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_tlsph.cpp @@ -139,7 +139,7 @@ void FixSMDIntegrateTlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVelDifference == NULL) { + if (smoothVelDifference == nullptr) { error->one(FLERR, "fix smd/integrate_tlsph failed to access smoothVel array. Check if a pair style exist which calculates this quantity."); } diff --git a/src/USER-SMD/fix_smd_integrate_ulsph.cpp b/src/USER-SMD/fix_smd_integrate_ulsph.cpp index 215759331e..c261537dfa 100644 --- a/src/USER-SMD/fix_smd_integrate_ulsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_ulsph.cpp @@ -171,7 +171,7 @@ void FixSMDIntegrateUlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVel == NULL) { + if (smoothVel == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to access smoothVel array"); } } @@ -259,12 +259,12 @@ void FixSMDIntegrateUlsph::final_integrate() { int itmp; int *nn = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss num_neighs array"); } Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss velocityGradient array"); } diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index d3e71f0e50..3301999270 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -57,7 +57,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3], "v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -93,7 +93,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -241,7 +241,7 @@ void FixSMDSetVel::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp index 3e63de08f3..f0b405f947 100644 --- a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp +++ b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp @@ -59,12 +59,12 @@ FixSMD_TLSPH_ReferenceConfiguration::FixSMD_TLSPH_ReferenceConfiguration(LAMMPS error->all(FLERR, "Pair tlsph with partner list requires an atom map, see atom_modify"); maxpartner = 1; - npartner = NULL; - partner = NULL; - wfd_list = NULL; - wf_list = NULL; - energy_per_bond = NULL; - degradation_ij = NULL; + npartner = nullptr; + partner = nullptr; + wfd_list = nullptr; + wf_list = nullptr; + energy_per_bond = nullptr; + degradation_ij = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); @@ -130,13 +130,13 @@ void FixSMD_TLSPH_ReferenceConfiguration::pre_exchange() { } int *updateFlag_ptr = (int *) force->pair->extract("smd/tlsph/updateFlag_ptr", itmp); - if (updateFlag_ptr == NULL) { + if (updateFlag_ptr == nullptr) { error->one(FLERR, "fix FixSMD_TLSPH_ReferenceConfiguration failed to access updateFlag pointer. Check if a pair style exist which calculates this quantity."); } int *nn = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->all(FLERR, "FixSMDIntegrateTlsph::updateReferenceConfiguration() failed to access numNeighsRefConfig_ptr array"); } @@ -468,7 +468,7 @@ int FixSMD_TLSPH_ReferenceConfiguration::pack_restart(int i, double *buf) { ------------------------------------------------------------------------- */ void FixSMD_TLSPH_ReferenceConfiguration::unpack_restart(int /*nlocal*/, int /*nth*/) { -// ipage = NULL if being called from granular pair style init() +// ipage = nullptr if being called from granular pair style init() // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index 10f248c39f..26190a5a98 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -69,7 +69,7 @@ FixSMDWallSurface::FixSMDWallSurface(LAMMPS *lmp, int narg, char **arg) : FixSMDWallSurface::~FixSMDWallSurface() { free(filename); - filename = NULL; + filename = nullptr; // unregister this fix so atom class doesn't invoke it any more //atom->delete_callback(id, 0); @@ -198,12 +198,12 @@ int FixSMDWallSurface::count_words(const char *line) { if ((ptr = strchr(copy, '#'))) *ptr = '\0'; - if (strtok(copy, " \t\n\r\f") == NULL) { + if (strtok(copy, " \t\n\r\f") == nullptr) { memory->destroy(copy); return 0; } n = 1; - while (strtok(NULL, " \t\n\r\f")) + while (strtok(nullptr, " \t\n\r\f")) n++; memory->destroy(copy); @@ -229,7 +229,7 @@ void FixSMDWallSurface::read_triangles(int pass) { Vector3d normal, center; FILE *fp = fopen(filename, "r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128, "Cannot open file %s", filename); error->one(FLERR, str); @@ -261,7 +261,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read STL solid name retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading number of triangle pairs"); } @@ -272,11 +272,11 @@ void FixSMDWallSurface::read_triangles(int pass) { // values = new char*[nwords]; // values[0] = strtok(line, " \t\n\r\f"); -// if (values[0] == NULL) +// if (values[0] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // for (m = 1; m < nwords; m++) { -// values[m] = strtok(NULL, " \t\n\r\f"); -// if (values[m] == NULL) +// values[m] = strtok(nullptr, " \t\n\r\f"); +// if (values[m] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // } // delete[] values; @@ -301,11 +301,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); } @@ -318,7 +318,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read outer loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading outer loop"); } @@ -331,7 +331,7 @@ void FixSMDWallSurface::read_triangles(int pass) { for (int k = 0; k < 3; k++) { retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading vertex line"); } @@ -342,11 +342,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect vertex line"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect vertex line"); } @@ -362,7 +362,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading endloop"); } @@ -373,7 +373,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end facet line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading endfacet"); } diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 8d3c06d5e6..c966f5ba75 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -51,9 +51,9 @@ using namespace LAMMPS_NS; PairHertz::PairHertz(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -374,6 +374,6 @@ void *PairHertz::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index 25301685a7..3c87119553 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -63,28 +63,28 @@ using namespace SMD_Math; PairTlsph::PairTlsph(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; - failureModel = NULL; - strengthModel = eos = NULL; + failureModel = nullptr; + strengthModel = eos = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - Fdot = Fincr = K = PK1 = NULL; - R = FincrInv = W = D = NULL; - detF = NULL; - smoothVelDifference = NULL; - numNeighsRefConfig = NULL; - CauchyStress = NULL; - hourglass_error = NULL; - Lookup = NULL; - particle_dt = NULL; + Fdot = Fincr = K = PK1 = nullptr; + R = FincrInv = W = D = nullptr; + detF = nullptr; + smoothVelDifference = nullptr; + numNeighsRefConfig = nullptr; + CauchyStress = nullptr; + hourglass_error = nullptr; + Lookup = nullptr; + particle_dt = nullptr; updateFlag = 0; first = true; dtCFL = 0.0; // initialize dtCFL so it is set to safe value if extracted on zero-th timestep comm_forward = 22; // this pair style communicates 20 doubles to ghost atoms : PK1 tensor + F tensor + shepardWeight - fix_tlsph_reference_configuration = NULL; + fix_tlsph_reference_configuration = nullptr; cut_comm = MAX(neighbor->cutneighmax, comm->cutghostuser); // cutoff radius within which ghost atoms are communicated. } @@ -1748,7 +1748,7 @@ void PairTlsph::init_style() { if (igroup == -1) error->all(FLERR, "Pair style tlsph requires its particles to be part of a group named tlsph. This group does not exist."); - if (fix_tlsph_reference_configuration == NULL) { + if (fix_tlsph_reference_configuration == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) "SMD_TLSPH_NEIGHBORS"; fixarg[1] = (char *) "tlsph"; @@ -1824,7 +1824,7 @@ void *PairTlsph::extract(const char *str, int &/*i*/) { return (void *) R; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 8ccba562e2..6e702ef825 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -54,9 +54,9 @@ using namespace Eigen; PairTriSurf::PairTriSurf(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -833,6 +833,6 @@ void *PairTriSurf::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 3a6cdf5d2f..bbb8cf3729 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -56,22 +56,22 @@ PairULSPH::PairULSPH(LAMMPS *lmp) : Pair(lmp) { // per-type arrays - Q1 = NULL; - eos = viscosity = strength = NULL; - c0_type = NULL; - c0 = NULL; - Lookup = NULL; - artificial_stress = NULL; - artificial_pressure = NULL; + Q1 = nullptr; + eos = viscosity = strength = nullptr; + c0_type = nullptr; + c0 = nullptr; + Lookup = nullptr; + artificial_stress = nullptr; + artificial_pressure = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - stressTensor = L = K = NULL; - shepardWeight = NULL; - smoothVel = NULL; - numNeighs = NULL; - F = NULL; - rho = NULL; - effm = NULL; + stressTensor = L = K = nullptr; + shepardWeight = nullptr; + smoothVel = nullptr; + numNeighs = nullptr; + F = nullptr; + rho = nullptr; + effm = nullptr; velocity_gradient_required = false; // turn off computation of velocity gradient by default density_summation = velocity_gradient = false; @@ -1575,7 +1575,7 @@ void *PairULSPH::extract(const char *str, int &/*i*/) { return (void *) K; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 875d254ac9..a40f676ff1 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -101,50 +101,50 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) kmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - intparams = NULL; - - intype = NULL; - coultype = NULL; - fafb = NULL; - dfafb = NULL; - potqn = NULL; - dpotqn = NULL; + params = nullptr; + intparams = nullptr; + + intype = nullptr; + coultype = nullptr; + fafb = nullptr; + dfafb = nullptr; + potqn = nullptr; + dpotqn = nullptr; Vself = 0.0; - tabsmb = NULL; - tabsmr = NULL; - dtabsmb = NULL; - dtabsmr = NULL; - - sbcov = NULL; - coord = NULL; - sbmet = NULL; - ecov = NULL; - - potmad = NULL; - potself = NULL; - potcov = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; - tab_comm = NULL; - - nvsm = NULL; - vsm = NULL; - flag_QEq = NULL; - nQEqaall = NULL; - nQEqcall = NULL; - nQEqall = NULL; + tabsmb = nullptr; + tabsmr = nullptr; + dtabsmb = nullptr; + dtabsmr = nullptr; + + sbcov = nullptr; + coord = nullptr; + sbmet = nullptr; + ecov = nullptr; + + potmad = nullptr; + potself = nullptr; + potcov = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; + tab_comm = nullptr; + + nvsm = nullptr; + vsm = nullptr; + flag_QEq = nullptr; + nQEqaall = nullptr; + nQEqcall = nullptr; + nQEqall = nullptr; nteam = 0; cluster = 0; Nevery = 0.0; Neverypot = 0.0; - fct = NULL; + fct = nullptr; maxpage = 0; @@ -277,7 +277,7 @@ void PairSMTBQ::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -286,7 +286,7 @@ void PairSMTBQ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -392,9 +392,9 @@ void PairSMTBQ::read_file(char *file) char **words; memory->sfree(params); - params = NULL; + params = nullptr; memory->sfree(intparams); - intparams = NULL; + intparams = nullptr; nparams = 0; maxparam = 0; maxintparam = 0; @@ -411,7 +411,7 @@ void PairSMTBQ::read_file(char *file) // open file on all processors FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if ( fp == NULL ) { + if ( fp == nullptr ) { char str[128]; snprintf(str,128,"Cannot open SMTBQ potential file %s",file); error->one(FLERR,str); @@ -3562,12 +3562,12 @@ int PairSMTBQ::Tokenize( char* s, char*** tok ) const char *sep = "' "; char *mot; int count=0; - mot = NULL; + mot = nullptr; strncpy( test, s, MAXLINE-1 ); - for( mot = strtok(test, sep); mot; mot = strtok(NULL, sep) ) { + for( mot = strtok(test, sep); mot; mot = strtok(nullptr, sep) ) { strncpy( (*tok)[count], mot, MAXLINE ); count++; } diff --git a/src/USER-SPH/compute_sph_e_atom.cpp b/src/USER-SPH/compute_sph_e_atom.cpp index 8869dae5f7..d8142fd790 100644 --- a/src/USER-SPH/compute_sph_e_atom.cpp +++ b/src/USER-SPH/compute_sph_e_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHEAtom::ComputeSPHEAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - evector = NULL; + evector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_rho_atom.cpp b/src/USER-SPH/compute_sph_rho_atom.cpp index 1d6d03811c..edc788a1ab 100644 --- a/src/USER-SPH/compute_sph_rho_atom.cpp +++ b/src/USER-SPH/compute_sph_rho_atom.cpp @@ -35,7 +35,7 @@ ComputeSPHRhoAtom::ComputeSPHRhoAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_t_atom.cpp b/src/USER-SPH/compute_sph_t_atom.cpp index 063af70026..253e637485 100644 --- a/src/USER-SPH/compute_sph_t_atom.cpp +++ b/src/USER-SPH/compute_sph_t_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHTAtom::ComputeSPHTAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - tvector = NULL; + tvector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index d010b004d5..a5ad46e77b 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -49,7 +49,7 @@ ComputeForceTally::ComputeForceTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - fatom = NULL; + fatom = nullptr; vector = new double[size_peratom_cols]; } @@ -66,7 +66,7 @@ ComputeForceTally::~ComputeForceTally() void ComputeForceTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute force/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 1a2dd36285..f57899c593 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -48,8 +48,8 @@ ComputeHeatFluxTally::ComputeHeatFluxTally(LAMMPS *lmp, int narg, char **arg) : did_setup = 0; invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; - eatom = NULL; + stress = nullptr; + eatom = nullptr; vector = new double[size_vector]; heatj = new double[size_vector]; } @@ -69,7 +69,7 @@ ComputeHeatFluxTally::~ComputeHeatFluxTally() void ComputeHeatFluxTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute heat/flux/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index 835d1e80bd..77bf7973da 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -59,7 +59,7 @@ ComputePEMolTally::~ComputePEMolTally() void ComputePEMolTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/mol/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index ef7c13fed2..e330b56a80 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -48,7 +48,7 @@ ComputePETally::ComputePETally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - eatom = NULL; + eatom = nullptr; vector = new double[size_peratom_cols]; } @@ -65,7 +65,7 @@ ComputePETally::~ComputePETally() void ComputePETally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/tally without a pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 2a0cbc8e4b..58d42cd93d 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -49,7 +49,7 @@ ComputeStressTally::ComputeStressTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; + stress = nullptr; vector = new double[size_peratom_cols]; virial = new double[size_peratom_cols]; } @@ -68,7 +68,7 @@ ComputeStressTally::~ComputeStressTally() void ComputeStressTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute stress/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index f910caac59..e833502952 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -57,7 +57,7 @@ static const char cite_user_uef_package[] = * temp/pressure fixes ---------------------------------------------------------------------- */ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), uefbox(NULL) + FixNH(lmp, narg, arg), uefbox(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_uef_package); diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index 59dba0d90d..cb468fc3db 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -128,11 +128,11 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : if (filewriter) reset_vtk_data_containers(); - label = NULL; + label = nullptr; { // parallel vtp/vtu requires proc number to be preceded by underscore '_' - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { multiname_ex = new char[strlen(filename) + 16]; @@ -160,12 +160,12 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : nclusterprocs = nprocs; } - filecurrent = NULL; - domainfilecurrent = NULL; - parallelfilecurrent = NULL; - header_choice = NULL; - write_choice = NULL; - boxcorners = NULL; + filecurrent = nullptr; + domainfilecurrent = nullptr; + parallelfilecurrent = nullptr; + header_choice = nullptr; + write_choice = nullptr; + boxcorners = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void DumpVTK::init_style() { // default for element names = C - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[2]; @@ -880,7 +880,7 @@ void DumpVTK::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // filewriter = 1 = this proc writes to file @@ -939,13 +939,13 @@ void DumpVTK::write_data(int n, double *mybuf) void DumpVTK::setFileCurrent() { delete [] filecurrent; - filecurrent = NULL; + filecurrent = nullptr; char *filestar = filename; if (multiproc) { if (multiproc > 1) { // if dump_modify fileper or nfile was used delete [] multiname_ex; - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { int id; @@ -983,7 +983,7 @@ void DumpVTK::setFileCurrent() { // filename of domain box data file delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multiproc) { // remove '%' character char *ptr = strchr(filename,'%'); @@ -997,7 +997,7 @@ void DumpVTK::setFileCurrent() { *ptr = '\0'; sprintf(filestar,"%s_boundingBox.%s",domainfilecurrent,ptr+1); delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multifile == 0) { domainfilecurrent = new char[strlen(filestar) + 1]; @@ -1018,7 +1018,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } else { domainfilecurrent = new char[strlen(filecurrent) + 16]; char *ptr = strrchr(filecurrent,'.'); @@ -1030,7 +1030,7 @@ void DumpVTK::setFileCurrent() { // filename of parallel file if (multiproc && me == 0) { delete [] parallelfilecurrent; - parallelfilecurrent = NULL; + parallelfilecurrent = nullptr; // remove '%' character and add 'p' to file extension // -> string length stays the same @@ -1066,7 +1066,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } } @@ -1995,7 +1995,7 @@ int DumpVTK::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -2075,7 +2075,7 @@ int DumpVTK::modify_param(int narg, char **arg) if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; @@ -2094,9 +2094,9 @@ int DumpVTK::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; } nthresh = 0; return 2; diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index c45af1d198..69dac7f58b 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -279,12 +279,12 @@ void AngleCross::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&kss[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index 34de772672..d165a2d17c 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -226,8 +226,8 @@ void AngleMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index f5d5fed946..2c310c6310 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -179,8 +179,8 @@ void BondMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 37039b27e4..757695c3c8 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -257,8 +257,8 @@ void ImproperDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index ddc4d78c93..79245d3413 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -257,8 +257,8 @@ void ImproperSQDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 98fd317794..5508ffbfdc 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairLJSwitch3CoulGaussLong::PairLJSwitch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -358,11 +358,11 @@ void PairLJSwitch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairLJSwitch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairLJSwitch3CoulGaussLong::write_restart_settings(FILE *fp) void PairLJSwitch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairLJSwitch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index e1ee0e0b98..d63f42cf3a 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairMM3Switch3CoulGaussLong::PairMM3Switch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -360,11 +360,11 @@ void PairMM3Switch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairMM3Switch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairMM3Switch3CoulGaussLong::write_restart_settings(FILE *fp) void PairMM3Switch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairMM3Switch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index be77b8457b..aa8488e86f 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -41,10 +41,10 @@ using namespace voro; /* ---------------------------------------------------------------------- */ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), con_mono(NULL), con_poly(NULL), - radstr(NULL), voro(NULL), edge(NULL), sendvector(NULL), - rfield(NULL), tags(NULL), occvec(NULL), sendocc(NULL), - lroot(NULL), lnext(NULL), faces(NULL) + Compute(lmp, narg, arg), con_mono(nullptr), con_poly(nullptr), + radstr(nullptr), voro(nullptr), edge(nullptr), sendvector(nullptr), + rfield(nullptr), tags(nullptr), occvec(nullptr), sendocc(nullptr), + lroot(nullptr), lnext(nullptr), faces(nullptr) { int sgroup; @@ -56,16 +56,16 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : surface = VOROSURF_NONE; maxedge = 0; fthresh = ethresh = 0.0; - radstr = NULL; + radstr = nullptr; onlyGroup = false; occupation = false; - con_mono = NULL; - con_poly = NULL; - tags = NULL; + con_mono = nullptr; + con_poly = nullptr; + tags = nullptr; oldmaxtag = 0; - occvec = sendocc = lroot = lnext = NULL; - faces = NULL; + occvec = sendocc = lroot = lnext = nullptr; + faces = nullptr; int iarg = 3; while ( iargall(FLERR,"Compute voronoi/atom occupation requires an atom map, see atom_modify"); nmax = rmax = 0; - edge = rfield = sendvector = NULL; - voro = NULL; + edge = rfield = sendvector = nullptr; + voro = nullptr; if ( maxedge > 0 ) { vector_flag = 1; @@ -207,7 +207,7 @@ void ComputeVoronoi::compute_peratom() if (occupation) { // build cells only once int i, nall = atom->nlocal + atom->nghost; - if (con_mono==NULL && con_poly==NULL) { + if (con_mono==nullptr && con_poly==nullptr) { // generate the voronoi cell network for the initial structure buildCells(); @@ -218,7 +218,7 @@ void ComputeVoronoi::compute_peratom() // linked list structure for cell occupation count on the atoms oldnall= nall; memory->create(lroot,nall,"voronoi/atom:lroot"); // point to first atom index in cell (or -1 for empty cell) - lnext = NULL; + lnext = nullptr; lmax = 0; // build the occupation buffer. diff --git a/src/angle.cpp b/src/angle.cpp index 2796ae01b7..4eedd7c69b 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -36,10 +36,10 @@ Angle::Angle(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 56590d6757..70779aa7b2 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -174,7 +174,7 @@ void AngleHybrid::allocate() maxangle = new int[nstyles]; anglelist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxangle[m] = 0; - for (int m = 0; m < nstyles; m++) anglelist[m] = NULL; + for (int m = 0; m < nstyles; m++) anglelist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -358,7 +358,7 @@ void AngleHybrid::write_restart(FILE *fp) void AngleHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Angle*[nstyles]; keywords = new char*[nstyles]; @@ -367,10 +367,10 @@ void AngleHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_angle(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index e087b774e0..9d8255e84c 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -128,7 +128,7 @@ void AngleZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/atom.cpp b/src/atom.cpp index 49ff262764..a58e1e3181 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -83,113 +83,113 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0; nbonds = nangles = ndihedrals = nimpropers = 0; - firstgroupname = NULL; + firstgroupname = nullptr; sortfreq = 1000; nextsort = 0; userbinsize = 0.0; maxbin = maxnext = 0; - binhead = NULL; - next = permute = NULL; + binhead = nullptr; + next = permute = nullptr; // data structure with info on per-atom vectors/arrays nperatom = maxperatom = 0; - peratom = NULL; + peratom = nullptr; // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variables - tag = NULL; - type = mask = NULL; - image = NULL; - x = v = f = NULL; + tag = nullptr; + type = mask = nullptr; + image = nullptr; + x = v = f = nullptr; // charged and dipolar particles - q = NULL; - mu = NULL; + q = nullptr; + mu = nullptr; // finite-size particles - omega = angmom = torque = NULL; - radius = rmass = NULL; - ellipsoid = line = tri = body = NULL; + omega = angmom = torque = nullptr; + radius = rmass = nullptr; + ellipsoid = line = tri = body = nullptr; // molecular systems - molecule = NULL; - molindex = molatom = NULL; + molecule = nullptr; + molindex = molatom = nullptr; bond_per_atom = extra_bond_per_atom = 0; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; angle_per_atom = extra_angle_per_atom = 0; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; dihedral_per_atom = extra_dihedral_per_atom = 0; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; improper_per_atom = extra_improper_per_atom = 0; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; maxspecial = 1; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; // PERI package - vfrac = s0 = NULL; - x0 = NULL; + vfrac = s0 = nullptr; + x0 = nullptr; // SPIN package - sp = fm = fm_long = NULL; + sp = fm = fm_long = nullptr; // USER-EFF and USER-AWPMD packages - spin = NULL; - eradius = ervel = erforce = NULL; - ervelforce = NULL; - cs = csforce = vforce = NULL; - etag = NULL; + spin = nullptr; + eradius = ervel = erforce = nullptr; + ervelforce = nullptr; + cs = csforce = vforce = nullptr; + etag = nullptr; // USER-DPD package - uCond = uMech = uChem = uCG = uCGnew = NULL; - duChem = dpdTheta = NULL; + uCond = uMech = uChem = uCG = uCGnew = nullptr; + duChem = dpdTheta = nullptr; // USER-MESO package - cc = cc_flux = NULL; - edpd_temp = edpd_flux = edpd_cv = NULL; + cc = cc_flux = nullptr; + edpd_temp = edpd_flux = edpd_cv = nullptr; // USER-MESONT package - length = NULL; - buckling = NULL; - bond_nt = NULL; + length = nullptr; + buckling = nullptr; + bond_nt = nullptr; // USER-SMD package - contact_radius = NULL; - smd_data_9 = NULL; - smd_stress = NULL; - eff_plastic_strain = NULL; - eff_plastic_strain_rate = NULL; - damage = NULL; + contact_radius = nullptr; + smd_data_9 = nullptr; + smd_stress = nullptr; + eff_plastic_strain = nullptr; + eff_plastic_strain_rate = nullptr; + damage = nullptr; // USER-SPH package - rho = drho = esph = desph = cv = NULL; - vest = NULL; + rho = drho = esph = desph = cv = nullptr; + vest = nullptr; // end of customization section // -------------------------------------------------------------------- @@ -197,14 +197,14 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // user-defined molecules nmolecule = 0; - molecules = NULL; + molecules = nullptr; // custom atom arrays nivector = ndvector = 0; - ivector = NULL; - dvector = NULL; - iname = dname = NULL; + ivector = nullptr; + dvector = nullptr; + iname = dname = nullptr; // initialize atom style and array existence flags @@ -216,16 +216,16 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // ntype-length arrays - mass = NULL; - mass_setflag = NULL; + mass = nullptr; + mass_setflag = nullptr; // callback lists & extra restart info nextra_grow = nextra_restart = nextra_border = 0; - extra_grow = extra_restart = extra_border = NULL; + extra_grow = extra_restart = extra_border = nullptr; nextra_grow_max = nextra_restart_max = nextra_border_max = 0; nextra_store = 0; - extra = NULL; + extra = nullptr; // default atom ID and mapping values @@ -235,15 +235,15 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) map_maxarray = map_nhash = map_nbucket = -1; max_same = 0; - sametag = NULL; - map_array = NULL; - map_bucket = NULL; - map_hash = NULL; + sametag = nullptr; + map_array = nullptr; + map_bucket = nullptr; + map_hash = nullptr; unique_tags = nullptr; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; avec_map = new AtomVecCreatorMap(); @@ -288,7 +288,7 @@ Atom::~Atom() delete [] iname[i]; memory->destroy(ivector[i]); } - if (dvector != NULL) { + if (dvector != nullptr) { for (int i = 0; i < ndvector; i++) { delete [] dname[i]; memory->destroy(dvector[i]); @@ -352,7 +352,7 @@ void Atom::peratom_create() delete [] peratom[i].name; memory->sfree(peratom); - peratom = NULL; + peratom = nullptr; nperatom = maxperatom = 0; // -------------------------------------------------------------------- @@ -533,7 +533,7 @@ void Atom::add_peratom(const char *name, void *address, peratom[nperatom].datatype = datatype; peratom[nperatom].cols = cols; peratom[nperatom].threadflag = threadflag; - peratom[nperatom].address_length = NULL; + peratom[nperatom].address_length = nullptr; nperatom++; } @@ -629,8 +629,8 @@ void Atom::create_avec(const std::string &style, int narg, char **arg, int trysu { delete [] atom_style; if (avec) delete avec; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; // unset atom style and array existence flags // may have been set by old avec @@ -702,7 +702,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag) } error->all(FLERR,utils::check_packages_for_style("atom",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -723,7 +723,7 @@ void Atom::init() if (nextra_store) { memory->destroy(extra); - extra = NULL; + extra = nullptr; nextra_store = 0; } @@ -756,7 +756,7 @@ void Atom::setup() /* ---------------------------------------------------------------------- return ptr to AtomVec class if matches style or to matching hybrid sub-class - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ AtomVec *Atom::style_match(const char *style) @@ -768,7 +768,7 @@ AtomVec *Atom::style_match(const char *style) if (strcmp(avec_hybrid->keywords[i],style) == 0) return avec_hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -807,7 +807,7 @@ void Atom::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (strcmp(arg[iarg+1],"all") == 0) { delete [] firstgroupname; - firstgroupname = NULL; + firstgroupname = nullptr; } else { int n = strlen(arg[iarg+1]) + 1; firstgroupname = new char[n]; @@ -983,33 +983,33 @@ void Atom::deallocate_topology() { memory->destroy(atom->bond_type); memory->destroy(atom->bond_atom); - atom->bond_type = NULL; - atom->bond_atom = NULL; + atom->bond_type = nullptr; + atom->bond_atom = nullptr; memory->destroy(atom->angle_type); memory->destroy(atom->angle_atom1); memory->destroy(atom->angle_atom2); memory->destroy(atom->angle_atom3); - atom->angle_type = NULL; - atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; + atom->angle_type = nullptr; + atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = nullptr; memory->destroy(atom->dihedral_type); memory->destroy(atom->dihedral_atom1); memory->destroy(atom->dihedral_atom2); memory->destroy(atom->dihedral_atom3); memory->destroy(atom->dihedral_atom4); - atom->dihedral_type = NULL; + atom->dihedral_type = nullptr; atom->dihedral_atom1 = atom->dihedral_atom2 = - atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; + atom->dihedral_atom3 = atom->dihedral_atom4 = nullptr; memory->destroy(atom->improper_type); memory->destroy(atom->improper_atom1); memory->destroy(atom->improper_atom2); memory->destroy(atom->improper_atom3); memory->destroy(atom->improper_atom4); - atom->improper_type = NULL; + atom->improper_type = nullptr; atom->improper_atom1 = atom->improper_atom2 = - atom->improper_atom3 = atom->improper_atom4 = NULL; + atom->improper_atom3 = atom->improper_atom4 = nullptr; } /* ---------------------------------------------------------------------- @@ -1108,11 +1108,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL," \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr," \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); } @@ -1195,7 +1195,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1210,7 +1210,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) /* ---------------------------------------------------------------------- process N bonds read into buf from data files - if count is non-NULL, just count bonds per atom + if count is non-nullptr, just count bonds per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1265,7 +1265,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N angles read into buf from data files - if count is non-NULL, just count angles per atom + if count is non-nullptr, just count angles per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1337,7 +1337,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N dihedrals read into buf from data files - if count is non-NULL, just count diihedrals per atom + if count is non-nullptr, just count diihedrals per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1428,7 +1428,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N impropers read into buf from data files - if count is non-NULL, just count impropers per atom + if count is non-nullptr, just count impropers per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1547,7 +1547,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1577,8 +1577,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) int maxint = 0; int maxdouble = 0; - int *ivalues = NULL; - double *dvalues = NULL; + int *ivalues = nullptr; + double *dvalues = nullptr; if (!unique_tags) unique_tags = new std::set; @@ -1588,7 +1588,7 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) for (int i = 0; i < n; i++) { if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset; - else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset; + else tagdata = ATOTAGINT(strtok(nullptr," \t\n\r\f")) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Bodies section of data file"); @@ -1598,8 +1598,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) else error->one(FLERR,"Duplicate atom ID in Bodies section of data file"); - ninteger = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); - ndouble = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ninteger = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); + ndouble = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); if ((m = map(tagdata)) >= 0) { if (ninteger > maxint) { @@ -1614,16 +1614,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) } for (j = 0; j < ninteger; j++) - ivalues[j] = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ivalues[j] = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); for (j = 0; j < ndouble; j++) - dvalues[j] = utils::numeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + dvalues[j] = utils::numeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues); } else { nvalues = ninteger + ndouble; // number of values to skip for (j = 0; j < nvalues; j++) - strtok(NULL," \t\n\r\f"); + strtok(nullptr," \t\n\r\f"); } } @@ -1680,7 +1680,7 @@ void Atom::allocate_type_arrays() void Atom::set_mass(const char *file, int line, const char *str, int type_offset) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int itype; double mass_one; @@ -1704,7 +1704,7 @@ void Atom::set_mass(const char *file, int line, const char *str, int type_offset void Atom::set_mass(const char *file, int line, int itype, double value) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); if (itype < 1 || itype > ntypes) error->all(file,line,"Invalid type for mass set"); @@ -1721,7 +1721,7 @@ void Atom::set_mass(const char *file, int line, int itype, double value) void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int lo,hi; utils::bounds(file,line,arg[0],1,ntypes,lo,hi,error); @@ -1754,7 +1754,7 @@ void Atom::set_mass(double *values) void Atom::check_mass(const char *file, int line) { - if (mass == NULL) return; + if (mass == nullptr) return; if (rmass_flag) return; for (int itype = 1; itype <= ntypes; itype++) if (mass_setflag[itype] == 0) @@ -1864,7 +1864,7 @@ void Atom::add_molecule(int narg, char **arg) int Atom::find_molecule(char *id) { - if(id == NULL) return -1; + if(id == nullptr) return -1; int imol; for (imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; @@ -2201,14 +2201,14 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find NULL ptr: + // if find nullptr ptr: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find NULL ptr: + // if don't find nullptr ptr: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) - if (modify->fix[ifix] == NULL) break; + if (modify->fix[ifix] == nullptr) break; // add callback to lists and sort, reallocating if necessary // sorting is required in cases where fixes were replaced as it ensures atom @@ -2249,7 +2249,7 @@ void Atom::add_callback(int flag) void Atom::delete_callback(const char *id, int flag) { - if (id == NULL) return; + if (id == nullptr) return; int ifix = modify->find_fix(id); @@ -2310,7 +2310,7 @@ void Atom::update_callback(int ifix) int Atom::find_custom(const char *name, int &flag) { - if(name == NULL) return -1; + if(name == nullptr) return -1; for (int i = 0; i < nivector; i++) if (iname[i] && strcmp(iname[i],name) == 0) { @@ -2374,7 +2374,7 @@ int Atom::add_custom(const char *name, int flag) \verbatim embed:rst This will remove a property that was requested e.g. by the :doc:`fix property/atom ` command. It frees the -allocated memory and sets the pointer to ``NULL`` to the entry in +allocated memory and sets the pointer to ``nullptr`` to the entry in the list can be reused. The lists of those pointers will never be compacted or never shrink, so that index to name mappings remain valid. \endverbatim @@ -2386,14 +2386,14 @@ void Atom::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { memory->destroy(dvector[index]); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } @@ -2483,7 +2483,7 @@ length of the data area, and a short description. * - rmass - double - 1 - - per-atom mass of the particles. ``NULL`` if per-type masses are + - per-atom mass of the particles. ``nullptr`` if per-type masses are used. See the :cpp:func:`rmass_flag` setting. * - ellipsoid - int @@ -2506,7 +2506,7 @@ length of the data area, and a short description. * * \param name string with the keyword of the desired property. Typically the name of the pointer variable returned - * \return pointer to the requested data cast to ``void *`` or NULL */ + * \return pointer to the requested data cast to ``void *`` or nullptr */ void *Atom::extract(char *name) { @@ -2577,7 +2577,7 @@ void *Atom::extract(char *name) // end of customization section // -------------------------------------------------------------------- - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/atom.h b/src/atom.h index 21b9c06f8c..841d224d23 100644 --- a/src/atom.h +++ b/src/atom.h @@ -55,7 +55,7 @@ class Atom : protected Pointers { int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc - char *firstgroupname; // group-ID to store first, NULL if unset + char *firstgroupname; // group-ID to store first, nullptr if unset // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variable diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 02b97a1134..45808d086f 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -323,18 +323,18 @@ int Atom::map_style_set() void Atom::map_delete() { memory->destroy(sametag); - sametag = NULL; + sametag = nullptr; max_same = 0; if (map_style == 1) { memory->destroy(map_array); - map_array = NULL; + map_array = nullptr; } else { if (map_nhash) { delete [] map_bucket; delete [] map_hash; - map_bucket = NULL; - map_hash = NULL; + map_bucket = nullptr; + map_hash = nullptr; } map_nhash = map_nbucket = 0; } diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 4a00e5852b..8dcec3a784 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -2060,7 +2060,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) } /* ---------------------------------------------------------------------- - pack bond info for data file into buf if non-NULL + pack bond info for data file into buf if non-nullptr return count of bonds from this proc do not count/pack bonds with bondtype = 0 if bondtype is negative, flip back to positive @@ -2118,7 +2118,7 @@ void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index) } /* ---------------------------------------------------------------------- - pack angle info for data file into buf if non-NULL + pack angle info for data file into buf if non-nullptr return count of angles from this proc do not count/pack angles with angletype = 0 if angletype is negative, flip back to positive diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index e9044519c9..9f5ec26cce 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -49,9 +49,9 @@ AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp) atom->radius_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; - bptr = NULL; + bptr = nullptr; if (sizeof(double) == sizeof(int)) intdoubleratio = 1; else if (sizeof(double) == 2*sizeof(int)) intdoubleratio = 2; @@ -104,7 +104,7 @@ void AtomVecBody::process_args(int narg, char **arg) if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); - if (0) bptr = NULL; + if (0) bptr = nullptr; #define BODY_CLASS #define BodyStyle(key,Class) \ @@ -582,7 +582,7 @@ void AtomVecBody::pack_data_pre(int ilocal) /* ---------------------------------------------------------------------- pack bonus body info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index c22111f48c..e673ac295a 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -46,7 +46,7 @@ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp) atom->rmass_flag = atom->angmom_flag = atom->torque_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -484,7 +484,7 @@ void AtomVecEllipsoid::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus ellipsoid info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 7a8c73570d..e343bcbdb2 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -30,13 +30,13 @@ enum{ELLIPSOID,LINE,TRIANGLE,BODY}; // also in WriteData AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) { nstyles = 0; - styles = NULL; - keywords = NULL; - fieldstrings = NULL; + styles = nullptr; + keywords = nullptr; + fieldstrings = nullptr; bonus_flag = 0; nstyles_bonus = 0; - styles_bonus = NULL; + styles_bonus = nullptr; // these strings will be concatenated from sub-style strings // fields_data_atom & fields_data_vel start with fields common to all styles @@ -187,7 +187,7 @@ void AtomVecHybrid::process_args(int narg, char **arg) // save concat_grow to check for duplicates of special-case fields char *concat_grow;; - char *null = NULL; + char *null = nullptr; fields_grow = merge_fields(0,fields_grow,1,concat_grow); fields_copy = merge_fields(1,fields_copy,0,null); diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index 88dcb8c2fa..8776c33e51 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -47,7 +47,7 @@ AtomVecLine::AtomVecLine(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -457,7 +457,7 @@ void AtomVecLine::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus line info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index e391a73215..abcd628e51 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -49,7 +49,7 @@ AtomVecTri::AtomVecTri(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -688,7 +688,7 @@ void AtomVecTri::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus tri info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/balance.cpp b/src/balance.cpp index af8d904812..494d43cf8e 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -52,17 +52,17 @@ Balance::Balance(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - user_xsplit = user_ysplit = user_zsplit = NULL; + user_xsplit = user_ysplit = user_zsplit = nullptr; shift_allocate = 0; - proccost = allproccost = NULL; + proccost = allproccost = nullptr; - rcb = NULL; + rcb = nullptr; nimbalance = 0; - imbalances = NULL; - fixstore = NULL; + imbalances = nullptr; + fixstore = nullptr; - fp = NULL; + fp = nullptr; firststep = 1; } @@ -97,7 +97,7 @@ Balance::~Balance() // check nfix in case all fixes have already been deleted if (fixstore && modify->nfix) modify->delete_fix(fixstore->id); - fixstore = NULL; + fixstore = nullptr; if (fp) fclose(fp); } @@ -246,7 +246,7 @@ void Balance::command(int narg, char **arg) // process remaining optional args options(iarg,narg,arg); - if (wtflag) weight_storage(NULL); + if (wtflag) weight_storage(nullptr); // insure particles are in current box & update box via shrink-wrap // init entire system since comm->setup is done @@ -425,7 +425,7 @@ void Balance::options(int iarg, int narg, char **arg) oldrcb = 0; outflag = 0; int outarg = 0; - fp = NULL; + fp = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"weight") == 0) { @@ -473,7 +473,7 @@ void Balance::options(int iarg, int narg, char **arg) if (outflag && comm->me == 0) { fp = fopen(arg[outarg],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open (fix) balance output file {}: {}", arg[outarg], utils::getsyserror())); } @@ -639,12 +639,12 @@ int *Balance::bisection(int sortflag) if (wtflag) { weight = fixstore->vstore; rcb->compute_old(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute_old(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute_old(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } else { if (wtflag) { weight = fixstore->vstore; rcb->compute(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } if (triclinic) domain->lamda2x(nlocal); @@ -1273,7 +1273,7 @@ void Balance::dumpout(bigint tstep) void Balance::debug_shift_output(int idim, int m, int np, double *split) { int i; - const char *dim = NULL; + const char *dim = nullptr; double *boxlo = domain->boxlo; double *prd = domain->prd; diff --git a/src/body.cpp b/src/body.cpp index c0e58d3f4c..9bc0bfc041 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -23,8 +23,8 @@ Body::Body(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) int n = strlen(arg[0]) + 1; style = new char[n]; strcpy(style,arg[0]); - icp = NULL; - dcp = NULL; + icp = nullptr; + dcp = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/bond.cpp b/src/bond.cpp index 1f953bbd19..1ff7017132 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -44,9 +44,9 @@ Bond::Bond(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -276,7 +276,7 @@ void Bond::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -284,7 +284,7 @@ void Bond::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by bond_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open bond_write file {}: {}", arg[4], utils::getsyserror())); } diff --git a/src/bond.h b/src/bond.h index 8d7585b388..5406aa3f02 100644 --- a/src/bond.h +++ b/src/bond.h @@ -52,7 +52,7 @@ class Bond : protected Pointers { virtual void write_data(FILE *) {} virtual double single(int, double, int, int, double &) = 0; virtual double memory_usage(); - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void reinit(); void write_file(int, char**); diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index b42683c300..46eeab5802 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -166,7 +166,7 @@ void BondHybrid::allocate() maxbond = new int[nstyles]; bondlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxbond[m] = 0; - for (int m = 0; m < nstyles; m++) bondlist[m] = NULL; + for (int m = 0; m < nstyles; m++) bondlist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -351,7 +351,7 @@ void BondHybrid::write_restart(FILE *fp) void BondHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Bond*[nstyles]; keywords = new char*[nstyles]; @@ -360,10 +360,10 @@ void BondHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_bond(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index 71146ec4d6..06e5549161 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -126,7 +126,7 @@ void BondZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -157,5 +157,5 @@ void *BondZero::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/citeme.cpp b/src/citeme.cpp index c8745891cf..b638eaf475 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -28,7 +28,7 @@ static const char cite_nagline[] = "\nPlease see the log.cite file " CiteMe::CiteMe(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; cs = new citeset(); } diff --git a/src/comm.cpp b/src/comm.cpp index 7b351e12fc..becb52df91 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -57,15 +57,15 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) mode = 0; bordergroup = 0; cutghostuser = 0.0; - cutusermulti = NULL; + cutusermulti = nullptr; ghost_velocity = 0; user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0; coregrid[0] = coregrid[1] = coregrid[2] = 1; gridflag = ONELEVEL; mapflag = CART; - customfile = NULL; - outfile = NULL; + customfile = nullptr; + outfile = nullptr; recv_from_partition = send_to_partition = -1; otherflag = 0; @@ -73,8 +73,8 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) maxexchange_fix_dynamic = 0; bufextra = BUFEXTRA; - grid2proc = NULL; - xsplit = ysplit = zsplit = NULL; + grid2proc = nullptr; + xsplit = ysplit = zsplit = nullptr; rcbnew = 0; // use of OpenMP threads @@ -88,7 +88,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) #ifdef _OPENMP if (lmp->kokkos) { nthreads = lmp->kokkos->nthreads * lmp->kokkos->numa; - } else if (getenv("OMP_NUM_THREADS") == NULL) { + } else if (getenv("OMP_NUM_THREADS") == nullptr) { nthreads = 1; if (me == 0) error->message(FLERR,"OMP_NUM_THREADS environment is not set. " @@ -276,7 +276,7 @@ void Comm::modify_params(int narg, char **arg) // need to reset cutghostuser when switching comm mode if (mode == Comm::MULTI) cutghostuser = 0.0; memory->destroy(cutusermulti); - cutusermulti = NULL; + cutusermulti = nullptr; mode = Comm::SINGLE; } else if (strcmp(arg[iarg+1],"multi") == 0) { // need to reset cutghostuser when switching comm mode @@ -289,7 +289,7 @@ void Comm::modify_params(int narg, char **arg) bordergroup = group->find(arg[iarg+1]); if (bordergroup < 0) error->all(FLERR,"Invalid group in comm_modify command"); - if (bordergroup && (atom->firstgroupname == NULL || + if (bordergroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR,"Comm_modify group != atom_modify first group"); iarg += 2; @@ -313,7 +313,7 @@ void Comm::modify_params(int narg, char **arg) const int ntypes = atom->ntypes; if (iarg+3 > narg) error->all(FLERR,"Illegal comm_modify command"); - if (cutusermulti == NULL) { + if (cutusermulti == nullptr) { memory->create(cutusermulti,ntypes+1,"comm:cutusermulti"); for (i=0; i < ntypes+1; ++i) cutusermulti[i] = -1.0; @@ -770,7 +770,7 @@ int Comm::binary(double value, int n, double *vec) callback() is invoked to allow caller to process/update each proc's inbuf if self=1 (default), then callback() is invoked on final iteration using original inbuf, which may have been updated - for non-NULL outbuf, final updated inbuf is copied to it + for non-nullptr outbuf, final updated inbuf is copied to it ok to specify outbuf = inbuf the ptr argument is a pointer to the instance of calling class ------------------------------------------------------------------------- */ @@ -792,7 +792,7 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag, // sanity check - if ((nbytes > 0) && inbuf == NULL) + if ((nbytes > 0) && inbuf == nullptr) error->one(FLERR,"Cannot put data on ring from NULL pointer"); char *buf,*bufcopy; @@ -888,7 +888,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, if (inorder) nrvous = irregular->create_data_grouped(n,procs); else nrvous = irregular->create_data(n,procs); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -925,7 +925,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); @@ -967,7 +967,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!inorder) { memory->create(procs_a2a,nprocs,"rendezvous:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr inbuf_a2a = (char *) memory->smalloc((bigint) n*insize+1, "rendezvous:inbuf"); @@ -1032,7 +1032,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, } // all2all comm of inbuf from caller decomp to rendezvous decomp - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -1074,7 +1074,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!outorder) { memory->create(procs_a2a,nprocs,"rendezvous_a2a:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); @@ -1135,7 +1135,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of outbuf from rendezvous decomp back to caller decomp // caller will free outbuf - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not nullptr outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,"rendezvous:outbuf"); diff --git a/src/comm.h b/src/comm.h index 1743436e22..7ba79843d1 100644 --- a/src/comm.h +++ b/src/comm.h @@ -118,7 +118,7 @@ class Comm : protected Pointers { int read_lines_from_file_universe(FILE *, int, int, char *); // extract data useful to other classes - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} protected: int bordergroup; // only communicate this group in borders @@ -242,7 +242,7 @@ E: Processor count in z must be 1 for 2d simulation Self-explanatory. -E: Cannot put data on ring from NULL pointer +E: Cannot put data on ring from nullptr pointer W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 37a4f0ae3d..bce069fb3a 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -41,17 +41,17 @@ using namespace LAMMPS_NS; CommBrick::CommBrick(LAMMPS *lmp) : Comm(lmp), - sendnum(NULL), recvnum(NULL), sendproc(NULL), recvproc(NULL), - size_forward_recv(NULL), - size_reverse_send(NULL), size_reverse_recv(NULL), - slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL), - cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL), - sendlist(NULL), localsendlist(NULL), maxsendlist(NULL), - buf_send(NULL), buf_recv(NULL) + sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr), + size_forward_recv(nullptr), + size_reverse_send(nullptr), size_reverse_recv(nullptr), + slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr), + cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), + sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr), + buf_send(nullptr), buf_recv(nullptr) { style = 0; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; + pbc_flag = nullptr; init_buffers(); } @@ -98,10 +98,10 @@ CommBrick::CommBrick(LAMMPS * /*lmp*/, Comm *oldcomm) : Comm(*oldcomm) void CommBrick::init_buffers() { - multilo = multihi = NULL; - cutghostmulti = NULL; + multilo = multihi = nullptr; + cutghostmulti = nullptr; - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); @@ -130,7 +130,7 @@ void CommBrick::init() // memory for multi-style communication - if (mode == Comm::MULTI && multilo == NULL) { + if (mode == Comm::MULTI && multilo == nullptr) { allocate_multi(maxswap); memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti"); } @@ -1463,7 +1463,7 @@ void CommBrick::free_multi() { memory->destroy(multilo); memory->destroy(multihi); - multilo = multihi = NULL; + multilo = multihi = nullptr; } /* ---------------------------------------------------------------------- @@ -1492,7 +1492,7 @@ void *CommBrick::extract(const char *str, int &dim) return (void *) localsendlist; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 48c9680d2f..cb236fd726 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -47,12 +47,12 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp) { style = 1; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; - buf_send = NULL; - buf_recv = NULL; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; + pbc_flag = nullptr; + buf_send = nullptr; + buf_recv = nullptr; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; init_buffers(); } @@ -89,16 +89,16 @@ CommTiled::~CommTiled() void CommTiled::init_buffers() { - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); maxoverlap = 0; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; - sendbox_multi = NULL; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; + sendbox_multi = nullptr; maxswap = 6; allocate_swap(maxswap); @@ -2085,22 +2085,22 @@ void CommTiled::allocate_swap(int n) sendlist = new int**[n]; for (int i = 0; i < n; i++) { - sendproc[i] = recvproc[i] = NULL; - sendnum[i] = recvnum[i] = NULL; - size_forward_recv[i] = firstrecv[i] = NULL; - size_reverse_send[i] = size_reverse_recv[i] = NULL; - forward_recv_offset[i] = reverse_recv_offset[i] = NULL; - - pbc_flag[i] = NULL; - pbc[i] = NULL; - sendbox[i] = NULL; - sendbox_multi[i] = NULL; - maxsendlist[i] = NULL; - sendlist[i] = NULL; + sendproc[i] = recvproc[i] = nullptr; + sendnum[i] = recvnum[i] = nullptr; + size_forward_recv[i] = firstrecv[i] = nullptr; + size_reverse_send[i] = size_reverse_recv[i] = nullptr; + forward_recv_offset[i] = reverse_recv_offset[i] = nullptr; + + pbc_flag[i] = nullptr; + pbc[i] = nullptr; + sendbox[i] = nullptr; + sendbox_multi[i] = nullptr; + maxsendlist[i] = nullptr; + sendlist[i] = nullptr; } maxrequest = 0; - requests = NULL; + requests = nullptr; for (int i = 0; i < n; i++) { nprocmax[i] = DELTA_PROCS; diff --git a/src/compute.cpp b/src/compute.cpp index 4cde9ff567..bd07b0c6d6 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -37,10 +37,10 @@ int Compute::instance_total = 0; Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp), - id(NULL), style(NULL), - vector(NULL), array(NULL), vector_atom(NULL), - array_atom(NULL), vector_local(NULL), array_local(NULL), extlist(NULL), - tlist(NULL), vbiasall(NULL) + id(nullptr), style(nullptr), + vector(nullptr), array(nullptr), vector_atom(nullptr), + array_atom(nullptr), vector_local(nullptr), array_local(nullptr), extlist(nullptr), + tlist(nullptr), vbiasall(nullptr) { instance_me = instance_total++; diff --git a/src/compute_adf.cpp b/src/compute_adf.cpp index 5d55f1fbbb..e0213872d6 100644 --- a/src/compute_adf.cpp +++ b/src/compute_adf.cpp @@ -43,18 +43,18 @@ enum{DEGREE, RADIAN, COSINE}; ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), klo(NULL), khi(NULL), - hist(NULL), histall(NULL), - rcutinnerj(NULL), rcutinnerk(NULL), - rcutouterj(NULL), rcutouterk(NULL), - list(NULL), - iatomcount(NULL), iatomcountall(NULL), iatomflag(NULL), - maxjatom(NULL), maxkatom(NULL), - numjatom(NULL), numkatom(NULL), - neighjatom(NULL),neighkatom(NULL), - jatomflag(NULL), katomflag(NULL), - maxjkatom(NULL), numjkatom(NULL), - neighjkatom(NULL), bothjkatom(NULL), delrjkatom(NULL) + ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), klo(nullptr), khi(nullptr), + hist(nullptr), histall(nullptr), + rcutinnerj(nullptr), rcutinnerk(nullptr), + rcutouterj(nullptr), rcutouterk(nullptr), + list(nullptr), + iatomcount(nullptr), iatomcountall(nullptr), iatomflag(nullptr), + maxjatom(nullptr), maxkatom(nullptr), + numjatom(nullptr), numkatom(nullptr), + neighjatom(nullptr),neighkatom(nullptr), + jatomflag(nullptr), katomflag(nullptr), + maxjkatom(nullptr), numjkatom(nullptr), + neighjkatom(nullptr), bothjkatom(nullptr), delrjkatom(nullptr) { int nargsperadf = 7; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 6b6f376b4c..97f8c6ff9e 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - aggregateID(NULL) + aggregateID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute aggregate/atom command"); @@ -71,10 +71,10 @@ void ComputeAggregateAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute aggregate/atom unless atoms have IDs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Compute aggregate/atom requires a bond style to be defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_angle.cpp b/src/compute_angle.cpp index e3e44efbbb..83daeedb9a 100644 --- a/src/compute_angle.cpp +++ b/src/compute_angle.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute angle command"); diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index b100824ea9..8f9f728cf8 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -38,7 +38,7 @@ enum{THETA,ENG,VARIABLE}; ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), tstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), tstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute angle/local command"); @@ -77,7 +77,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - tstr = NULL; + tstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -123,8 +123,8 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -146,7 +146,7 @@ ComputeAngleLocal::~ComputeAngleLocal() void ComputeAngleLocal::init() { - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"No angle style is defined for compute angle/local"); if (nvar) { diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 6c9f1d65a2..eb22dcee5d 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), angmom(NULL), angmomall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), angmom(nullptr), angmomall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute angmom/chunk command"); diff --git a/src/compute_bond.cpp b/src/compute_bond.cpp index 503582bc65..f7c4206857 100644 --- a/src/compute_bond.cpp +++ b/src/compute_bond.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute bond command"); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 010e8db627..c201a9886d 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -39,7 +39,7 @@ enum{DIST,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE}; ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), dstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), dstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute bond/local command"); @@ -84,7 +84,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - dstr = NULL; + dstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -142,8 +142,8 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeBondLocal::~ComputeBondLocal() void ComputeBondLocal::init() { - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"No bond style is defined for compute bond/local"); if (nvar) { diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index f88dea9ebe..af32a8e9a3 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), centro(NULL) + distsq(nullptr), nearest(nullptr), centro(nullptr) { if (narg < 4 || narg > 6) error->all(FLERR,"Illegal compute centro/atom command"); @@ -88,7 +88,7 @@ ComputeCentroAtom::~ComputeCentroAtom() void ComputeCentroAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute centro/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 7c979c66d7..499d903451 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute centroid/stress/atom command"); @@ -49,7 +49,7 @@ ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -237,7 +237,7 @@ void ComputeCentroidStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index d0044410d8..7fe9394b43 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -54,10 +54,10 @@ enum{LIMITMAX,LIMITEXACT}; ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - chunk_volume_vec(NULL), coord(NULL), ichunk(NULL), chunkID(NULL), - cfvid(NULL), idregion(NULL), region(NULL), cchunk(NULL), fchunk(NULL), - varatom(NULL), id_fix(NULL), fixstore(NULL), lockfix(NULL), chunk(NULL), - exclude(NULL), hash(NULL) + chunk_volume_vec(nullptr), coord(nullptr), ichunk(nullptr), chunkID(nullptr), + cfvid(nullptr), idregion(nullptr), region(nullptr), cchunk(nullptr), fchunk(nullptr), + varatom(nullptr), id_fix(nullptr), fixstore(nullptr), lockfix(nullptr), chunk(nullptr), + exclude(nullptr), hash(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute chunk/atom command"); @@ -73,7 +73,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : binflag = 0; ncoord = 0; - cfvid = NULL; + cfvid = nullptr; if (strcmp(arg[3],"bin/1d") == 0) { binflag = 1; @@ -177,7 +177,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // optional args regionflag = 0; - idregion = NULL; + idregion = nullptr; nchunksetflag = 0; nchunkflag = EVERY; limit = 0; @@ -448,16 +448,16 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // initialize chunk vector and per-chunk info nmax = 0; - chunk = NULL; + chunk = nullptr; nmaxint = -1; - ichunk = NULL; - exclude = NULL; + ichunk = nullptr; + exclude = nullptr; nchunk = 0; chunk_volume_scalar = 1.0; - chunk_volume_vec = NULL; - coord = NULL; - chunkID = NULL; + chunk_volume_vec = nullptr; + coord = nullptr; + chunkID = nullptr; // computeflag = 1 if this compute might invoke another compute // during assign_chunk_ids() @@ -470,17 +470,17 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : invoked_setup = -1; invoked_ichunk = -1; - id_fix = NULL; - fixstore = NULL; + id_fix = nullptr; + fixstore = nullptr; if (compress) hash = new std::map(); - else hash = NULL; + else hash = nullptr; maxvar = 0; - varatom = NULL; + varatom = nullptr; lockcount = 0; - lockfix = NULL; + lockfix = nullptr; if (which == MOLECULE) molcheck = 1; else molcheck = 0; @@ -593,7 +593,7 @@ void ComputeChunkAtom::init() if ((idsflag != ONCE && !lockcount) && fixstore) { modify->delete_fix(id_fix); - fixstore = NULL; + fixstore = nullptr; } } @@ -665,7 +665,7 @@ double ComputeChunkAtom::compute_scalar() void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) { - if (lockfix == NULL) { + if (lockfix == nullptr) { lockfix = fixptr; lockstart = startstep; lockstop = stopstep; @@ -689,7 +689,7 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) void ComputeChunkAtom::unlock(Fix *fixptr) { if (fixptr != lockfix) return; - lockfix = NULL; + lockfix = nullptr; } /* ---------------------------------------------------------------------- @@ -1049,7 +1049,7 @@ void ComputeChunkAtom::compress_chunk_ids() // create my list of populated IDs - int *list = NULL; + int *list = nullptr; memory->create(list,n,"chunk/atom:list"); n = 0; @@ -1094,7 +1094,7 @@ void ComputeChunkAtom::compress_chunk_ids() memory->destroy(listall); } else { - comm->ring(n,sizeof(int),list,1,idring,NULL,(void *)this,0); + comm->ring(n,sizeof(int),list,1,idring,nullptr,(void *)this,0); } memory->destroy(list); diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 98a3ea9a2b..14c86383b7 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -96,7 +96,7 @@ class ComputeChunkAtom : public Compute { class FixStore *fixstore; class Fix *lockfix; // ptr to FixAveChunk that is locking out setups - // NULL if no lock currently in place + // nullptr if no lock currently in place bigint lockstart,lockstop; // timesteps for start and stop of locking bigint invoked_setup; // last timestep setup_chunks and nchunk calculated diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 953ae3a8cb..b3b57d75d3 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -37,7 +37,7 @@ enum{COMPUTE,FIX}; ComputeChunkSpreadAtom:: ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), ids(NULL), which(NULL), argindex(NULL), value2index(NULL) + idchunk(nullptr), ids(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute chunk/spread/atom command"); @@ -68,7 +68,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0) { @@ -161,8 +161,8 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom vector or array nmax = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 8086ef3f41..fa31e738bc 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -37,7 +37,7 @@ enum{CLUSTER,MASK,COORDS}; ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - clusterID(NULL) + clusterID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cluster/atom command"); @@ -64,7 +64,7 @@ void ComputeClusterAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute cluster/atom unless atoms have IDs"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index e9b6f16990..9a7a9b5d15 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -44,7 +44,7 @@ enum{NCOMMON,NBOND,MAXBOND,MINBOND}; ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), pattern(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), pattern(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cna/atom command"); @@ -71,7 +71,7 @@ ComputeCNAAtom::~ComputeCNAAtom() void ComputeCNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cna/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR,"Compute cna/atom cutoff is longer than pairwise cutoff"); diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index 8398311a05..39ea6cfa82 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -31,7 +31,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeCOMChunk::ComputeCOMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), masstotal(NULL), massproc(NULL), com(NULL), comall(NULL) + idchunk(nullptr), masstotal(nullptr), massproc(nullptr), com(nullptr), comall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute com/chunk command"); diff --git a/src/compute_contact_atom.cpp b/src/compute_contact_atom.cpp index 7a288afb43..11f0c14893 100644 --- a/src/compute_contact_atom.cpp +++ b/src/compute_contact_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeContactAtom::ComputeContactAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - contact(NULL) + contact(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute contact/atom command"); @@ -57,7 +57,7 @@ ComputeContactAtom::~ComputeContactAtom() void ComputeContactAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute contact/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index cb919d3a83..05d299fa26 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -38,8 +38,8 @@ using namespace LAMMPS_NS; ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - typelo(NULL), typehi(NULL), cvec(NULL), carray(NULL), - group2(NULL), id_orientorder(NULL), normv(NULL) + typelo(nullptr), typehi(nullptr), cvec(nullptr), carray(nullptr), + group2(nullptr), id_orientorder(nullptr), normv(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute coord/atom command"); @@ -147,7 +147,7 @@ void ComputeCoordAtom::init() "option in compute orientorder/atom"); } - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute coord/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index 8853887f18..64d9c8b37e 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dihedral command"); diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index ac2c884c3f..d1ff051940 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -38,7 +38,7 @@ enum{PHI,VARIABLE}; ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), pstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), pstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute dihedral/local command"); @@ -74,7 +74,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - pstr = NULL; + pstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -122,8 +122,8 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -145,7 +145,7 @@ ComputeDihedralLocal::~ComputeDihedralLocal() void ComputeDihedralLocal::init() { - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"No dihedral style is defined for compute dihedral/local"); if (nvar) { diff --git a/src/compute_dipole_chunk.cpp b/src/compute_dipole_chunk.cpp index 361ee36c18..f387786b83 100644 --- a/src/compute_dipole_chunk.cpp +++ b/src/compute_dipole_chunk.cpp @@ -34,9 +34,9 @@ enum { MASSCENTER, GEOMCENTER }; ComputeDipoleChunk::ComputeDipoleChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), chrgproc(NULL), - chrgtotal(NULL), com(NULL), - comall(NULL), dipole(NULL), dipoleall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), chrgproc(nullptr), + chrgtotal(nullptr), com(nullptr), + comall(nullptr), dipole(nullptr), dipoleall(nullptr) { if ((narg != 4) && (narg != 5)) error->all(FLERR,"Illegal compute dipole/chunk command"); diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index 4b194cfab1..bd939f1402 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - displace(NULL), id_fix(NULL) + displace(nullptr), id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute displace/atom command"); @@ -44,7 +44,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // optional args refreshflag = 0; - rvar = NULL; + rvar = nullptr; int iarg = 3; while (iarg < narg) { @@ -102,7 +102,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom displacement array nmax = nvmax = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 78664a912f..d3f0d723c6 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeErotateSphereAtom:: ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - erot(NULL) + erot(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute erotate/sphere//atom command"); diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index db003c93e7..85497bce02 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - fragmentID(NULL) + fragmentID(nullptr) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Compute fragment/atom used when bonds are not allowed"); @@ -61,9 +61,9 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - stack = NULL; - clist = NULL; - markflag = NULL; + stack = nullptr; + clist = nullptr; + markflag = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_global_atom.cpp b/src/compute_global_atom.cpp index b3e4f88bf3..03d9ba4ecb 100644 --- a/src/compute_global_atom.cpp +++ b/src/compute_global_atom.cpp @@ -39,8 +39,8 @@ enum{VECTOR,ARRAY}; ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idref(NULL), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - indices(NULL), varatom(NULL), vecglobal(NULL) + idref(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + indices(nullptr), varatom(nullptr), vecglobal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute global/atom command"); @@ -96,7 +96,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || strncmp(arg[iarg],"v_",2) == 0) { @@ -234,8 +234,8 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : else size_peratom_cols = nvalues; nmax = maxvector = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index ca0483fce9..90956c6b15 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -45,7 +45,7 @@ enum{OFF,INTER,INTRA}; ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute group/group command"); @@ -122,15 +122,15 @@ void ComputeGroupGroup::init() // if non-hybrid, then error if single_enable = 0 // if hybrid, let hybrid determine if sub-style sets single_enable = 0 - if (pairflag && force->pair == NULL) + if (pairflag && force->pair == nullptr) error->all(FLERR,"No pair style defined for compute group/group"); - if (force->pair_match("^hybrid",0) == NULL + if (force->pair_match("^hybrid",0) == nullptr && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute group/group"); // error if Kspace style does not compute group/group interactions - if (kspaceflag && force->kspace == NULL) + if (kspaceflag && force->kspace == nullptr) error->all(FLERR,"No Kspace style defined for compute group/group"); if (kspaceflag && force->kspace->group_group_enable == 0) error->all(FLERR,"Kspace style does not support compute group/group"); @@ -138,10 +138,10 @@ void ComputeGroupGroup::init() if (pairflag) { pair = force->pair; cutsq = force->pair->cutsq; - } else pair = NULL; + } else pair = nullptr; if (kspaceflag) kspace = force->kspace; - else kspace = NULL; + else kspace = nullptr; // compute Kspace correction terms diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index ad0520bc01..f7e7c8ced9 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -29,8 +29,8 @@ using namespace LAMMPS_NS; ComputeGyrationChunk::ComputeGyrationChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - rg(NULL), rgall(NULL), rgt(NULL), rgtall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + rg(nullptr), rgall(nullptr), rgt(nullptr), rgtall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute gyration/chunk command"); diff --git a/src/compute_heat_flux.cpp b/src/compute_heat_flux.cpp index 15a17949eb..bcb10c833a 100644 --- a/src/compute_heat_flux.cpp +++ b/src/compute_heat_flux.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeHeatFlux::ComputeHeatFlux(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_ke(NULL), id_pe(NULL), id_stress(NULL) + id_ke(nullptr), id_pe(nullptr), id_stress(nullptr) { if (narg != 6) error->all(FLERR,"Illegal compute heat/flux command"); diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index 00f81dc845..736a7e64c6 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -45,7 +45,7 @@ using namespace MathConst; ComputeHexOrderAtom::ComputeHexOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), qnarray(NULL) + distsq(nullptr), nearest(nullptr), qnarray(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute hexorder/atom command"); @@ -104,7 +104,7 @@ ComputeHexOrderAtom::~ComputeHexOrderAtom() void ComputeHexOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute hexorder/atom requires a pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; else if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 3721dbfd48..aa65bde661 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute improper command"); diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index e363749b67..4d230cd1ec 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -35,7 +35,7 @@ using namespace MathConst; ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL) + vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute improper/local command"); @@ -57,8 +57,8 @@ ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -73,7 +73,7 @@ ComputeImproperLocal::~ComputeImproperLocal() void ComputeImproperLocal::init() { - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"No improper style is defined for compute improper/local"); // do initial memory allocation so that memory_usage() is correct @@ -135,7 +135,7 @@ int ComputeImproperLocal::compute_impropers(int flag) if (cflag >= 0) cbuf = vlocal; } else { if (cflag >= 0 && alocal) cbuf = &alocal[0][cflag]; - else cbuf = NULL; + else cbuf = nullptr; } } diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index 65de1d7bb5..ba7c4f36fc 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - inertia(NULL), inertiaall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + inertia(nullptr), inertiaall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute inertia/chunk command"); diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index 102d6364ff..65b3140d79 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputeKEAtom::ComputeKEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ke(NULL) + ke(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute ke/atom command"); diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index d23c389ab6..41ffa95fef 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute msd command"); diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index b0e2520f99..2c3c2811d2 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), id_fix(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), msd(NULL) + idchunk(nullptr), id_fix(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute msd/chunk command"); diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 4151b2cdb8..40f13f7483 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL),massproc(NULL),masstotal(NULL),com(NULL),comall(NULL), - inertia(NULL),inertiaall(NULL),angmom(NULL),angmomall(NULL),omega(NULL) + idchunk(nullptr),massproc(nullptr),masstotal(nullptr),com(nullptr),comall(nullptr), + inertia(nullptr),inertiaall(nullptr),angmom(nullptr),angmomall(nullptr),omega(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute omega/chunk command"); diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 7323b6ef01..e76081e0b8 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -49,8 +49,8 @@ using namespace MathConst; ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - qlist(NULL), distsq(NULL), nearest(NULL), rlist(NULL), - qnarray(NULL), qnm_r(NULL), qnm_i(NULL), cglist(NULL) + qlist(nullptr), distsq(nullptr), nearest(nullptr), rlist(nullptr), + qnarray(nullptr), qnm_r(nullptr), qnm_i(nullptr), cglist(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute orientorder/atom command"); @@ -186,7 +186,7 @@ ComputeOrientOrderAtom::~ComputeOrientOrderAtom() void ComputeOrientOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute orientorder/atom requires a " "pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index 7ace5615a7..15b5bec19a 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -28,7 +28,7 @@ enum{EPAIR,EVDWL,ECOUL}; ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pair(NULL), one(NULL) + pstyle(nullptr), pair(nullptr), one(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair command"); @@ -82,7 +82,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : extvector = 1; one = new double[npair]; vector = new double[npair]; - } else one = vector = NULL; + } else one = vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index e41221f70b..a8fa247e4d 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -37,7 +37,7 @@ enum{TYPE,RADIUS}; ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pindex(NULL), vlocal(NULL), alocal(NULL) + pstyle(nullptr), pindex(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair/local command"); @@ -97,8 +97,8 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,7 +115,7 @@ ComputePairLocal::~ComputePairLocal() void ComputePairLocal::init() { - if (singleflag && force->pair == NULL) + if (singleflag && force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pair/local"); if (singleflag && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pair/local"); diff --git a/src/compute_pe_atom.cpp b/src/compute_pe_atom.cpp index 6bdd729502..374a3151ce 100644 --- a/src/compute_pe_atom.cpp +++ b/src/compute_pe_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - energy(NULL) + energy(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute pe/atom command"); diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index 90e4f9b39c..ae1bb4747d 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure command"); if (igroup) error->all(FLERR,"Compute pressure must use group all"); @@ -51,7 +51,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -130,13 +130,13 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void ComputePressure::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairhybridflag && force->pair) nvirial++; if (pairflag && force->pair) nvirial++; @@ -221,7 +221,7 @@ void ComputePressure::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 9c637edc1e..e23458d201 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - index(NULL), pack_choice(NULL) + index(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/atom command"); @@ -441,7 +441,7 @@ void ComputePropertyAtom::compute_peratom() (this->*pack_choice[0])(0); } else { if (nmax) buf = &array_atom[0][0]; - else buf = NULL; + else buf = nullptr; for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n); } diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index c27cfc4096..ad21e80296 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputePropertyChunk::ComputePropertyChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), count_one(NULL), count_all(NULL) + idchunk(nullptr), count_one(nullptr), count_all(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute property/chunk command"); diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 651e1190b1..8478535e9e 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -35,7 +35,7 @@ enum{TYPE,RADIUS}; ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL), indices(NULL), pack_choice(NULL) + vlocal(nullptr), alocal(nullptr), indices(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/local command"); @@ -254,8 +254,8 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/local requires atom attribute radius"); nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -273,7 +273,7 @@ ComputePropertyLocal::~ComputePropertyLocal() void ComputePropertyLocal::init() { if (kindflag == NEIGH || kindflag == PAIR) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute property/local"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute property/local"); diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index a28223b3a7..f4d553d2db 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -41,9 +41,9 @@ using namespace MathConst; ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rdfpair(NULL), nrdfpair(NULL), ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), - hist(NULL), histall(NULL), typecount(NULL), icount(NULL), jcount(NULL), - duplicates(NULL) + rdfpair(nullptr), nrdfpair(nullptr), ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), + hist(nullptr), histall(nullptr), typecount(nullptr), icount(nullptr), jcount(nullptr), + duplicates(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rdf command"); diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index b024b4365c..66af301e48 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -44,14 +44,14 @@ enum{PERATOM,LOCAL}; ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), flavor(NULL), - value2index(NULL), ids(NULL), onevec(NULL), replace(NULL), indices(NULL), - owner(NULL), idregion(NULL), varatom(NULL) + nvalues(0), which(nullptr), argindex(nullptr), flavor(nullptr), + value2index(nullptr), ids(nullptr), onevec(nullptr), replace(nullptr), indices(nullptr), + owner(nullptr), idregion(nullptr), varatom(nullptr) { int iarg = 0; if (strcmp(style,"reduce") == 0) { if (narg < 5) error->all(FLERR,"Illegal compute reduce command"); - idregion = NULL; + idregion = nullptr; iarg = 3; } else if (strcmp(style,"reduce/region") == 0) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/region command"); @@ -93,13 +93,13 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = flavor[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"x") == 0) { which[nvalues] = X; @@ -190,7 +190,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : if (replace[i] >= 0) flag = 1; if (!flag) { delete [] replace; - replace = NULL; + replace = nullptr; } // if wildcard expansion occurred, free earg memory from expand_args() @@ -285,8 +285,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; if (mode == SUM || mode == SUMSQ) extscalar = 1; else extscalar = 0; - vector = onevec = NULL; - indices = owner = NULL; + vector = onevec = nullptr; + indices = owner = nullptr; } else { vector_flag = 1; size_vector = nvalues; @@ -299,7 +299,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : } maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 6e8aa48410..fbcf82619f 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -40,8 +40,8 @@ enum{UNKNOWN=-1,COMPUTE,FIX,VARIABLE}; ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), argindex(NULL), value2index(NULL), idchunk(NULL), ids(NULL), - vlocal(NULL), vglobal(NULL), alocal(NULL), aglobal(NULL), varatom(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), idchunk(nullptr), ids(nullptr), + vlocal(nullptr), vglobal(nullptr), alocal(nullptr), aglobal(nullptr), varatom(nullptr) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/chunk command"); @@ -78,13 +78,13 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || @@ -193,11 +193,11 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : else if (mode == MAXX) initvalue = -BIG; maxchunk = 0; - vlocal = vglobal = NULL; - alocal = aglobal = NULL; + vlocal = vglobal = nullptr; + alocal = aglobal = nullptr; maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index ca4b735d6e..036a9bb289 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute slice command"); diff --git a/src/compute_stress_atom.cpp b/src/compute_stress_atom.cpp index 9c65ee86c2..279d2af07c 100644 --- a/src/compute_stress_atom.cpp +++ b/src/compute_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute stress/atom command"); @@ -49,7 +49,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -213,7 +213,7 @@ void ComputeStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 54f0529006..f3110cfeca 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -31,8 +31,8 @@ enum{TEMP,KECOM,INTERNAL}; ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), idchunk(NULL), id_bias(NULL), sum(NULL), sumall(NULL), count(NULL), - countall(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + which(nullptr), idchunk(nullptr), id_bias(nullptr), sum(nullptr), sumall(nullptr), count(nullptr), + countall(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute temp/chunk command"); @@ -71,7 +71,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : comflag = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index b50962a2c6..75b784c858 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -47,7 +47,7 @@ ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index 85e51d2a5d..5ce62dfeb2 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -47,7 +47,7 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute temp/partial cannot use vz for 2d systemx"); maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index eacca87e19..0344880e13 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -30,7 +30,7 @@ enum{TENSOR,BIN}; ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bin(NULL), vbin(NULL), binave(NULL), tbin(NULL), tbinall(NULL) + bin(nullptr), vbin(nullptr), binave(nullptr), tbin(nullptr), tbinall(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute temp/profile command"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 3874c1f286..17509b85a0 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -98,7 +98,7 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : } maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 74955da421..8a8d671dfd 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute temp/region command"); @@ -48,7 +48,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 6ef3038d68..42dc790a3a 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -32,7 +32,7 @@ enum{ROTATE,ALL}; ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL) + id_bias(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/sphere command"); diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index c0b648418b..df25591450 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), torque(NULL), torqueall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), torque(nullptr), torqueall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute torque/chunk command"); diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index 635c3e4161..a34c4bac8e 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute vacf command"); diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index 6651110e77..7edab91d54 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -29,7 +29,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute vcm/chunk command"); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 7e84e9cce0..d7f862de93 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -130,7 +130,7 @@ void CreateAtoms::command(int narg, char **arg) mode = ATOM; int molseed; varflag = 0; - vstr = xstr = ystr = zstr = NULL; + vstr = xstr = ystr = zstr = nullptr; quatone[0] = quatone[1] = quatone[2] = 0.0; subsetflag = NONE; int subsetseed; @@ -245,7 +245,7 @@ void CreateAtoms::command(int narg, char **arg) // error check and further setup for mode = MOLECULE - ranmol = NULL; + ranmol = nullptr; if (mode == MOLECULE) { if (onemol->xflag == 0) error->all(FLERR,"Create_atoms molecule must have coordinates"); @@ -267,7 +267,7 @@ void CreateAtoms::command(int narg, char **arg) ranmol = new RanMars(lmp,molseed+me); } - ranlatt = NULL; + ranlatt = nullptr; if (subsetflag != NONE) ranlatt = new RanMars(lmp,subsetseed+me); // error check and further setup for variable test diff --git a/src/create_atoms.h b/src/create_atoms.h index 87d15d00bd..5508752f00 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -62,7 +62,7 @@ class CreateAtoms : protected Pointers { void add_random(); void add_lattice(); void loop_lattice(int); - void add_molecule(double *, double * = NULL); + void add_molecule(double *, double * = nullptr); int vartest(double *); // evaluate a variable with new atom position }; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 9e3eb65801..7bface4d02 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -197,14 +197,14 @@ void CreateBonds::many() // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Create_bonds requires a pair style be defined"); if (rmax > neighbor->cutneighmax) error->all(FLERR,"Create_bonds max distance > neighbor cutoff"); if (rmax > neighbor->cutneighmin && comm->me == 0) error->warning(FLERR,"Create_bonds max distance > minimum neighbor cutoff"); - // require special_bonds 1-2 weights = 0.0 and KSpace = NULL + // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr // so that already bonded atom pairs do not appear in neighbor list // otherwise with newton_bond = 1, // would be hard to check if I-J bond already existed diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 8baee645cf..9f73a64f75 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -299,7 +299,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Delete_atoms requires a pair style be defined"); if (cut > neighbor->cutneighmax) error->all(FLERR,"Delete_atoms cutoff > max neighbor cutoff"); @@ -476,7 +476,7 @@ void DeleteAtoms::delete_bond() for (int i = 0; i < nlocal; i++) if (dlist[i]) list[n++] = tag[i]; - comm->ring(n,sizeof(tagint),list,1,bondring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,bondring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -514,7 +514,7 @@ void DeleteAtoms::delete_molecule() std::map::iterator pos; for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index b8ec5f7883..4b68a461f1 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -75,7 +75,7 @@ void DeleteBonds::command(int narg, char **arg) // use utils::bounds(FLERR,) to allow setting of range of types // range can be 0 to ntypes inclusive - int *tlist = NULL; + int *tlist = nullptr; int iarg = 2; if (style != MULTI && style != STATS) { diff --git a/src/dihedral.cpp b/src/dihedral.cpp index ac2d432cfb..f75b89139f 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -36,10 +36,10 @@ Dihedral::Dihedral(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 61e0fdc72a..83feb2f841 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -161,7 +161,7 @@ void DihedralHybrid::allocate() maxdihedral = new int[nstyles]; dihedrallist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxdihedral[m] = 0; - for (int m = 0; m < nstyles; m++) dihedrallist[m] = NULL; + for (int m = 0; m < nstyles; m++) dihedrallist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void DihedralHybrid::write_restart(FILE *fp) void DihedralHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Dihedral*[nstyles]; keywords = new char*[nstyles]; @@ -338,10 +338,10 @@ void DihedralHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_dihedral(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 018288d470..4f84956991 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -44,7 +44,7 @@ enum{MOVE,RAMP,RANDOM,ROTATE}; DisplaceAtoms::DisplaceAtoms(LAMMPS *lmp) : Pointers(lmp) { - mvec = NULL; + mvec = nullptr; } /* ---------------------------------------------------------------------- */ @@ -313,7 +313,7 @@ void DisplaceAtoms::command(int narg, char **arg) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -384,7 +384,7 @@ void DisplaceAtoms::move(int idim, char *arg, double scale) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += delta; } else if (input->variable->atomstyle(ivar)) { - if (mvec == NULL) memory->create(mvec,nlocal,"displace_atoms:mvec"); + if (mvec == nullptr) memory->create(mvec,nlocal,"displace_atoms:mvec"); input->variable->compute_atom(ivar,igroup,mvec,1,0); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += scale*mvec[i]; diff --git a/src/domain.cpp b/src/domain.cpp index 984c735a20..086f0228b1 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -89,7 +89,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxlo_lamda[0] = boxlo_lamda[1] = boxlo_lamda[2] = 0.0; boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; - lattice = NULL; + lattice = nullptr; char **args = new char*[2]; args[0] = (char *) "none"; args[1] = (char *) "1.0"; @@ -97,7 +97,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) delete [] args; nregion = maxregion = 0; - regions = NULL; + regions = nullptr; copymode = 0; @@ -1640,7 +1640,7 @@ void Domain::image_flip(int m, int n, int p) return 1 if this proc owns atom with coords x, else return 0 x is returned remapped into periodic box if image flag is passed, flag is updated via remap(x,image) - if image = NULL is passed, no update with remap(x) + if image = nullptr is passed, no update with remap(x) if shrinkexceed, atom can be outside shrinkwrap boundaries called from create_atoms() in library.cpp ------------------------------------------------------------------------- */ @@ -1727,7 +1727,7 @@ int Domain::ownatom(int /*id*/, double *x, imageint *image, int shrinkexceed) void Domain::set_lattice(int narg, char **arg) { if (lattice) delete lattice; - lattice = NULL; + lattice = nullptr; lattice = new Lattice(lmp,narg,arg); } diff --git a/src/dump.cpp b/src/dump.cpp index febc3d0821..3f1e997d13 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -66,17 +66,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = NULL; - format_default = NULL; + format = nullptr; + format_default = nullptr; - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_column_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_column_user = nullptr; refreshflag = 0; - refresh = NULL; + refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -93,20 +93,20 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = NULL; + nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + buf = bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; maxsbuf = 0; - sbuf = NULL; + sbuf = nullptr; maxpbc = 0; - xpbc = vpbc = NULL; - imagepbc = NULL; + xpbc = vpbc = nullptr; + imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -117,7 +117,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .zst = Zstd compressed text file // else ASCII text file - fp = NULL; + fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; @@ -128,7 +128,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = NULL; + multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { @@ -202,15 +202,15 @@ Dump::~Dump() delete[] nameslist; } - // XTC style sets fp to NULL since it closes file in its destructor + // XTC style sets fp to nullptr since it closes file in its destructor - if (multifile == 0 && fp != NULL) { + if (multifile == 0 && fp != nullptr) { if (compressed) { if (filewriter) pclose(fp); } else { if (filewriter) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -229,10 +229,10 @@ void Dump::init() delete irregular; maxids = maxsort = maxproc = 0; - bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; } if (sort_flag) { @@ -243,7 +243,7 @@ void Dump::init() error->all(FLERR,"Cannot dump sort on atom IDs with no atom IDs defined"); if (sortcol && sortcol > size_one) error->all(FLERR,"Dump sort column is invalid"); - if (nprocs > 1 && irregular == NULL) + if (nprocs > 1 && irregular == nullptr) irregular = new Irregular(lmp); bigint size = group->count(igroup); @@ -438,7 +438,7 @@ void Dump::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // if buffering, convert doubles into strings @@ -528,11 +528,11 @@ void Dump::write() if (multifile) { if (compressed) { - if (filewriter && fp != NULL) pclose(fp); + if (filewriter && fp != nullptr) pclose(fp); } else { - if (filewriter && fp != NULL) fclose(fp); + if (filewriter && fp != nullptr) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -609,8 +609,8 @@ void Dump::openfile() fp = fopen(filecurrent,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); - } else fp = NULL; + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else fp = nullptr; // delete string with timestep replaced @@ -1013,10 +1013,10 @@ void Dump::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; // pass format none to child classes which may use it // not an error if they don't modify_param(narg-iarg,&arg[iarg]); @@ -1055,7 +1055,7 @@ void Dump::modify_params(int narg, char **arg) nameslist = new char*[maxfiles]; numfiles = 0; for (int idx=0; idx < maxfiles; ++idx) - nameslist[idx] = NULL; + nameslist[idx] = nullptr; fileidx = 0; } iarg += 2; diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index a68e950597..f8d02904fa 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -34,7 +34,7 @@ DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) image_flag = 0; buffer_allow = 1; buffer_flag = 1; - format_default = NULL; + format_default = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index da9740d9ca..ffff1e85c7 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), auxname(NULL) + DumpCustom(lmp, narg, arg), auxname(nullptr) { multifile_override = 0; @@ -63,7 +63,7 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : // convert 'X_ID[m]' (X=c,f,v) to 'X_ID_m' if (nfield > 5) auxname = new char*[nfield]; - else auxname = NULL; + else auxname = nullptr; int i = 0; for (int iarg = 5; iarg < nfield; iarg++, i++) { diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 167d88789c..1439e68cef 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -53,13 +53,13 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - idregion(NULL), thresh_array(NULL), thresh_op(NULL), thresh_value(NULL), - thresh_last(NULL), thresh_fix(NULL), thresh_fixID(NULL), thresh_first(NULL), - earg(NULL), vtype(NULL), vformat(NULL), columns(NULL), choose(NULL), - dchoose(NULL), clist(NULL), field2index(NULL), argindex(NULL), id_compute(NULL), - compute(NULL), id_fix(NULL), fix(NULL), id_variable(NULL), variable(NULL), - vbuf(NULL), id_custom(NULL), flag_custom(NULL), typenames(NULL), - pack_choice(NULL) + idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr), + thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr), + earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), choose(nullptr), + dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr), id_compute(nullptr), + compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr), variable(nullptr), + vbuf(nullptr), id_custom(nullptr), flag_custom(nullptr), typenames(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); @@ -87,37 +87,37 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : buffer_allow = 1; buffer_flag = 1; iregion = -1; - idregion = NULL; + idregion = nullptr; nthresh = 0; - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; nthreshlast = 0; - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; // computes, fixes, variables which the dump accesses ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; nvariable = 0; - id_variable = NULL; - variable = NULL; - vbuf = NULL; + id_variable = nullptr; + variable = nullptr; + vbuf = nullptr; ncustom = 0; - id_custom = NULL; - flag_custom = NULL; + id_custom = nullptr; + flag_custom = nullptr; // process attributes // ioptional = start of additional optional args in expanded args @@ -142,9 +142,9 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : // atom selection arrays maxlocal = 0; - choose = NULL; - dchoose = NULL; - clist = NULL; + choose = nullptr; + dchoose = nullptr; + clist = nullptr; // default element name for all types = C @@ -167,11 +167,11 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::DOUBLE) strcat(format_default,"%g "); else if (vtype[i] == Dump::STRING) strcat(format_default,"%s "); else if (vtype[i] == Dump::BIGINT) strcat(format_default,BIGINT_FORMAT " "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -279,8 +279,8 @@ void DumpCustom::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { @@ -1648,7 +1648,7 @@ int DumpCustom::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -1711,7 +1711,7 @@ int DumpCustom::modify_param(int narg, char **arg) // just clear format_column_user allocated by this dump child class for (int i = 0; i < size_one; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } return 2; } @@ -1729,7 +1729,7 @@ int DumpCustom::modify_param(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Dump_modify int format does not contain d character"); char str[8]; @@ -1791,17 +1791,17 @@ int DumpCustom::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; for (int i = 0; i < nthreshlast; i++) { modify->delete_fix(thresh_fixID[i]); delete [] thresh_fixID[i]; } - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; } nthresh = nthreshlast = 0; return 2; diff --git a/src/dump_dcd.cpp b/src/dump_dcd.cpp index 254b371e22..8c848d261e 100644 --- a/src/dump_dcd.cpp +++ b/src/dump_dcd.cpp @@ -51,7 +51,7 @@ static inline void fwrite_int32(FILE* fd, uint32_t i) /* ---------------------------------------------------------------------- */ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump dcd command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), sortcol = 0; unwrap_flag = 0; - format_default = NULL; + format_default = nullptr; // allocate global array for atom coords @@ -115,7 +115,7 @@ void DumpDCD::openfile() { if (me == 0) { fp = fopen(filename,"wb"); - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); } } @@ -342,7 +342,7 @@ void DumpDCD::write_dcd_header(const char *remarks) strncpy(title_string,remarks,80); title_string[79] = '\0'; fwrite(title_string,80,1,fp); - cur_time=time(NULL); + cur_time=time(nullptr); tmbuf=localtime(&cur_time); memset(title_string,' ',81); strftime(title_string,80,"REMARKS Created %d %B,%Y at %H:%M",tmbuf); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 96a338950b..bbaa9038b6 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -50,12 +50,12 @@ enum{NO,YES}; /* ---------------------------------------------------------------------- */ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), thetastr(NULL), phistr(NULL), cxstr(NULL), - cystr(NULL), czstr(NULL), upxstr(NULL), upystr(NULL), upzstr(NULL), - zoomstr(NULL), perspstr(NULL), diamtype(NULL), diamelement(NULL), - bdiamtype(NULL), colortype(NULL), colorelement(NULL), bcolortype(NULL), - avec_line(NULL), avec_tri(NULL), avec_body(NULL), fixptr(NULL), image(NULL), - chooseghost(NULL), bufcopy(NULL) + DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr), + cystr(nullptr), czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr), + zoomstr(nullptr), perspstr(nullptr), diamtype(nullptr), diamelement(nullptr), + bdiamtype(nullptr), colortype(nullptr), colorelement(nullptr), bcolortype(nullptr), + avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr), image(nullptr), + chooseghost(nullptr), bufcopy(nullptr) { if (binary || multiproc) error->all(FLERR,"Invalid dump image filename"); @@ -124,16 +124,16 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : bdiam = NUMERIC; bdiamvalue = 0.5; } - char *fixID = NULL; + char *fixID = nullptr; - thetastr = phistr = NULL; + thetastr = phistr = nullptr; cflag = STATIC; cx = cy = cz = 0.5; - cxstr = cystr = czstr = NULL; + cxstr = cystr = czstr = nullptr; - upxstr = upystr = upzstr = NULL; - zoomstr = NULL; - perspstr = NULL; + upxstr = upystr = upzstr = nullptr; + zoomstr = nullptr; + perspstr = nullptr; boxflag = YES; boxdiam = 0.02; axesflag = NO; @@ -441,8 +441,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : else if (i % 6 == 0) bcolortype[i] = image->color2rgb("cyan"); } } else { - bdiamtype = NULL; - bcolortype = NULL; + bdiamtype = nullptr; + bcolortype = nullptr; } // viewflag = DYNAMIC if any view parameter is dynamic @@ -458,8 +458,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : // local data maxbufcopy = 0; - chooseghost = NULL; - bufcopy = NULL; + chooseghost = nullptr; + bufcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -566,7 +566,7 @@ void DumpImage::init_style() if (atomflag && acolor == ELEMENT) { for (int i = 1; i <= ntypes; i++) { colorelement[i] = image->element2color(typenames[i]); - if (colorelement[i] == NULL) + if (colorelement[i] == nullptr) error->all(FLERR,"Invalid dump image element name"); } } @@ -606,7 +606,7 @@ void DumpImage::write() // pack buf with color & diameter - pack(NULL); + pack(nullptr); // set minmax color range if using dynamic atom color map @@ -641,7 +641,7 @@ void DumpImage::write() else image->write_PPM(fp); if (multifile) { fclose(fp); - fp = NULL; + fp = nullptr; } } } @@ -1261,7 +1261,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1269,7 +1269,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { colortype[i] = image->color2rgb(ptrs[m%ncount]); - if (colortype[i] == NULL) + if (colortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1324,7 +1324,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1332,7 +1332,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { bcolortype[i] = image->color2rgb(ptrs[m%ncount]); - if (bcolortype[i] == NULL) + if (bcolortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1356,7 +1356,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"backcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); double *color = image->color2rgb(arg[1]); - if (color == NULL) error->all(FLERR,"Invalid color in dump_modify command"); + if (color == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); image->background[0] = static_cast (color[0]*255.0); image->background[1] = static_cast (color[1]*255.0); image->background[2] = static_cast (color[2]*255.0); @@ -1366,7 +1366,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"boxcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); image->boxcolor = image->color2rgb(arg[1]); - if (image->boxcolor == NULL) + if (image->boxcolor == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); return 2; } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index a71166ec57..988ff269de 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -35,9 +35,9 @@ enum{INT,DOUBLE}; DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - label(NULL), vtype(NULL), vformat(NULL), columns(NULL), field2index(NULL), - argindex(NULL), id_compute(NULL), compute(NULL), id_fix(NULL), fix(NULL), - pack_choice(NULL) + label(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), field2index(nullptr), + argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump local arguments specified"); @@ -73,12 +73,12 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : argindex = new int[nfield]; ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; // process attributes @@ -95,11 +95,11 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < size_one; i++) { if (vtype[i] == INT) strcat(format_default,"%d "); else if (vtype[i] == DOUBLE) strcat(format_default,"%g "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -180,8 +180,8 @@ void DumpLocal::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/dump_movie.cpp b/src/dump_movie.cpp index 5f6d0b80d7..951768978c 100644 --- a/src/dump_movie.cpp +++ b/src/dump_movie.cpp @@ -35,7 +35,7 @@ DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) : filetype = PPM; bitrate = 2000; framerate = 24; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ void DumpMovie::openfile() { char moviecmd[1024]; - if ((comm->me == 0) && (fp == NULL)) { + if ((comm->me == 0) && (fp == nullptr)) { #ifdef LAMMPS_FFMPEG sprintf(moviecmd,"ffmpeg -v error -y -r %.2f -f image2pipe -c:v ppm -i - " @@ -59,7 +59,7 @@ void DumpMovie::openfile() fp = popen(moviecmd,"w"); #endif - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Failed to open FFmpeg pipeline to " "file {}",filename)); } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 10ba10f995..d4352b0747 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - typenames(NULL) + typenames(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xyz command"); if (binary || multiproc) error->all(FLERR,"Invalid dump xyz filename"); @@ -46,7 +46,7 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), strcpy(format_default,str); ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,13 +54,13 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), DumpXYZ::~DumpXYZ() { delete[] format_default; - format_default = NULL; + format_default = nullptr; if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -83,7 +83,7 @@ void DumpXYZ::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; @@ -114,7 +114,7 @@ int DumpXYZ::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/error.cpp b/src/error.cpp index 0ea218887f..d89ea5b681 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -95,7 +95,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -143,7 +143,7 @@ void Error::all(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -169,7 +169,7 @@ void Error::all(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - write to world screen only if non-NULL on this proc + write to world screen only if non-nullptr on this proc always write to universe screen forces abort of entire world (and universe) if any proc in world calls ------------------------------------------------------------------------- */ @@ -192,7 +192,7 @@ void Error::one(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be nullptr when catching command line errors if (update) update->whichflag = 0; @@ -207,7 +207,7 @@ void Error::one(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - only write to screen if non-NULL on this proc since could be file + only write to screen if non-nullptr on this proc since could be file ------------------------------------------------------------------------- */ void Error::warning(const std::string &file, int line, const std::string &str, int logflag) diff --git a/src/fix.cpp b/src/fix.cpp index 03313739a1..8d6d3f8829 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -33,8 +33,8 @@ int Fix::instance_total = 0; Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), extlist(NULL), vector_atom(NULL), array_atom(NULL), - vector_local(NULL), array_local(NULL), eatom(NULL), vatom(NULL) + id(nullptr), style(nullptr), extlist(nullptr), vector_atom(nullptr), array_atom(nullptr), + vector_local(nullptr), array_local(nullptr), eatom(nullptr), vatom(nullptr) { instance_me = instance_total++; diff --git a/src/fix.h b/src/fix.h index ab8dddf1d9..07a222063c 100644 --- a/src/fix.h +++ b/src/fix.h @@ -215,7 +215,7 @@ class Fix : protected Pointers { virtual int image(int *&, double **&) {return 0;} virtual int modify_param(int, char **) {return 0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual double memory_usage() {return 0.0;} diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index dba4fde077..52f4236985 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -43,7 +43,7 @@ enum{DIAMETER,CHARGE}; /* ---------------------------------------------------------------------- */ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) +nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -96,7 +96,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].pstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].pparam = new char[n]; - adapt[nadapt].pair = NULL; + adapt[nadapt].pair = nullptr; strcpy(adapt[nadapt].pparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -118,7 +118,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].bstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].bparam = new char[n]; - adapt[nadapt].bond = NULL; + adapt[nadapt].bond = nullptr; strcpy(adapt[nadapt].bparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -263,8 +263,8 @@ void FixAdapt::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; if (diamflag && atom->radius_flag) { std::string fixcmd = id + std::string("_FIX_STORE_DIAM"); @@ -340,7 +340,7 @@ void FixAdapt::init() if (ad->which == PAIR) { anypair = 1; - ad->pair = NULL; + ad->pair = nullptr; // if ad->pstyle has trailing sub-style annotation ":N", // strip it for pstyle arg to pair_match() and set nsub = N @@ -366,12 +366,12 @@ void FixAdapt::init() ad->pair = force->pair_match(psuffix,1,nsub); delete[] psuffix; } - if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub); - if (ad->pair == NULL) + if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub); + if (ad->pair == nullptr) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = ad->pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt pair style param not supported"); // for pair styles only parameters that are 2-d arrays in atom types or @@ -396,7 +396,7 @@ void FixAdapt::init() delete [] pstyle; } else if (ad->which == BOND){ - ad->bond = NULL; + ad->bond = nullptr; anybond = 1; int n = strlen(ad->bstyle) + 1; @@ -412,13 +412,13 @@ void FixAdapt::init() ad->bond = force->bond_match(bsuffix); delete [] bsuffix; } - if (ad->bond == NULL) ad->bond = force->bond_match(bstyle); - if (ad->bond == NULL ) + if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle); + if (ad->bond == nullptr ) error->all(FLERR,"Fix adapt bond style does not exist"); void *ptr = ad->bond->extract(ad->bparam,ad->bdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt bond style param not supported"); // for bond styles, use a vector @@ -431,7 +431,7 @@ void FixAdapt::init() delete [] bstyle; } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 0983728ea9..a8b7a46e4f 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -36,7 +36,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), estr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix addforce command"); @@ -52,7 +52,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : ilevel_respa = 0; virial_flag = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -253,7 +253,7 @@ void FixAddForce::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index da009c55d5..e4a04c6f9f 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -35,8 +35,8 @@ enum{X,V,F,COMPUTE,FIX,VARIABLE}; FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), array(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command"); @@ -64,7 +64,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nvalues]; for (int i = 0; i < nvalues; i++) { - ids[i] = NULL; + ids[i] = nullptr; if (strcmp(arg[i],"x") == 0) { which[i] = X; @@ -376,7 +376,7 @@ void FixAveAtom::end_of_step() } else if (which[m] == VARIABLE) { if (array) input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1); - else input->variable->compute_atom(n,igroup,NULL,nvalues,1); + else input->variable->compute_atom(n,igroup,nullptr,nvalues,1); } } @@ -394,7 +394,7 @@ void FixAveAtom::end_of_step() nvalid = ntimestep+peratom_freq - (nrepeat-1)*nevery; modify->addstep_compute(nvalid); - if (array == NULL) return; + if (array == nullptr) return; // average the final result for the Nfreq timestep @@ -424,7 +424,7 @@ void FixAveAtom::grow_arrays(int nmax) memory->grow(array,nmax,nvalues,"fix_ave/atom:array"); array_atom = array; if (array) vector_atom = array[0]; - else vector_atom = NULL; + else vector_atom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 18fb335279..c178cf63c0 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -46,12 +46,12 @@ enum{ONE,RUNNING,WINDOW}; FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nvalues(0), nrepeat(0), - which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - fp(NULL), idchunk(NULL), varatom(NULL), - count_one(NULL), count_many(NULL), count_sum(NULL), - values_one(NULL), values_many(NULL), values_sum(NULL), - count_total(NULL), count_list(NULL), - values_total(NULL), values_list(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + fp(nullptr), idchunk(nullptr), varatom(nullptr), + count_one(nullptr), count_many(nullptr), count_sum(nullptr), + values_one(nullptr), values_many(nullptr), values_sum(nullptr), + count_total(nullptr), count_list(nullptr), + values_total(nullptr), values_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/chunk command"); @@ -88,7 +88,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : int iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"vx") == 0) { which[nvalues] = V; @@ -164,15 +164,15 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : ave = ONE; nwindow = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"norm") == 0) { @@ -225,7 +225,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/chunk file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -409,12 +409,12 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : normcount = 0; maxvar = 0; - varatom = NULL; + varatom = nullptr; - count_one = count_many = count_sum = count_total = NULL; - count_list = NULL; - values_one = values_many = values_sum = values_total = NULL; - values_list = NULL; + count_one = count_many = count_sum = count_total = nullptr; + count_list = nullptr; + values_one = values_many = values_sum = values_total = nullptr; + values_list = nullptr; maxchunk = 0; nchunk = 1; @@ -466,24 +466,24 @@ FixAveChunk::~FixAveChunk() } delete [] idchunk; - which = NULL; - argindex = NULL; - ids = NULL; - value2index = NULL; - fp = NULL; - varatom = NULL; - count_one = NULL; - count_many = NULL; - count_sum = NULL; - count_total = NULL; - count_list = NULL; - values_one = NULL; - values_many = NULL; - values_sum = NULL; - values_total = NULL; - values_list = NULL; - idchunk = NULL; - cchunk = NULL; + which = nullptr; + argindex = nullptr; + ids = nullptr; + value2index = nullptr; + fp = nullptr; + varatom = nullptr; + count_one = nullptr; + count_many = nullptr; + count_sum = nullptr; + count_total = nullptr; + count_list = nullptr; + values_one = nullptr; + values_many = nullptr; + values_sum = nullptr; + values_total = nullptr; + values_list = nullptr; + idchunk = nullptr; + cchunk = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1110,7 +1110,7 @@ void FixAveChunk::allocate() double FixAveChunk::compute_array(int i, int j) { - if (values_total == NULL) return 0.0; + if (values_total == nullptr) return 0.0; if (i >= nchunk) return 0.0; if (j < colextra) { if (cchunk->compress) { diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 031dfc26bf..5576c7fb66 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -45,8 +45,8 @@ enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): Fix (lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL), - count(NULL), values(NULL), corr(NULL), save_count(NULL), save_corr(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), fp(nullptr), + count(nullptr), values(nullptr), corr(nullptr), save_count(nullptr), save_corr(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/correlate command"); @@ -112,11 +112,11 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): ave = ONE; startstep = 0; prefactor = 1.0; - fp = NULL; + fp = nullptr; overwrite = 0; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"type") == 0) { @@ -147,7 +147,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/correlate file {}:"" {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 3a9346498f..4d1cd5b2dd 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -45,10 +45,10 @@ enum{IGNORE,END,EXTRA}; FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), fp(NULL), stats_list(NULL), - bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL), - coord(NULL), vector(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), fp(nullptr), stats_list(nullptr), + bin(nullptr), bin_total(nullptr), bin_all(nullptr), bin_list(nullptr), + coord(nullptr), vector(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command"); @@ -120,41 +120,41 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[i],"x") == 0) { which[i] = X; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"y") == 0) { which[i] = X; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"z") == 0) { which[i] = X; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vx") == 0) { which[i] = V; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vy") == 0) { which[i] = V; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vz") == 0) { which[i] = V; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fx") == 0) { which[i] = F; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fy") == 0) { which[i] = F; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fz") == 0) { which[i] = F; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if ((strncmp(arg[i],"c_",2) == 0) || (strncmp(arg[i],"f_",2) == 0) || @@ -467,9 +467,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : bin_all = new double[nbins]; coord = new double[nbins]; - stats_list = NULL; - bin_list = NULL; - vector = NULL; + stats_list = nullptr; + bin_list = nullptr; + vector = nullptr; maxatom = 0; if (ave == WINDOW) { @@ -944,16 +944,16 @@ void FixAveHisto::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; kind = DEFAULT; ave = ONE; startstep = 0; mode = SCALAR; beyond = IGNORE; overwrite = 0; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -962,7 +962,7 @@ void FixAveHisto::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/histo file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 5e93df0313..586c36af8a 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -126,7 +126,7 @@ void FixAveHistoWeight::end_of_step() // calculate weight factors which are 2nd value (i = 1) double weight = 0.0; - double *weights = NULL; + double *weights = nullptr; int stride = 0; i = 1; @@ -270,11 +270,11 @@ void FixAveHistoWeight::end_of_step() // atom attributes - if (which[i] == X && weights != NULL) + if (which[i] == X && weights != nullptr) bin_atoms_weights(&atom->x[0][j],3,weights,stride); - else if (which[i] == V && weights != NULL) + else if (which[i] == V && weights != nullptr) bin_atoms_weights(&atom->v[0][j],3,weights,stride); - else if (which[i] == F && weights != NULL) + else if (which[i] == F && weights != nullptr) bin_atoms_weights(&atom->f[0][j],3,weights,stride); // invoke compute if not previously invoked diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 9c493b9846..b40a7eb009 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -43,11 +43,11 @@ enum{SCALAR,VECTOR}; FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - offcol(NULL), varlen(NULL), ids(NULL), - fp(NULL), offlist(NULL), format(NULL), format_user(NULL), - vector(NULL), vector_total(NULL), vector_list(NULL), - column(NULL), array(NULL), array_total(NULL), array_list(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + offcol(nullptr), varlen(nullptr), ids(nullptr), + fp(nullptr), offlist(nullptr), format(nullptr), format_user(nullptr), + vector(nullptr), vector_total(nullptr), vector_list(nullptr), + column(nullptr), array(nullptr), array_total(nullptr), array_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/time command"); @@ -243,7 +243,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // nrows = # of rows in output array // if all columns are variable length, just set nrows = 1 for now - column = NULL; + column = nullptr; if (mode == VECTOR) { if (all_variable_length == 0) nrows = column_length(0); else nrows = 1; @@ -304,10 +304,10 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; - array = array_total = NULL; - array_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; + array = array_total = nullptr; + array_list = nullptr; if (mode == SCALAR) { vector = new double[nvalues]; @@ -321,7 +321,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // VECTOR mode produces either a vector or array // intensive/extensive flags set by compute,fix,variable that produces value - extlist = NULL; + extlist = nullptr; if (mode == SCALAR) { if (nvalues == 1) { @@ -1022,18 +1022,18 @@ void FixAveTime::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; mode = SCALAR; noff = 0; - offlist = NULL; + offlist = nullptr; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -1042,7 +1042,7 @@ void FixAveTime::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/time file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 00ec0d67ba..324f6eaa6b 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -34,7 +34,7 @@ enum{NONE,CONSTANT,EQUAL}; FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix aveforce command"); @@ -46,7 +46,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -197,7 +197,7 @@ void FixAveForce::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -265,7 +265,7 @@ void FixAveForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 7cee835375..735b6b3bd0 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -35,7 +35,7 @@ enum{SHIFT,BISECTION}; /* ---------------------------------------------------------------------- */ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), balance(NULL), irregular(NULL) + Fix(lmp, narg, arg), balance(nullptr), irregular(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix balance command"); diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 5fd9ef190e..8d8b4af107 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -43,7 +43,7 @@ enum{ISO,ANISO,TRICLINIC}; FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix box/relax command"); @@ -395,7 +395,7 @@ void FixBoxRelax::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index 92fd42f3db..edeaf60f42 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; FixController::FixController(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pvID(NULL), cvID(NULL) + pvID(nullptr), cvID(nullptr) { if (narg != 11) error->all(FLERR,"Illegal fix controller command"); diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index b4c36ca43e..4d3b1c647b 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -42,7 +42,7 @@ enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; /* ---------------------------------------------------------------------- */ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -rfix(NULL), irregular(NULL), set(NULL) +rfix(nullptr), irregular(nullptr), set(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix deform command"); @@ -353,7 +353,7 @@ rfix(NULL), irregular(NULL), set(NULL) flip = 0; if (force_reneighbor) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; TWOPI = 2.0*MY_PI; } @@ -618,7 +618,7 @@ void FixDeform::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index be2a74d81b..02d76b8c27 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -28,7 +28,7 @@ using namespace FixConst; FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - flist(NULL) + flist(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix enforce2d command"); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 1db7e15295..c44261b338 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -29,7 +29,7 @@ enum{PF_CALLBACK,PF_ARRAY}; FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fexternal(NULL), caller_vector(NULL) + fexternal(nullptr), caller_vector(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix external command"); @@ -53,7 +53,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : if (napply <= 0) error->all(FLERR,"Illegal fix external command"); } else error->all(FLERR,"Illegal fix external command"); - callback = NULL; + callback = nullptr; // perform initial allocation of atom-based array // register with Atom class @@ -66,7 +66,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : // optional vector of values provided by caller // vector_flag and size_vector are setup via set_vector_length() - caller_vector = NULL; + caller_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ int FixExternal::setmask() void FixExternal::init() { - if (mode == PF_CALLBACK && callback == NULL) + if (mode == PF_CALLBACK && callback == nullptr) error->all(FLERR,"Fix external callback function not set"); } diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 6dff937385..abef474b4c 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -37,8 +37,8 @@ enum{CONSTANT,EQUAL}; // same as FixPour FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - mstr(NULL), vstr(NULL), pstr(NULL), tstr(NULL), - xstr(NULL), ystr(NULL), zstr(NULL) + mstr(nullptr), vstr(nullptr), pstr(nullptr), tstr(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix gravity command"); @@ -49,7 +49,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - mstr = vstr = pstr = tstr = xstr = ystr = zstr = NULL; + mstr = vstr = pstr = tstr = xstr = ystr = zstr = nullptr; mstyle = vstyle = pstyle = tstyle = xstyle = ystyle = zstyle = CONSTANT; if (strstr(arg[3],"v_") == arg[3]) { @@ -394,5 +394,5 @@ void *FixGravity::extract(const char *name, int &dim) dim = 1; return (void *) gvec; } - return NULL; + return nullptr; } diff --git a/src/fix_group.cpp b/src/fix_group.cpp index bb51fafa12..108a97157e 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -34,7 +34,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), idvar(NULL), idprop(NULL) +idregion(nullptr), idvar(nullptr), idprop(nullptr) { // dgroupbit = bitmask of dynamic group // group ID is last part of fix ID @@ -210,9 +210,9 @@ void FixGroup::set_group() // operate differently due to invocation this early in timestep // e.g. perform ghost comm update due to atoms having just moved - double *var = NULL; - int *ivector = NULL; - double *dvector = NULL; + double *var = nullptr; + int *ivector = nullptr; + double *dvector = nullptr; if (varflag) { update->post_integrate = 1; @@ -265,5 +265,5 @@ void *FixGroup::extract(const char *str, int &/*unused*/) if (strcmp(str,"property") == 0 && propflag) return (void *) idprop; if (strcmp(str,"variable") == 0 && varflag) return (void *) idvar; if (strcmp(str,"region") == 0 && regionflag) return (void *) idregion; - return NULL; + return nullptr; } diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index f8222e3ece..42f5c46a85 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -37,7 +37,7 @@ enum{NOMSG,YESMSG}; /* ---------------------------------------------------------------------- */ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idvar(NULL), dlimit_path(NULL) + Fix(lmp, narg, arg), idvar(nullptr), dlimit_path(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix halt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -45,7 +45,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : // comparison args - idvar = NULL; + idvar = nullptr; int iarg = 4; if (strcmp(arg[iarg],"tlimit") == 0) { diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index e2eb399322..3c91341940 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -39,7 +39,7 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) +idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix heat command"); @@ -50,7 +50,7 @@ idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); - hstr = NULL; + hstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; @@ -192,7 +192,7 @@ void FixHeat::end_of_step() // vsub = velocity subtracted from each atom to preserve momentum // overall KE cannot go negative - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index ae58f27913..e96ad7ab8a 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -40,7 +40,7 @@ enum{INSIDE,OUTSIDE}; FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL), pstr(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix indent command"); @@ -407,7 +407,7 @@ void FixIndent::options(int narg, char **arg) if (narg < 0) error->all(FLERR,"Illegal fix indent command"); istyle = NONE; - xstr = ystr = zstr = rstr = pstr = NULL; + xstr = ystr = zstr = rstr = pstr = nullptr; xvalue = yvalue = zvalue = rvalue = pvalue = 0.0; scaleflag = 1; side = OUTSIDE; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 9d0b5f28f1..5cfb860b56 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -53,8 +53,8 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gjfflag(0), gfactor1(NULL), gfactor2(NULL), ratio(NULL), tstr(NULL), - flangevin(NULL), tforce(NULL), franprev(NULL), lv(NULL), id_temp(NULL), random(NULL) + gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), tstr(nullptr), + flangevin(nullptr), tforce(nullptr), franprev(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix langevin command"); @@ -154,10 +154,10 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix langevin command"); } - // set temperature = NULL, user can override via fix_modify if wants bias + // set temperature = nullptr, user can override via fix_modify if wants bias - id_temp = NULL; - temperature = NULL; + id_temp = nullptr; + temperature = nullptr; energy = 0.0; @@ -165,11 +165,11 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : // compute_scalar checks for this and returns 0.0 // if flangevin_allocated is not set - flangevin = NULL; + flangevin = nullptr; flangevin_allocated = 0; - franprev = NULL; - lv = NULL; - tforce = NULL; + franprev = nullptr; + lv = nullptr; + tforce = nullptr; maxatom1 = maxatom2 = 0; // setup atom-based array for franprev @@ -1104,7 +1104,7 @@ void *FixLangevin::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index 93b13fac49..a3814f185d 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixMinimize::FixMinimize(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvector(0), peratom(NULL), vectors(NULL) + nvector(0), peratom(nullptr), vectors(nullptr) { // register callback to this fix from Atom class // don't perform initial allocation here, must wait until add_vector() diff --git a/src/fix_move.cpp b/src/fix_move.cpp index d6f61af091..aaa2422fa9 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -46,10 +46,10 @@ enum{EQUAL,ATOM}; FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), vxvarstr(NULL), - vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), toriginal(NULL), qoriginal(NULL), - displace(NULL), velocity(NULL) + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), vxvarstr(nullptr), + vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), toriginal(nullptr), qoriginal(nullptr), + displace(nullptr), velocity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix move command"); @@ -127,37 +127,37 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -259,7 +259,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : atom->add_callback(0); atom->add_callback(1); - displace = velocity = NULL; + displace = velocity = nullptr; // AtomVec pointers to retrieve per-atom storage of extra quantities @@ -297,7 +297,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (quat_flag) { double *quat; for (int i = 0; i < nlocal; i++) { - quat = NULL; + quat = nullptr; if (mask[i] & groupbit) { if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; @@ -439,9 +439,9 @@ void FixMove::init() memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; if (strstr(update->integrate_style,"respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; @@ -664,7 +664,7 @@ void FixMove::initial_integrate(int /*vflag*/) // angmom for ellipsoids, tris, and bodies if (angmom_flag) { - quat = inertia = NULL; + quat = inertia = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) { quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; shape = avec_ellipsoid->bonus[ellipsoid[i]].shape; @@ -701,7 +701,7 @@ void FixMove::initial_integrate(int /*vflag*/) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -873,7 +873,7 @@ void FixMove::initial_integrate(int /*vflag*/) } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMove::final_integrate() @@ -1121,7 +1121,7 @@ void FixMove::set_arrays(int i) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 43415a6ef5..766d4de143 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -34,8 +34,8 @@ enum{DEFAULT,NPARTNER,PERPARTNER}; // also set in fix neigh/history/omp FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), npartner(NULL), partner(NULL), valuepartner(NULL), - ipage_atom(NULL), dpage_atom(NULL), ipage_neigh(NULL), dpage_neigh(NULL) + pair(nullptr), npartner(nullptr), partner(nullptr), valuepartner(nullptr), + ipage_atom(nullptr), dpage_atom(nullptr), ipage_neigh(nullptr), dpage_neigh(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix NEIGH_HISTORY command"); @@ -70,16 +70,16 @@ FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : // other per-atom vectors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; maxatom = 0; // per-atom and per-neighbor data structs - ipage_atom = NULL; - dpage_atom = NULL; - ipage_neigh = NULL; - dpage_neigh = NULL; + ipage_atom = nullptr; + dpage_atom = nullptr; + ipage_neigh = nullptr; + dpage_neigh = nullptr; // initialize npartner to 0 so neighbor list creation is OK the 1st time @@ -120,13 +120,13 @@ FixNeighHistory::~FixNeighHistory() // to better detect use-after-delete errors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; - pair = NULL; - npartner = NULL; - partner = NULL; - valuepartner = NULL; + pair = nullptr; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; } /* ---------------------------------------------------------------------- */ @@ -172,7 +172,7 @@ void FixNeighHistory::init() void FixNeighHistory::allocate_pages() { int create = 0; - if (ipage_atom == NULL) create = 1; + if (ipage_atom == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -279,7 +279,7 @@ void FixNeighHistory::pre_exchange_onesided() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -383,7 +383,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -392,7 +392,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -506,7 +506,7 @@ void FixNeighHistory::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -864,9 +864,9 @@ int FixNeighHistory::pack_restart(int i, double *buf) void FixNeighHistory::unpack_restart(int nlocal, int nth) { - // ipage_atom = NULL if being called from granular pair style init() + // ipage_atom = nullptr if being called from granular pair style init() - if (ipage_atom == NULL) allocate_pages(); + if (ipage_atom == nullptr) allocate_pages(); // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 0e3dc8931f..aa353b19a2 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -51,10 +51,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix nvt/npt/nph command"); @@ -72,7 +72,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -88,8 +88,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; // turn on tilt factor scaling, whenever applicable @@ -579,10 +579,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -740,7 +740,7 @@ void FixNH::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -767,7 +767,7 @@ void FixNH::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1768,7 +1768,7 @@ void *FixNH::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_numdiff.cpp b/src/fix_numdiff.cpp index 145d60e8df..cd186eb9a8 100644 --- a/src/fix_numdiff.cpp +++ b/src/fix_numdiff.cpp @@ -40,8 +40,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), numdiff_forces(NULL), - temp_x(NULL), temp_f(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), numdiff_forces(nullptr), + temp_x(nullptr), temp_f(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix numdiff command"); diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index a90bf86c56..a156c0d588 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -37,7 +37,7 @@ enum{ISO,ANISO}; FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix press/berendsen command"); @@ -239,7 +239,7 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : pflag = 1; nrigid = 0; - rfix = NULL; + rfix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,7 +308,7 @@ void FixPressBerendsen::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 78fceea184..c8a7c8e610 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -29,7 +29,7 @@ using namespace FixConst; FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), string(NULL), copy(NULL), work(NULL), var_print(NULL) + fp(nullptr), string(nullptr), copy(nullptr), work(nullptr), var_print(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix print command"); if (strstr(arg[3],"v_") == arg[3]) { @@ -54,9 +54,9 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : // parse optional args - fp = NULL; + fp = nullptr; screenflag = 1; - char *title = NULL; + char *title = nullptr; int iarg = 5; while (iarg < narg) { @@ -65,7 +65,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : if (me == 0) { if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix print file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 07108721c4..35ac20e370 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -30,7 +30,7 @@ enum{MOLECULE,CHARGE,RMASS,INTEGER,DOUBLE}; FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalue(0), style(NULL), index(NULL), astyle(NULL) + nvalue(0), style(nullptr), index(nullptr), astyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); @@ -152,21 +152,21 @@ FixPropertyAtom::~FixPropertyAtom() if (border) atom->delete_callback(id,2); // deallocate per-atom vectors in Atom class - // set ptrs to NULL, so they no longer exist for Atom class + // set ptrs to nullptr, so they no longer exist for Atom class for (int m = 0; m < nvalue; m++) { if (style[m] == MOLECULE) { atom->molecule_flag = 0; memory->destroy(atom->molecule); - atom->molecule = NULL; + atom->molecule = nullptr; } else if (style[m] == CHARGE) { atom->q_flag = 0; memory->destroy(atom->q); - atom->q = NULL; + atom->q = nullptr; } else if (style[m] == RMASS) { atom->rmass_flag = 0; memory->destroy(atom->rmass); - atom->rmass = NULL; + atom->rmass = nullptr; } else if (style[m] == INTEGER) { atom->remove_custom(0,index[m]); } else if (style[m] == DOUBLE) { @@ -237,13 +237,13 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,fmt::format("Too few lines in {} section of data file",keyword)); int format_ok = 1; for (j = 1; j < nwords; j++) { - values[j] = strtok(NULL," \t\n\r\f"); - if (values[j] == NULL) format_ok = 0; + values[j] = strtok(nullptr," \t\n\r\f"); + if (values[j] == nullptr) format_ok = 0; } if (!format_ok) error->all(FLERR,fmt::format("Incorrect {} format in data file",keyword)); diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index 2e10b15ffa..cee1ed4cc1 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - count(NULL), extra(NULL) + count(nullptr), extra(nullptr) { nextra = utils::inumeric(FLERR,arg[3],false,lmp); int nfix = utils::inumeric(FLERR,arg[4],false,lmp); diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index b116f8ccac..abed4b4775 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -25,7 +25,7 @@ using namespace FixConst; FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - store_torque(0), f_level(NULL), t_level(NULL) + store_torque(0), f_level(nullptr), t_level(nullptr) { // nlevels = # of rRESPA levels @@ -41,8 +41,8 @@ FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - f_level = NULL; - t_level = NULL; + f_level = nullptr; + t_level = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); } diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 4f675bf7bf..31e32a478f 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -45,9 +45,9 @@ enum{BOND,LBOUND,ANGLE,DIHEDRAL}; FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rstyle(NULL), mult(NULL), ids(NULL), kstart(NULL), kstop(NULL), - deqstart(NULL), deqstop(NULL), target(NULL), cos_target(NULL), - sin_target(NULL) + rstyle(nullptr), mult(nullptr), ids(nullptr), kstart(nullptr), kstop(nullptr), + deqstart(nullptr), deqstop(nullptr), target(nullptr), cos_target(nullptr), + sin_target(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix restrain command"); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 229890c5df..3acd449646 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -35,7 +35,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix setforce command"); @@ -46,7 +46,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : extvector = 1; respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -228,7 +228,7 @@ void FixSetForce::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -305,7 +305,7 @@ void FixSetForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) foriginal[1] += foriginal_saved[1]; foriginal[2] += foriginal_saved[2]; } else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 2d695add26..ac08cbb497 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -37,7 +37,7 @@ enum{TETHER,COUPLE}; FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 9) error->all(FLERR,"Illegal fix spring command"); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index d8de88bd63..b7ffea3d68 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idchunk(NULL), idcom(NULL), com0(NULL), fcom(NULL) + idchunk(nullptr), idcom(nullptr), com0(nullptr), fcom(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix spring/chunk command"); @@ -155,7 +155,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // will be unlocked in destructor // necessary b/c this fix stores original COM - if (com0 == NULL) cchunk->lock(this,update->ntimestep,-1); + if (com0 == nullptr) cchunk->lock(this,update->ntimestep,-1); // calculate current centers of mass for each chunk // extract pointers from idchunk and idcom @@ -170,7 +170,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // check if first time cchunk was queried via ccom // if so, allocate com0,fcom and store initial COM - if (com0 == NULL) { + if (com0 == nullptr) { memory->create(com0,nchunk,3,"spring/chunk:com0"); memory->create(fcom,nchunk,3,"spring/chunk:fcom"); diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 5715e7eb88..2805395053 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -67,7 +67,7 @@ void FixSpringRG::init() { masstotal = group->mass(igroup); - // if rg0 was specified as NULL, compute current Rg + // if rg0 was specified as nullptr, compute current Rg // only occurs on 1st run if (rg0_flag) { diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 8e7b3eb925..12e933cd0f 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -33,7 +33,7 @@ using namespace FixConst; FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xoriginal(NULL) + xoriginal(nullptr) { if ((narg < 4) || (narg > 5)) error->all(FLERR,"Illegal fix spring/self command"); @@ -70,7 +70,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); diff --git a/src/fix_store.cpp b/src/fix_store.cpp index 3eb2075250..d8d6dbf90c 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -28,7 +28,7 @@ enum{UNKNOWN,GLOBAL,PERATOM}; /* ---------------------------------------------------------------------- */ FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -vstore(NULL), astore(NULL), rbuf(NULL) +vstore(nullptr), astore(nullptr), rbuf(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix store command"); @@ -69,8 +69,8 @@ vstore(NULL), astore(NULL), rbuf(NULL) if (nvalues == 1) vecflag = 1; } - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; // allocate vector or array and restart buffer rbuf // for PERATOM, register with Atom class @@ -84,7 +84,7 @@ vstore(NULL), astore(NULL), rbuf(NULL) grow_arrays(atom->nmax); atom->add_callback(0); if (restart_peratom) atom->add_callback(1); - rbuf = NULL; + rbuf = nullptr; } // zero the storage @@ -145,8 +145,8 @@ void FixStore::reset_global(int nrow_caller, int ncol_caller) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_caller == 1) vecflag = 1; @@ -199,8 +199,8 @@ void FixStore::restart(char *buf) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_restart == 1) vecflag = 1; diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index 5c25f0e162..ae01848d7b 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -26,7 +26,7 @@ using namespace FixConst; FixStoreForce::FixStoreForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - foriginal(NULL) + foriginal(nullptr) { if (narg < 3) error->all(FLERR,"Illegal fix store/coord command"); diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index fd4563b7ad..4ce65195b6 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -38,9 +38,9 @@ enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME}; FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), values(NULL), - vbuf(NULL), pack_choice(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), values(nullptr), + vbuf(nullptr), pack_choice(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix store/state command"); @@ -64,7 +64,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : int iarg = 4; while (iarg < narg) { which[nvalues] = KEYWORD; - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"id") == 0) { pack_choice[nvalues++] = &FixStoreState::pack_id; @@ -348,7 +348,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - values = NULL; + values = nullptr; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); @@ -479,7 +479,7 @@ void FixStoreState::end_of_step() // fill vector or array with per-atom values if (values) vbuf = &values[0][0]; - else vbuf = NULL; + else vbuf = nullptr; for (int m = 0; m < nvalues; m++) { if (which[m] == KEYWORD && kflag) (this->*pack_choice[m])(m); @@ -572,7 +572,7 @@ void FixStoreState::grow_arrays(int nmax) memory->grow(values,nmax,nvalues,"store/state:values"); if (nvalues == 1) { if (nmax) vector_atom = &values[0][0]; - else vector_atom = NULL; + else vector_atom = nullptr; } else array_atom = values; } diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index ec2965d072..610cc7310a 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg != 6) error->all(FLERR,"Illegal fix temp/berendsen command"); @@ -50,7 +50,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : global_freq = nevery; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -280,5 +280,5 @@ void *FixTempBerendsen::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index cf7e9e9fe2..c8016f3200 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -43,7 +43,7 @@ enum{CONSTANT,EQUAL}; FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - vhold(NULL), tstr(NULL), id_temp(NULL), random(NULL) + vhold(nullptr), tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csld command"); @@ -56,7 +56,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -90,7 +90,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : modify->add_compute(cmd); tflag = 1; - vhold = NULL; + vhold = nullptr; nmax = -1; energy = 0.0; } @@ -108,7 +108,7 @@ FixTempCSLD::~FixTempCSLD() delete random; memory->destroy(vhold); - vhold = NULL; + vhold = nullptr; nmax = -1; } @@ -350,5 +350,5 @@ void *FixTempCSLD::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index c620905102..649f0d9870 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -120,7 +120,7 @@ double FixTempCSVR::resamplekin(double ekin_old, double ekin_new){ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), random(NULL) + tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csvr command"); @@ -133,7 +133,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -383,5 +383,5 @@ void *FixTempCSVR::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index b5cb9c9a1b..bd3ae9ecdc 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); @@ -50,7 +50,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; dynamic_group_allow = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; tstr = new char[n]; @@ -278,5 +278,5 @@ void *FixTempRescale::extract(const char *str, int &dim) dim = 0; return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 12e36d890e..17520d191a 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nfileevery(0), fp(NULL), xf(NULL), xold(NULL) +nfileevery(0), fp(nullptr), xf(nullptr), xold(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tmd command"); @@ -74,7 +74,7 @@ nfileevery(0), fp(NULL), xf(NULL), xold(NULL) if (narg != 7) error->all(FLERR,"Illegal fix tmd command"); if (me == 0) { fp = fopen(arg[6],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix tmd file {}: {}", arg[6], utils::getsyserror())); fprintf(fp,"%s %s\n","# Step rho_target rho_old gamma_back", @@ -396,7 +396,7 @@ void FixTMD::readfile(char *file) int firstline = 1; int ncount = 0; - char *eof = NULL; + char *eof = nullptr; xprd = yprd = zprd = -1.0; do { @@ -404,7 +404,7 @@ void FixTMD::readfile(char *file) m = 0; for (nlines = 0; nlines < CHUNK; nlines++) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) break; + if (eof == nullptr) break; m += strlen(&buffer[m]); } if (buffer[m-1] != '\n') strcpy(&buffer[m++],"\n"); @@ -486,7 +486,7 @@ void FixTMD::readfile(char *file) } bufptr = next + 1; } - } while (eof != NULL); + } while (eof != nullptr); // clean up @@ -540,7 +540,7 @@ void FixTMD::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 6bcdfe948e..141f00e65e 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -38,7 +38,7 @@ enum{SCALAR,VECTOR}; FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), vector(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), vector(nullptr), array(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix vector command"); @@ -154,8 +154,8 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : // ncount = current size of vector or array - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; ncount = ncountmax = 0; if (nvalues == 1) size_vector = 0; else size_array_rows = 0; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index 08649280d8..d07d547c29 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -27,7 +27,7 @@ using namespace FixConst; FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gamma(NULL) + gamma(nullptr) { dynamic_group_allow = 1; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index cb822f1090..2394922e26 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -51,7 +51,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : fldflag = 0; int pbcflag = 0; - for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = NULL; + for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = nullptr; int iarg = 3; while (iarg < narg) { diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index fc3735cfbf..6ec3a27a58 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -34,7 +34,7 @@ enum{LJ93,LJ126,LJ1043,COLLOID,HARMONIC,MORSE}; FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/region command"); diff --git a/src/force.cpp b/src/force.cpp index 701113d7ef..68cf5b247f 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -54,12 +54,12 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) qqr2e_lammps_real = 332.06371; // these constants are toggled qqr2e_charmm_real = 332.0716; // by new CHARMM pair styles - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; char *str = (char *) "none"; int n = strlen(str) + 1; @@ -76,7 +76,7 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) kspace_style = new char[n]; strcpy(kspace_style,str); - pair_restart = NULL; + pair_restart = nullptr; create_factories(); } @@ -159,12 +159,12 @@ Force::~Force() if (improper) delete improper; if (kspace) delete kspace; - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; delete pair_map; delete bond_map; @@ -233,9 +233,9 @@ void Force::create_pair(const std::string &style, int trysuffix) delete [] pair_style; if (pair) delete pair; if (pair_restart) delete [] pair_restart; - pair_style = NULL; - pair = NULL; - pair_restart = NULL; + pair_style = nullptr; + pair = nullptr; + pair_restart = nullptr; int sflag; pair = new_pair(style,trysuffix,sflag); @@ -270,7 +270,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (pair_map->find(style) != pair_map->end()) { PairCreator &pair_creator = (*pair_map)[style]; return pair_creator(lmp); @@ -278,7 +278,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("pair",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -296,7 +296,7 @@ Pair *Force::pair_creator(LAMMPS *lmp) if exact, then style name must be exact match to word if not exact, style name must contain word if nsub > 0, match Nth hybrid sub-style - return NULL if no match or if nsub=0 and multiple sub-styles match + return nullptr if no match or if nsub=0 and multiple sub-styles match ------------------------------------------------------------------------- */ Pair *Force::pair_match(const std::string &word, int exact, int nsub) @@ -318,13 +318,13 @@ Pair *Force::pair_match(const std::string &word, int exact, int nsub) if (count == 1) return hybrid->styles[iwhich]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- return style name of Pair class that matches Pair ptr called by Neighbor::print_neigh_info() - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ char *Force::pair_match_ptr(Pair *ptr) @@ -337,7 +337,7 @@ char *Force::pair_match_ptr(Pair *ptr) if (ptr == hybrid->styles[i]) return hybrid->keywords[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -381,7 +381,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (bond_map->find(style) != bond_map->end()) { BondCreator &bond_creator = (*bond_map)[style]; return bond_creator(lmp); @@ -389,7 +389,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("bond",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -414,7 +414,7 @@ Bond *Force::bond_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -458,7 +458,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (angle_map->find(style) != angle_map->end()) { AngleCreator &angle_creator = (*angle_map)[style]; return angle_creator(lmp); @@ -466,7 +466,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("angle",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -491,7 +491,7 @@ Angle *Force::angle_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -535,7 +535,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (dihedral_map->find(style) != dihedral_map->end()) { DihedralCreator &dihedral_creator = (*dihedral_map)[style]; return dihedral_creator(lmp); @@ -543,7 +543,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -568,7 +568,7 @@ Dihedral *Force::dihedral_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -612,7 +612,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (improper_map->find(style) != improper_map->end()) { ImproperCreator &improper_creator = (*improper_map)[style]; return improper_creator(lmp); @@ -620,7 +620,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("improper",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -645,7 +645,7 @@ Improper *Force::improper_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -689,7 +689,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (kspace_map->find(style) != kspace_map->end()) { KSpaceCreator &kspace_creator = (*kspace_map)[style]; return kspace_creator(lmp); @@ -697,7 +697,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -714,14 +714,14 @@ KSpace *Force::kspace_creator(LAMMPS *lmp) return ptr to Kspace class if matches word if exact, then style name must be exact match to word if not exact, style name must contain word - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ KSpace *Force::kspace_match(const std::string &word, int exact) { if (exact && (word == kspace_style)) return kspace; else if (!exact && utils::strmatch(kspace_style,word)) return kspace; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/group.cpp b/src/group.cpp index a2e20a6ab1..6b9121f506 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -58,7 +58,7 @@ Group::Group(LAMMPS *lmp) : Pointers(lmp) inversemask = new int[MAX_GROUP]; dynamic = new int[MAX_GROUP]; - for (int i = 0; i < MAX_GROUP; i++) names[i] = NULL; + for (int i = 0; i < MAX_GROUP; i++) names[i] = nullptr; for (int i = 0; i < MAX_GROUP; i++) bitmask[i] = 1 << i; for (int i = 0; i < MAX_GROUP; i++) inversemask[i] = bitmask[i] ^ ~0; for (int i = 0; i < MAX_GROUP; i++) dynamic[i] = 0; @@ -126,7 +126,7 @@ void Group::assign(int narg, char **arg) modify->delete_fix(std::string("GROUP_") + names[igroup]); delete [] names[igroup]; - names[igroup] = NULL; + names[igroup] = nullptr; dynamic[igroup] = 0; ngroup--; @@ -235,8 +235,8 @@ void Group::assign(int narg, char **arg) bound2 = utils::tnumeric(FLERR,arg[4],false,lmp); } else if (narg != 4) error->all(FLERR,"Illegal group command"); - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -296,8 +296,8 @@ void Group::assign(int narg, char **arg) // args = list of values } else { - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -310,9 +310,9 @@ void Group::assign(int narg, char **arg) if (strchr(arg[iarg],':')) { ptr = strtok(arg[iarg],":"); start = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); stop = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); if (ptr) delta = utils::tnumeric(FLERR,ptr,false,lmp); } else { start = stop = utils::tnumeric(FLERR,arg[iarg],false,lmp); @@ -617,7 +617,7 @@ int Group::find_or_create(const char *name) int Group::find_unused() { for (int igroup = 0; igroup < MAX_GROUP; igroup++) - if (names[igroup] == NULL) return igroup; + if (names[igroup] == nullptr) return igroup; return -1; } @@ -654,7 +654,7 @@ void Group::add_molecules(int /*igroup*/, int bit) for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; molbit = bit; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -724,7 +724,7 @@ void Group::read_restart(FILE *fp) for (i = 0; i < MAX_GROUP; i++) delete [] names[i]; - if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&ngroup,1,MPI_INT,0,world); // use count to not change restart format with deleted groups @@ -733,17 +733,17 @@ void Group::read_restart(FILE *fp) int count = 0; for (i = 0; i < MAX_GROUP; i++) { if (count == ngroup) { - names[i] = NULL; + names[i] = nullptr; continue; } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n) { names[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(names[i],n,MPI_CHAR,0,world); count++; - } else names[i] = NULL; + } else names[i] = nullptr; } } diff --git a/src/image.cpp b/src/image.cpp index 755be587d8..6912bdee80 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -74,8 +74,8 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) // colors ncolors = 0; - username = NULL; - userrgb = NULL; + username = nullptr; + userrgb = nullptr; boxcolor = color2rgb("yellow"); background[0] = background[1] = background[2] = 0; @@ -112,7 +112,7 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) backLightColor[1] = 0.9; backLightColor[2] = 0.9; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1029,13 +1029,13 @@ void Image::write_PNG(FILE *fp) png_structp png_ptr; png_infop info_ptr; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, NULL); + png_destroy_write_struct(&png_ptr, nullptr); return; } @@ -1166,7 +1166,7 @@ int Image::addcolor(char *name, double r, double g, double b) if index < 0, return ptr to -index-1 color from userrgb if index = 0, search the 2 lists of color names for the string color search user-defined color names first, then the list of NCOLORS names - return a pointer to the 3 floating point RGB values or NULL if didn't find + return a pointer to the 3 floating point RGB values or nullptr if didn't find ------------------------------------------------------------------------- */ double *Image::color2rgb(const char *color, int index) @@ -1458,11 +1458,11 @@ double *Image::color2rgb(const char *color, int index) }; if (index > 0) { - if (index > NCOLORS) return NULL; + if (index > NCOLORS) return nullptr; return rgb[index-1]; } if (index < 0) { - if (-index > ncolors) return NULL; + if (-index > ncolors) return nullptr; return userrgb[-index-1]; } @@ -1472,7 +1472,7 @@ double *Image::color2rgb(const char *color, int index) for (int i = 0; i < NCOLORS; i++) if (strcmp(color,name[i]) == 0) return rgb[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1620,7 +1620,7 @@ double *Image::element2color(char *element) for (int i = 0; i < NELEMENTS; i++) if (strcmp(element,name[i]) == 0) return rgb[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1791,13 +1791,13 @@ int ColorMap::reset(int narg, char **arg) if (n+1 > narg) return 1; mentry[i].color = image->color2rgb(arg[n]); } else if (expandflag == 1) { - mentry[i].color = image->color2rgb(NULL,i+1); + mentry[i].color = image->color2rgb(nullptr,i+1); } else if (expandflag == 2) { - mentry[i].color = image->color2rgb(NULL,-(i+1)); + mentry[i].color = image->color2rgb(nullptr,-(i+1)); } n += 1; } - if (mentry[i].color == NULL) return 1; + if (mentry[i].color == nullptr) return 1; } if (mstyle == CONTINUOUS) { @@ -1915,5 +1915,5 @@ double *ColorMap::value2color(double value) return mentry[ibin%nentry].color; } - return NULL; + return nullptr; } diff --git a/src/improper.cpp b/src/improper.cpp index ad79a1a972..c657530a40 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -33,10 +33,10 @@ Improper::Improper(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 096e0c3614..474d8c0c5a 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -160,7 +160,7 @@ void ImproperHybrid::allocate() maximproper = new int[nstyles]; improperlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maximproper[m] = 0; - for (int m = 0; m < nstyles; m++) improperlist[m] = NULL; + for (int m = 0; m < nstyles; m++) improperlist[m] = nullptr; } /* ---------------------------------------------------------------------- */ @@ -325,7 +325,7 @@ void ImproperHybrid::write_restart(FILE *fp) void ImproperHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Improper*[nstyles]; keywords = new char*[nstyles]; @@ -334,10 +334,10 @@ void ImproperHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_improper(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/info.cpp b/src/info.cpp index 87161e9ca5..3c0003db0a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -259,10 +259,10 @@ void Info::command(int narg, char **arg) } } - if (out == NULL) return; + if (out == nullptr) return; fputs("\nInfo-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info\n",out); - time_t now = time(NULL); + time_t now = time(nullptr); fmt::print(out,"Printed on {}\n",ctime(&now)); if (flags & CONFIG) { @@ -792,7 +792,7 @@ void Info::command_styles(FILE *out) bool Info::is_active(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; const char *style = "none"; if (strcmp(category,"package") == 0) { @@ -813,7 +813,7 @@ bool Info::is_active(const char *category, const char *name) else error->all(FLERR,"Unknown name for info newton category"); } else if (strcmp(category,"pair") == 0) { - if (force->pair == NULL) return false; + if (force->pair == nullptr) return false; if (strcmp(name,"single") == 0) return (force->pair->single_enable != 0); else if (strcmp(name,"respa") == 0) return (force->pair->respa_enable != 0); else if (strcmp(name,"manybody") == 0) return (force->pair->manybody_flag != 0); @@ -867,7 +867,7 @@ bool Info::is_active(const char *category, const char *name) bool Info::is_available(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (has_style(category, name)) { return true; @@ -897,7 +897,7 @@ bool Info::is_available(const char *category, const char *name) bool Info::is_defined(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (strcmp(category,"compute") == 0) { int ncompute = modify->ncompute; @@ -1137,7 +1137,7 @@ bool Info::has_exceptions() { } bool Info::has_package(const char * package_name) { - for(int i = 0; LAMMPS::installed_packages[i] != NULL; ++i) { + for(int i = 0; LAMMPS::installed_packages[i] != nullptr; ++i) { if(strcmp(package_name, LAMMPS::installed_packages[i]) == 0) { return true; } diff --git a/src/input.cpp b/src/input.cpp index 6456f6c229..5efbdfba3d 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -96,15 +96,15 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) MPI_Comm_rank(world,&me); maxline = maxcopy = maxwork = 0; - line = copy = work = NULL; + line = copy = work = nullptr; narg = maxarg = 0; - arg = NULL; + arg = nullptr; echo_screen = 0; echo_log = 1; label_active = 0; - labelstr = NULL; + labelstr = nullptr; jump_skip = 0; if (me == 0) { @@ -112,7 +112,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) maxfile = 16; infiles = new FILE *[maxfile]; infiles[0] = infile; - } else infiles = NULL; + } else infiles = nullptr; variable = new Variable(lmp); @@ -196,7 +196,7 @@ void Input::file() // end of file reached, so break // n == 0 if nothing read, else n = line with str terminator - if (fgets(&line[m],maxline-m,infile) == NULL) { + if (fgets(&line[m],maxline-m,infile) == nullptr) { if (m) n = strlen(line) + 1; else n = 0; break; @@ -252,7 +252,7 @@ void Input::file() // if no command, skip to next line in input script parse(); - if (command == NULL) continue; + if (command == nullptr) continue; // if scanning for label, skip command unless it's a label command @@ -292,7 +292,7 @@ void Input::file(const char *filename) error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(filename,"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", filename, utils::getsyserror())); @@ -317,7 +317,7 @@ void Input::file(const char *filename) This function takes the text in *single*, makes a copy, parses that, executes the command and returns the name of the command (without the arguments). If there was no command in *single* it will return -``NULL``. +``nullptr``. \endverbatim * @@ -338,14 +338,14 @@ char *Input::one(const std::string &single) } // parse the line - // if no command, just return NULL + // if no command, just return nullptr parse(); - if (command == NULL) return NULL; + if (command == nullptr) return nullptr; // if scanning for label, skip command unless it's a label command - if (label_active && strcmp(command,"label") != 0) return NULL; + if (label_active && strcmp(command,"label") != 0) return nullptr; // execute the command and return its name @@ -423,7 +423,7 @@ void Input::parse() char *next; command = nextword(copy,&next); - if (command == NULL) return; + if (command == nullptr) return; // point arg[] at each subsequent arg in copy string // nextword() inserts string terminators into copy string to delimit args @@ -450,7 +450,7 @@ void Input::parse() treat text between single/double/triple quotes as one arg matching quote must be followed by whitespace char if not end of string strip quotes from returned word - return ptr to start of word or NULL if no word in string + return ptr to start of word or nullptr if no word in string also return next = ptr after word ------------------------------------------------------------------------- */ @@ -461,16 +461,16 @@ char *Input::nextword(char *str, char **next) // start = first non-whitespace char start = &str[strspn(str," \t\n\v\f\r")]; - if (*start == '\0') return NULL; + if (*start == '\0') return nullptr; // if start is single/double/triple quote: // start = first char beyond quote // stop = first char of matching quote // next = first char beyond matching quote - // next must be NULL or whitespace + // next must be nullptr or whitespace // if start is not single/double/triple quote: // stop = first whitespace char after start - // next = char after stop, or stop itself if stop is NULL + // next = char after stop, or stop itself if stop is nullptr if (strstr(start,"\"\"\"") == start) { stop = strstr(&start[3],"\"\"\""); @@ -492,7 +492,7 @@ char *Input::nextword(char *str, char **next) else *next = stop+1; } - // set stop to NULL to terminate word + // set stop to nullptr to terminate word *stop = '\0'; return start; @@ -510,9 +510,9 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // use str2 as scratch space to expand str, then copy back to str // reallocate str and str2 as necessary // do not replace $ inside single/double/triple quotes - // var = pts at variable name, ended by NULL - // if $ is followed by '{', trailing '}' becomes NULL - // else $x becomes x followed by NULL + // var = pts at variable name, ended by nullptr + // if $ is followed by '{', trailing '}' becomes nullptr + // else $x becomes x followed by nullptr // beyond = points to text following variable int i,n,paren_count; @@ -593,7 +593,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) value = variable->retrieve(var); } - if (value == NULL) + if (value == nullptr) error->one(FLERR,fmt::format("Substitution for illegal " "variable {}",var)); @@ -950,7 +950,7 @@ void Input::include() error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -984,7 +984,7 @@ void Input::jump() else { if (infile && infile != stdin) fclose(infile); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -1023,12 +1023,12 @@ void Input::log() if (me == 0) { if (logfile) fclose(logfile); - if (strcmp(arg[0],"none") == 0) logfile = NULL; + if (strcmp(arg[0],"none") == 0) logfile = nullptr; else { if (appendflag) logfile = fopen(arg[0],"a"); else logfile = fopen(arg[0],"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", arg[0], utils::getsyserror())); @@ -1063,8 +1063,8 @@ void Input::partition() strcpy(copy,line); char *ptr = strtok(copy," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ptr += strlen(ptr) + 1; ptr += strspn(ptr," \t\n\r\f"); @@ -1094,7 +1094,7 @@ void Input::print() // parse optional args - FILE *fp = NULL; + FILE *fp = nullptr; int screenflag = 1; int universeflag = 0; @@ -1103,10 +1103,10 @@ void Input::print() if (strcmp(arg[iarg],"file") == 0 || strcmp(arg[iarg],"append") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); if (me == 0) { - if (fp != NULL) fclose(fp); + if (fp != nullptr) fclose(fp); if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open print file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -1237,9 +1237,9 @@ void Input::shell() char *ptr = strdup(arg[i]); rv = 0; #ifdef _WIN32 - if (ptr != NULL) rv = _putenv(ptr); + if (ptr != nullptr) rv = _putenv(ptr); #else - if (ptr != NULL) rv = putenv(ptr); + if (ptr != nullptr) rv = putenv(ptr); #endif rv = (rv < 0) ? errno : 0; MPI_Reduce(&rv,&err,1,MPI_INT,MPI_MAX,0,world); @@ -1291,7 +1291,7 @@ void Input::angle_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Angle_coeff command before simulation box is defined"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle_coeff command before angle_style is defined"); if (atom->avec->angles_allow == 0) error->all(FLERR,"Angle_coeff command when no angles allowed"); @@ -1332,7 +1332,7 @@ void Input::bond_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Bond_coeff command before simulation box is defined"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_coeff command before bond_style is defined"); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_coeff command when no bonds allowed"); @@ -1356,7 +1356,7 @@ void Input::bond_write() { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_write command when no bonds allowed"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_write command before bond_style is defined"); else force->bond->write_file(narg,arg); } @@ -1435,7 +1435,7 @@ void Input::dihedral_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Dihedral_coeff command before simulation box is defined"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Dihedral_coeff command before dihedral_style is defined"); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Dihedral_coeff command when no dihedrals allowed"); @@ -1512,7 +1512,7 @@ void Input::improper_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Improper_coeff command before simulation box is defined"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Improper_coeff command before improper_style is defined"); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Improper_coeff command when no impropers allowed"); @@ -1534,7 +1534,7 @@ void Input::improper_style() void Input::kspace_modify() { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"KSpace style has not yet been set"); force->kspace->modify_params(narg,arg); } @@ -1650,7 +1650,7 @@ void Input::package() modify->add_fix(fixcmd); } else if (strcmp(arg[0],"kokkos") == 0) { - if (lmp->kokkos == NULL || lmp->kokkos->kokkos_exists == 0) + if (lmp->kokkos == nullptr || lmp->kokkos->kokkos_exists == 0) error->all(FLERR, "Package kokkos command without KOKKOS package enabled"); lmp->kokkos->accelerator(narg-1,&arg[1]); @@ -1682,7 +1682,7 @@ void Input::pair_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Pair_coeff command before simulation box is defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command before pair_style is defined"); force->pair->coeff(narg,arg); } @@ -1691,7 +1691,7 @@ void Input::pair_coeff() void Input::pair_modify() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_modify command before pair_style is defined"); force->pair->modify_params(narg,arg); } @@ -1729,7 +1729,7 @@ void Input::pair_style() void Input::pair_write() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_write command before pair_style is defined"); force->pair->write_file(narg,arg); } diff --git a/src/integrate.cpp b/src/integrate.cpp index 1f50ff76c5..720e8ba276 100644 --- a/src/integrate.cpp +++ b/src/integrate.cpp @@ -25,8 +25,8 @@ using namespace LAMMPS_NS; Integrate::Integrate(LAMMPS *lmp, int /*narg*/, char **/*arg*/) : Pointers(lmp) { - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; external_force_clear = 0; } @@ -74,8 +74,8 @@ void Integrate::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/irregular.cpp b/src/irregular.cpp index fbb572fd88..c5ce94e40b 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -52,15 +52,15 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // migrate work vectors maxlocal = 0; - mproclist = NULL; - msizes = NULL; + mproclist = nullptr; + msizes = nullptr; // send buffers maxdbuf = 0; - dbuf = NULL; + dbuf = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; // universal work vectors @@ -70,7 +70,7 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // initialize buffers for migrate atoms, not used for datum comm // these can persist for multiple irregular operations - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; bufextra = BUFEXTRA; grow_send(maxsend,2); diff --git a/src/irregular.h b/src/irregular.h index 01fe40c46b..d601f1586f 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -30,7 +30,7 @@ class Irregular : protected Pointers { Irregular(class LAMMPS *); ~Irregular(); void migrate_atoms(int sortflag = 0, int preassign = 0, - int *procassign = NULL); + int *procassign = nullptr); int migrate_check(); int create_data(int, int *, int sortflag = 0); int create_data_grouped(int, int *, int sortflag = 0); diff --git a/src/kspace.cpp b/src/kspace.cpp index e51cc54c97..117ae5465f 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -86,8 +86,8 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp) splittol = 1.0e-6; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -188,7 +188,7 @@ void KSpace::compute_dummy(int eflag, int vflag) void KSpace::pair_check() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"KSpace solver requires a pair style"); if (ewaldflag && !force->pair->ewaldflag) @@ -610,5 +610,5 @@ void KSpace::modify_params(int narg, char **arg) void *KSpace::extract(const char *str) { if (strcmp(str,"scale") == 0) return (void *) &scale; - return NULL; + return nullptr; } diff --git a/src/lammps.cpp b/src/lammps.cpp index f6952354ba..1d655f6fc4 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -105,22 +105,22 @@ using namespace LAMMPS_NS; * \param communicator MPI communicator used by this LAMMPS instance */ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : - memory(NULL), error(NULL), universe(NULL), input(NULL), atom(NULL), - update(NULL), neighbor(NULL), comm(NULL), domain(NULL), force(NULL), - modify(NULL), group(NULL), output(NULL), timer(NULL), kokkos(NULL), - atomKK(NULL), memoryKK(NULL), python(NULL), citeme(NULL) + memory(nullptr), error(nullptr), universe(nullptr), input(nullptr), atom(nullptr), + update(nullptr), neighbor(nullptr), comm(nullptr), domain(nullptr), force(nullptr), + modify(nullptr), group(nullptr), output(nullptr), timer(nullptr), kokkos(nullptr), + atomKK(nullptr), memoryKK(nullptr), python(nullptr), citeme(nullptr) { memory = new Memory(this); error = new Error(this); universe = new Universe(this,communicator); clientserver = 0; - cslib = NULL; + cslib = nullptr; cscomm = 0; - screen = NULL; - logfile = NULL; - infile = NULL; + screen = nullptr; + logfile = nullptr; + infile = nullptr; initclock = MPI_Wtime(); @@ -170,19 +170,19 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : int citeflag = 1; int helpflag = 0; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 0; if (arg) exename = arg[0]; - else exename = NULL; - packargs = NULL; + else exename = nullptr; + packargs = nullptr; num_package = 0; - char *restartfile = NULL; + char *restartfile = nullptr; int wfirst,wlast; int kkfirst,kklast; int npack = 0; - int *pfirst = NULL; - int *plast = NULL; + int *pfirst = nullptr; + int *plast = nullptr; iarg = 1; while (iarg < narg) { @@ -348,7 +348,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : error->universe_all(FLERR,"Invalid command-line argument"); delete [] suffix; delete [] suffix2; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 1; // hybrid option to set fall-back for suffix2 if (strcmp(arg[iarg+1],"hybrid") == 0) { @@ -380,7 +380,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // if no partition command-line switch, universe is one world with all procs - if (universe->existflag == 0) universe->add_world(NULL); + if (universe->existflag == 0) universe->add_world(nullptr); // sum of procs in all worlds must equal total # of procs @@ -409,10 +409,10 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (screenflag == 0) universe->uscreen = stdout; else if (strcmp(arg[screenflag],"none") == 0) - universe->uscreen = NULL; + universe->uscreen = nullptr; else { universe->uscreen = fopen(arg[screenflag],"w"); - if (universe->uscreen == NULL) + if (universe->uscreen == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe screen " "file {}: {}",arg[screenflag], utils::getsyserror())); @@ -420,15 +420,15 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { if (helpflag == 0) { universe->ulogfile = fopen("log.lammps","w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_warn(FLERR,"Cannot open log.lammps for writing: " + utils::getsyserror()); } } else if (strcmp(arg[logflag],"none") == 0) - universe->ulogfile = NULL; + universe->ulogfile = nullptr; else { universe->ulogfile = fopen(arg[logflag],"w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe log " "file {}: {}",arg[logflag], utils::getsyserror())); @@ -437,8 +437,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me > 0) { if (screenflag == 0) universe->uscreen = stdout; - else universe->uscreen = NULL; - universe->ulogfile = NULL; + else universe->uscreen = nullptr; + universe->ulogfile = nullptr; } // make universe and single world the same, since no partition switch @@ -454,7 +454,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me == 0) { if (inflag == 0) infile = stdin; else infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -472,31 +472,31 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : MPI_Comm_split(universe->uworld,universe->iworld,0,&world); MPI_Comm_rank(world,&me); - screen = logfile = infile = NULL; + screen = logfile = infile = nullptr; if (me == 0) { std::string str; if (partscreenflag == 0) { if (screenflag == 0) { str = fmt::format("screen.{}",universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } else if (strcmp(arg[screenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[screenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", arg[screenflag],utils::getsyserror())); } } else if (strcmp(arg[partscreenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[partscreenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } @@ -505,30 +505,30 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { str = fmt::format("log.lammps.{}",universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } else if (strcmp(arg[logflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[logflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } } else if (strcmp(arg[partlogflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[partlogflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -590,7 +590,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // instantiation creates dummy Kokkos class if KOKKOS is not installed // add args between kkfirst and kklast to Kokkos instantiation - kokkos = NULL; + kokkos = nullptr; if (kokkosflag == 1) { kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]); if (!kokkos->kokkos_exists) @@ -600,7 +600,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // allocate CiteMe class if enabled if (citeflag) citeme = new CiteMe(this); - else citeme = NULL; + else citeme = nullptr; // allocate input class now that MPI is fully setup @@ -616,7 +616,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : packargs[i] = new char*[n+1]; for (int j=0; j < n; ++j) packargs[i][j] = strdup(arg[pfirst[i]+j]); - packargs[i][n] = NULL; + packargs[i][n] = nullptr; } memory->destroy(pfirst); memory->destroy(plast); @@ -668,14 +668,14 @@ LAMMPS::~LAMMPS() if (num_package) { for (int i = 0; i < num_package; i++) { - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) free(*ptr); delete[] packargs[i]; } delete[] packargs; } num_package = 0; - packargs = NULL; + packargs = nullptr; double totalclock = MPI_Wtime() - initclock; if ((me == 0) && (screen || logfile)) { @@ -690,14 +690,14 @@ LAMMPS::~LAMMPS() if (universe->nworlds == 1) { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } else { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); if (universe->ulogfile) fclose(universe->ulogfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } if (infile && infile != stdin) fclose(infile); @@ -733,7 +733,7 @@ LAMMPS::~LAMMPS() void LAMMPS::create() { - force = NULL; // Domain->Lattice checks if Force exists + force = nullptr; // Domain->Lattice checks if Force exists // Comm class must be created before Atom class // so that nthreads is defined when create_avec invokes grow() @@ -755,9 +755,9 @@ void LAMMPS::create() else atom = new Atom(this); if (kokkos) - atom->create_avec("atomic/kk",0,NULL,1); + atom->create_avec("atomic/kk",0,nullptr,1); else - atom->create_avec("atomic",0,NULL,1); + atom->create_avec("atomic",0,nullptr,1); group = new Group(this); force = new Force(this); // must be after group, to create temperature @@ -799,7 +799,7 @@ void LAMMPS::post_create() if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL")) error->all(FLERR,"Using suffix intel without USER-INTEL package installed"); if (strcmp(suffix,"kk") == 0 && - (kokkos == NULL || kokkos->kokkos_exists == 0)) + (kokkos == nullptr || kokkos->kokkos_exists == 0)) error->all(FLERR,"Using suffix kk without KOKKOS package enabled"); if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP")) error->all(FLERR,"Using suffix omp without USER-OMP package installed"); @@ -821,7 +821,7 @@ void LAMMPS::post_create() char str[256]; for (int i = 0; i < num_package; i++) { strcpy(str,"package"); - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) { + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) { if (strlen(str) + strlen(*ptr) + 2 > 256) error->all(FLERR,"Too many -pk arguments in command line"); strcat(str," "); @@ -861,41 +861,41 @@ void LAMMPS::init() void LAMMPS::destroy() { delete update; - update = NULL; + update = nullptr; delete neighbor; - neighbor = NULL; + neighbor = nullptr; delete force; - force = NULL; + force = nullptr; delete group; - group = NULL; + group = nullptr; delete output; - output = NULL; + output = nullptr; delete modify; // modify must come after output, force, update // since they delete fixes - modify = NULL; + modify = nullptr; delete comm; // comm must come after modify // since fix destructors may access comm - comm = NULL; + comm = nullptr; delete domain; // domain must come after modify // since fix destructors access domain - domain = NULL; + domain = nullptr; delete atom; // atom must come after modify, neighbor // since fixes delete callbacks in atom - atom = NULL; + atom = nullptr; delete timer; - timer = NULL; + timer = nullptr; delete python; - python = NULL; + python = nullptr; } /* ---------------------------------------------------------------------- @@ -1011,7 +1011,7 @@ void _noopt LAMMPS::init_pkg_lists() */ bool LAMMPS::is_installed_pkg(const char *pkg) { - for (int i=0; installed_packages[i] != NULL; ++i) + for (int i=0; installed_packages[i] != nullptr; ++i) if (strcmp(installed_packages[i],pkg) == 0) return true; return false; @@ -1053,7 +1053,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) check_for_match(pair,style,name); check_for_match(reader,style,name); check_for_match(region,style,name); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1063,7 +1063,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) void _noopt LAMMPS::help() { FILE *fp = screen; - const char *pager = NULL; + const char *pager = nullptr; // if output is "stdout", use a pipe to a pager for paged output. // this will avoid the most important help text to rush past the @@ -1072,7 +1072,7 @@ void _noopt LAMMPS::help() if (fp == stdout) { pager = getenv("PAGER"); - if (pager == NULL) pager = "more"; + if (pager == nullptr) pager = "more"; #if defined(_WIN32) fp = _popen(pager,"w"); #else @@ -1080,9 +1080,9 @@ void _noopt LAMMPS::help() #endif // reset to original state, if pipe command failed - if (fp == NULL) { + if (fp == nullptr) { fp = stdout; - pager = NULL; + pager = nullptr; } } @@ -1236,7 +1236,7 @@ void _noopt LAMMPS::help() // close pipe to pager, if active - if (pager != NULL) pclose(fp); + if (pager != nullptr) pclose(fp); } /* ---------------------------------------------------------------------- @@ -1309,7 +1309,7 @@ void LAMMPS::print_config(FILE *fp) sizeof(tagint)*8, sizeof(bigint)*8); fputs("\nInstalled packages:\n\n",fp); - for (int i = 0; NULL != (pkg = installed_packages[i]); ++i) { + for (int i = 0; nullptr != (pkg = installed_packages[i]); ++i) { ncword = strlen(pkg); if (ncline + ncword > 78) { ncline = 0; diff --git a/src/lattice.cpp b/src/lattice.cpp index 68f3e7abe1..625e243d64 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) { nbasis = 0; - basis = NULL; + basis = nullptr; // parse style arg @@ -164,7 +164,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) else if (strcmp(arg[iarg+1],"y") == 0) dim = 1; else if (strcmp(arg[iarg+1],"z") == 0) dim = 2; else error->all(FLERR,"Illegal lattice command"); - int *orient = NULL; + int *orient = nullptr; if (dim == 0) orient = orientx; else if (dim == 1) orient = orienty; else if (dim == 2) orient = orientz; diff --git a/src/library.cpp b/src/library.cpp index 0e0c4070ea..2e35457837 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -105,7 +105,7 @@ LAMMPS executable, and an MPI communicator for LAMMPS to run under. Since the list of arguments is **exactly** as when called from the command line, the first argument would be the name of the executable and thus is otherwise ignored. However ``argc`` may be set to 0 and then -``argv`` may be ``NULL``. If MPI is not yet initialized, ``MPI_Init()`` +``argv`` may be ``nullptr``. If MPI is not yet initialized, ``MPI_Init()`` will be called during creation of the LAMMPS class instance. If for some reason the creation or initialization of the LAMMPS instance @@ -117,7 +117,7 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. .. note:: @@ -133,12 +133,12 @@ fails a null pointer is returned. * \param argv list of command line argument strings * \param comm MPI communicator for this LAMMPS instance * \param ptr pointer to a void pointer variable which serves - * as a handle; may be ``NULL`` + * as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) { - LAMMPS *lmp = NULL; + LAMMPS *lmp = nullptr; lammps_mpi_init(); #ifdef LAMMPS_EXCEPTIONS @@ -149,7 +149,7 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) } catch(LAMMPSException & e) { fmt::print(stderr, "LAMMPS Exception: {}", e.message); - *ptr = (void *) NULL; + *ptr = nullptr; } #else lmp = new LAMMPS(argc, argv, comm); @@ -183,14 +183,14 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. \endverbatim * * \param argc number of command line arguments * \param argv list of command line argument strings * \param ptr pointer to a void pointer variable - * which serves as a handle; may be ``NULL`` + * which serves as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) @@ -275,7 +275,7 @@ void lammps_mpi_init() if (!flag) { // provide a dummy argc and argv for MPI_Init(). int argc = 1; - char *args[] = { (char *)"liblammps" , NULL }; + char *args[] = { (char *)"liblammps" , nullptr }; char **argv = args; MPI_Init(&argc,&argv); } @@ -375,19 +375,19 @@ string, however, will be treated as part of the command and will **not** start a second command. The function :cpp:func:`lammps_commands_string` processes a string with multiple command lines. -The function returns the name of the command on success or ``NULL`` when +The function returns the name of the command on success or ``nullptr`` when passing a string without a command. \endverbatim * * \param handle pointer to a previously created LAMMPS instance * \param cmd string with a single LAMMPS command - * \return string with parsed command name or ``NULL`` */ + * \return string with parsed command name or ``nullptr`` */ char *lammps_command(void *handle, const char *cmd) { LAMMPS *lmp = (LAMMPS *) handle; - char *result = NULL; + char *result = nullptr; BEGIN_CAPTURE { @@ -639,7 +639,7 @@ double lammps_get_thermo(void *handle, char *keyword) This function (re-)initializes the simulation box and boundary information and then assign the designated data to the locations in the pointers passed as arguments. Any argument (except the first) may be -a NULL pointer and then will not be assigned. +a nullptr pointer and then will not be assigned. \endverbatim * @@ -1071,7 +1071,7 @@ to be either an ``int`` or an ``int64_t``. This is selected at * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - requested property. NULL if name is not known. */ + requested property. nullptr if name is not known. */ void *lammps_extract_global(void *handle, char *name) { @@ -1134,7 +1134,7 @@ void *lammps_extract_global(void *handle, char *name) if (strcmp(name,"femtosecond") == 0) return (void *) &lmp->force->femtosecond; if (strcmp(name,"qelectron") == 0) return (void *) &lmp->force->qelectron; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1163,7 +1163,7 @@ of the :cpp:func:`Atom::extract() ` function. * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_atom(void *handle, char *name) { @@ -1213,13 +1213,13 @@ X(1),Y(1),Z(1),X(2),Y(2),Z(2),...,X(N),Y(N),Z(N). * * \param handle pointer to a previously created LAMMPS instance * \param n number of atoms, N, to be added to the system - * \param id pointer to N atom IDs; ``NULL`` will generate IDs + * \param id pointer to N atom IDs; ``nullptr`` will generate IDs * \param type pointer to N atom types (required) * \param x pointer to 3N doubles with x-,y-,z- positions of the new atoms (required) * \param v pointer to 3N doubles with x-,y-,z- velocities - of the new atoms (set to 0.0 if ``NULL``) - * \param image pointer to N imageint sets of image flags, or ``NULL`` + of the new atoms (set to 0.0 if ``nullptr``) + * \param image pointer to N imageint sets of image flags, or ``nullptr`` * \param bexpand if 1, atoms outside of shrink-wrap boundaries will still be created and not dropped and the box extended * \return number of atoms created on success; @@ -1267,7 +1267,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, xdata[0] = x[3*i]; xdata[1] = x[3*i+1]; xdata[2] = x[3*i+2]; - imageint * img = image ? image + i : NULL; + imageint * img = image ? image + i : nullptr; tagint tag = id ? id[i] : 0; // create atom only on MPI rank that would own it @@ -1288,7 +1288,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, // if no tags are given explicitly, create new and unique tags - if (id == NULL) atom->tag_extend(); + if (id == nullptr) atom->tag_extend(); // reset box info, if extended when adding atoms. @@ -1332,7 +1332,7 @@ dimensions of the respective data. Since computes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data -correctly. The function returns ``NULL`` if the compute ID is not found +correctly. The function returns ``nullptr`` if the compute ID is not found or the requested data is not available or current. The following table lists the available options. @@ -1420,7 +1420,7 @@ be used after other LAMMPS commands have been issued. * \param type constant indicating type of data (scalar, vector, or array) or size of rows or columns * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_compute(void *handle, char *id, int style, int type) { @@ -1429,18 +1429,18 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) BEGIN_CAPTURE { int icompute = lmp->modify->find_compute(id); - if (icompute < 0) return NULL; + if (icompute < 0) return nullptr; Compute *compute = lmp->modify->compute[icompute]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!compute->scalar_flag) return NULL; + if (!compute->scalar_flag) return nullptr; if (compute->invoked_scalar != lmp->update->ntimestep) compute->compute_scalar(); return (void *) &compute->scalar; } if ((type == LMP_TYPE_VECTOR) || (type == LMP_SIZE_VECTOR)) { - if (!compute->vector_flag) return NULL; + if (!compute->vector_flag) return nullptr; if (compute->invoked_vector != lmp->update->ntimestep) compute->compute_vector(); if (type == LMP_TYPE_VECTOR) @@ -1449,7 +1449,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) return (void *) &compute->size_vector; } if ((type == LMP_TYPE_ARRAY) || (type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!compute->array_flag) return NULL; + if (!compute->array_flag) return nullptr; if (compute->invoked_array != lmp->update->ntimestep) compute->compute_array(); if (type == LMP_TYPE_ARRAY) @@ -1462,7 +1462,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_ATOM) { - if (!compute->peratom_flag) return NULL; + if (!compute->peratom_flag) return nullptr; if (compute->invoked_peratom != lmp->update->ntimestep) compute->compute_peratom(); if (type == LMP_TYPE_VECTOR) return (void *) compute->vector_atom; @@ -1471,7 +1471,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_LOCAL) { - if (!compute->local_flag) return NULL; + if (!compute->local_flag) return nullptr; if (compute->invoked_local != lmp->update->ntimestep) compute->compute_local(); if (type == LMP_TYPE_SCALAR) return (void *) &compute->size_local_rows; /* for backward compatibility */ @@ -1483,7 +1483,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1500,7 +1500,7 @@ Since individual fixes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data correctly. The function -returns ``NULL`` if the fix ID is not found or the requested data is not +returns ``nullptr`` if the fix ID is not found or the requested data is not available. .. note:: @@ -1604,7 +1604,7 @@ been issued. * \param nrow row index (only used for global vectors and arrays) * \param ncol column index (only used for global arrays) * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_fix(void *handle, char *id, int style, int type, int nrow, int ncol) @@ -1614,34 +1614,34 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, BEGIN_CAPTURE { int ifix = lmp->modify->find_fix(id); - if (ifix < 0) return NULL; + if (ifix < 0) return nullptr; Fix *fix = lmp->modify->fix[ifix]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!fix->scalar_flag) return NULL; + if (!fix->scalar_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } if (type == LMP_TYPE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_vector(nrow); return (void *) dptr; } if (type == LMP_TYPE_ARRAY) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } if (type == LMP_SIZE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; return (void *) &fix->size_vector; } if ((type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; if (type == LMP_SIZE_ROWS) return (void *) &fix->size_array_rows; else @@ -1650,14 +1650,14 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } if (style == LMP_STYLE_ATOM) { - if (!fix->peratom_flag) return NULL; + if (!fix->peratom_flag) return nullptr; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_atom; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_atom; if (type == LMP_SIZE_COLS) return (void *) &fix->size_peratom_cols; } if (style == LMP_STYLE_LOCAL) { - if (!fix->local_flag) return NULL; + if (!fix->local_flag) return nullptr; if (type == LMP_TYPE_SCALAR) return (void *) &fix->size_local_rows; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_local; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_local; @@ -1667,7 +1667,7 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1681,9 +1681,9 @@ identified by its name. The variable must be either an *equal*\ -style compatible or an *atom*\ -style variable. Variables of style *internal* are compatible with *equal*\ -style variables and so are *python*\ -style variables, if they return a numeric value. The function returns -``NULL`` when a variable of the provided *name* is not found or of an +``nullptr`` when a variable of the provided *name* is not found or of an incompatible style. The *group* argument is only used for *atom*\ --style variables and ignored otherwise. If set to ``NULL`` when +-style variables and ignored otherwise. If set to ``nullptr`` when extracting data from and *atom*\ -style variable, the group is assumed to be "all". @@ -1697,7 +1697,7 @@ to be "all". .. code-block:: c - double *dptr = (double *) lammps_extract_variable(handle,name,NULL); + double *dptr = (double *) lammps_extract_variable(handle,name,nullptr); double value = *dptr; lammps_free((void *)dptr); @@ -1720,9 +1720,9 @@ values will not be updated, in case the variable is re-evaluated. * * \param handle pointer to a previously created LAMMPS instance * \param name name of the variable - * \param group group-ID for atom style variable or ``NULL`` + * \param group group-ID for atom style variable or ``nullptr`` * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_variable(void *handle, char *name, char *group) { @@ -1731,7 +1731,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) BEGIN_CAPTURE { int ivar = lmp->input->variable->find(name); - if (ivar < 0) return NULL; + if (ivar < 0) return nullptr; if (lmp->input->variable->equalstyle(ivar)) { double *dptr = (double *) malloc(sizeof(double)); @@ -1740,9 +1740,9 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } if (lmp->input->variable->atomstyle(ivar)) { - if (group == NULL) group = (char *)"all"; + if (group == nullptr) group = (char *)"all"; int igroup = lmp->group->find(group); - if (igroup < 0) return NULL; + if (igroup < 0) return nullptr; int nlocal = lmp->atom->nlocal; double *vector = (double *) malloc(nlocal*sizeof(double)); lmp->input->variable->compute_atom(ivar,igroup,vector,1,0); @@ -1751,7 +1751,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1845,7 +1845,7 @@ void lammps_gather_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -1855,8 +1855,8 @@ void lammps_gather_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -1894,8 +1894,8 @@ void lammps_gather_atoms(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -1985,7 +1985,7 @@ void lammps_gather_atoms_concat(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -1999,8 +1999,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2050,8 +2050,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2145,7 +2145,7 @@ void lammps_gather_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms_subset: " "unknown property name"); return; @@ -2156,8 +2156,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2203,8 +2203,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2296,7 +2296,7 @@ void lammps_scatter_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms: unknown property name"); return; @@ -2307,8 +2307,8 @@ void lammps_scatter_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2340,8 +2340,8 @@ void lammps_scatter_atoms(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2424,7 +2424,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms_subset: unknown property name"); return; @@ -2435,8 +2435,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2474,8 +2474,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2565,7 +2565,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2596,7 +2596,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2624,7 +2624,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2645,7 +2645,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather: unknown property name"); return; } @@ -2654,8 +2654,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) // use atom ID to insert each atom's values into copy // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type==0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); @@ -2695,8 +2695,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2786,7 +2786,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2818,7 +2818,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2846,7 +2846,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2869,7 +2869,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_concat: unknown property name"); return; } @@ -2883,8 +2883,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2934,8 +2934,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3031,7 +3031,7 @@ void lammps_gather_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3063,7 +3063,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3091,7 +3091,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3114,7 +3114,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_subset: " "unknown property name"); return; @@ -3125,8 +3125,8 @@ void lammps_gather_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -3172,8 +3172,8 @@ void lammps_gather_subset(void *ptr, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3273,7 +3273,7 @@ void lammps_scatter(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3298,7 +3298,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3326,7 +3326,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3346,7 +3346,7 @@ void lammps_scatter(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter: unknown property name"); return; } @@ -3356,8 +3356,8 @@ void lammps_scatter(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3389,8 +3389,8 @@ void lammps_scatter(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3475,7 +3475,7 @@ void lammps_scatter_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3500,7 +3500,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3528,7 +3528,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3551,7 +3551,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: " "unknown property name"); return; @@ -3562,8 +3562,8 @@ void lammps_scatter_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3601,8 +3601,8 @@ void lammps_scatter_subset(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3741,7 +3741,7 @@ included in the LAMMPS library in use. */ int lammps_config_package_count() { int i = 0; - while(LAMMPS::installed_packages[i] != NULL) { + while(LAMMPS::installed_packages[i] != nullptr) { ++i; } return i; @@ -3987,7 +3987,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, LAMMPS * lmp = (LAMMPS *) handle; Pair* pair = lmp->force->pair_match(style, exact, nsub); - if (pair != NULL) { + if (pair != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4013,7 +4013,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, */ int lammps_find_fix_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Fix* fix = NULL; + Fix* fix = nullptr; const int nfix = lmp->modify->nfix; // find fix with name @@ -4024,7 +4024,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { } } - if (fix != NULL) { + if (fix != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4050,7 +4050,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { */ int lammps_find_compute_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Compute* compute = NULL; + Compute* compute = nullptr; const int ncompute = lmp->modify->ncompute; // find compute with name @@ -4061,7 +4061,7 @@ int lammps_find_compute_neighlist(void* handle, char * id, int request) { } } - if (compute == NULL) { + if (compute == nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4108,14 +4108,14 @@ int lammps_neighlist_num_elements(void * handle, int idx) { invalid idx or element value * \param[out] numneigh number of neighbors of atom iatom or 0 * \param[out] neighbors pointer to array of neighbor atom local indices or - * NULL + * nullptr */ void lammps_neighlist_element_neighbors(void * handle, int idx, int element, int * iatom, int * numneigh, int ** neighbors) { LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; - *neighbors = NULL; + *neighbors = nullptr; if(idx < 0 || idx >= neighbor->nlist) { return; diff --git a/src/lmppython.cpp b/src/lmppython.cpp index 67bbca15b6..080a22cb60 100644 --- a/src/lmppython.cpp +++ b/src/lmppython.cpp @@ -26,7 +26,7 @@ Python::Python(LAMMPS *lmp) : Pointers(lmp) { // implementation of Python interface is only loaded on demand // and only if PYTHON package has been installed and compiled into binary - impl = NULL; + impl = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/memory.cpp b/src/memory.cpp index bbbc233bbf..f0d8976ad1 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -45,7 +45,7 @@ Memory::Memory(LAMMPS *lmp) : Pointers(lmp) {} void *Memory::smalloc(bigint nbytes, const char *name) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; #if defined(LAMMPS_MEMALIGN) void *ptr; @@ -54,13 +54,13 @@ void *Memory::smalloc(bigint nbytes, const char *name) ptr = scalable_aligned_malloc(nbytes, LAMMPS_MEMALIGN); #else int retval = posix_memalign(&ptr, LAMMPS_MEMALIGN, nbytes); - if (retval) ptr = NULL; + if (retval) ptr = nullptr; #endif #else void *ptr = malloc(nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to allocate {} bytes for array {}", nbytes,name)); return ptr; @@ -74,7 +74,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) { if (nbytes == 0) { destroy(ptr); - return NULL; + return nullptr; } #if defined(LMP_USE_TBB_ALLOCATOR) @@ -99,7 +99,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) #else ptr = realloc(ptr,nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to reallocate {} bytes for array {}", nbytes,name)); return ptr; @@ -111,7 +111,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) void Memory::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; #if defined(LMP_USE_TBB_ALLOCATOR) scalable_aligned_free(ptr); #else diff --git a/src/memory.h b/src/memory.h index 42c9bf6aba..1fc82c990a 100644 --- a/src/memory.h +++ b/src/memory.h @@ -50,7 +50,7 @@ class Memory : protected Pointers { template TYPE **create(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1d array @@ -59,7 +59,7 @@ class Memory : protected Pointers { template TYPE *grow(TYPE *&array, int n, const char *name) { - if (array == NULL) return create(array,n,name); + if (array == nullptr) return create(array,n,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n; array = (TYPE *) srealloc(array,nbytes,name); @@ -68,7 +68,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array @@ -77,7 +77,7 @@ class Memory : protected Pointers { template void destroy(TYPE *&array) { sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -96,7 +96,7 @@ class Memory : protected Pointers { template TYPE **create1d_offset(TYPE **& /*array*/, int /*nlo*/, int /*nhi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array with index offset @@ -106,7 +106,7 @@ class Memory : protected Pointers { void destroy1d_offset(TYPE *&array, int offset) { if (array) sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -131,7 +131,7 @@ class Memory : protected Pointers { template TYPE ***create(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array @@ -141,7 +141,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **&array, int n1, int n2, const char *name) { - if (array == NULL) return create(array,n1,n2,name); + if (array == nullptr) return create(array,n1,n2,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); @@ -158,7 +158,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array @@ -167,10 +167,10 @@ class Memory : protected Pointers { template void destroy(TYPE **&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ class Memory : protected Pointers { template TYPE ***create_ragged(TYPE ***& /*array*/, int /*n1*/, int * /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive @@ -217,7 +217,7 @@ class Memory : protected Pointers { template TYPE ***create2d_offset(TYPE ***& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, - const char *name) {fail(name); return NULL;} + const char *name) {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset @@ -226,10 +226,10 @@ class Memory : protected Pointers { template void destroy2d_offset(TYPE **&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ class Memory : protected Pointers { template TYPE ****create(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array @@ -272,7 +272,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) { - if (array == NULL) return create(array,n1,n2,n3,name); + if (array == nullptr) return create(array,n1,n2,n3,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); @@ -297,7 +297,7 @@ class Memory : protected Pointers { template TYPE ****grow(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 3d array @@ -306,11 +306,11 @@ class Memory : protected Pointers { template void destroy(TYPE ***&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -331,7 +331,7 @@ class Memory : protected Pointers { template TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with 1st index offset @@ -340,11 +340,11 @@ class Memory : protected Pointers { template void destroy3d_offset(TYPE ***&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[offset][0][0]); sfree(&array[offset][0]); sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -376,7 +376,7 @@ class Memory : protected Pointers { TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset @@ -386,11 +386,11 @@ class Memory : protected Pointers { void destroy3d_offset(TYPE ***&array, int n1_offset, int n2_offset, int n3_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[n1_offset][n2_offset][n3_offset]); sfree(&array[n1_offset][n2_offset]); sfree(&array[n1_offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -433,7 +433,7 @@ class Memory : protected Pointers { template TYPE *****create(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 4d array @@ -444,7 +444,7 @@ class Memory : protected Pointers { TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4, const char *name) { - if (array == NULL) return create(array, n1, n2, n3, n4, name); + if (array == nullptr) return create(array, n1, n2, n3, n4, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name); @@ -479,7 +479,7 @@ class Memory : protected Pointers { TYPE *****grow(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) { - fail(name); return NULL; + fail(name); return nullptr; } /* ---------------------------------------------------------------------- @@ -489,12 +489,12 @@ class Memory : protected Pointers { template void destroy(TYPE ****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -527,7 +527,7 @@ class Memory : protected Pointers { TYPE ****create4d_offset(TYPE *****& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4lo*/, int /*n4hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 4d array with indices 2,3, and 4 offset @@ -537,12 +537,12 @@ class Memory : protected Pointers { void destroy4d_offset(TYPE ****&array, int n2_offset, int n3_offset, int n4_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][n2_offset][n3_offset][n4_offset]); sfree(&array[0][n2_offset][n3_offset]); sfree(&array[0][n2_offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ class Memory : protected Pointers { template TYPE ******create(TYPE ******& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, int /*n5*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 5d array @@ -603,13 +603,13 @@ class Memory : protected Pointers { template void destroy(TYPE *****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0][0]); sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/min.cpp b/src/min.cpp index 6bcb4b4e2e..ea07820e53 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -71,17 +71,17 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) delaystep_start_flag = 1; max_vdotf_negatif = 2000; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nextra_global = 0; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; external_force_clear = 0; @@ -128,7 +128,7 @@ void Min::init() nextra_global = 0; delete [] fextra; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; memory->sfree(xextra_atom); @@ -137,10 +137,10 @@ void Min::init() memory->destroy(extra_nlen); memory->destroy(extra_max); memory->sfree(requestor); - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; // virial_style: // 1 if computed explicitly by pair->compute via sum over pair interactions @@ -760,8 +760,8 @@ void Min::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index 909f0b0689..54b1ee6361 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -81,11 +81,11 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) searchflag = 1; for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; - _fpPrint = NULL; + _fpPrint = nullptr; return; } @@ -97,10 +97,10 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) MinHFTN::~MinHFTN (void) { for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; return; @@ -118,14 +118,14 @@ void MinHFTN::init() error->all(FLERR,"Incorrect min_modify option"); for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; } for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; } return; @@ -1618,7 +1618,7 @@ void MinHFTN::open_hftn_print_file_(void) char szTmp[50]; sprintf (szTmp, "progress_MinHFTN_%d.txt", nMyRank); _fpPrint = fopen (szTmp, "w"); - if (_fpPrint == NULL) { + if (_fpPrint == nullptr) { printf ("*** MinHFTN cannot open file '%s'\n", szTmp); printf ("*** continuing...\n"); return; @@ -1655,7 +1655,7 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, const char sFormatR[] = "r %4d %5d %14.8f %11.5e %3s %9.3e %8.2e %10.3e %10.3e\n"; - if (_fpPrint == NULL) + if (_fpPrint == nullptr) return; char sStepType[4]; @@ -1701,6 +1701,6 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, void MinHFTN::close_hftn_print_file_(void) { - if (_fpPrint != NULL) fclose (_fpPrint); + if (_fpPrint != nullptr) fclose (_fpPrint); return; } diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 7226f61614..4ae8873129 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -54,8 +54,8 @@ using namespace LAMMPS_NS; MinLineSearch::MinLineSearch(LAMMPS *lmp) : Min(lmp) { searchflag = 1; - gextra = hextra = NULL; - x0extra_atom = gextra_atom = hextra_atom = NULL; + gextra = hextra = nullptr; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ @@ -81,12 +81,12 @@ void MinLineSearch::init() delete [] gextra; delete [] hextra; - gextra = hextra = NULL; + gextra = hextra = nullptr; delete [] x0extra_atom; delete [] gextra_atom; delete [] hextra_atom; - x0extra_atom = gextra_atom = hextra_atom = NULL; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index c88d52b623..a908cfc7af 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -54,34 +54,34 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) n_min_post_force = n_min_energy = 0; n_timeflag = -1; - fix = NULL; - fmask = NULL; - list_initial_integrate = list_post_integrate = NULL; - list_pre_exchange = list_pre_neighbor = list_post_neighbor = NULL; - list_pre_force = list_pre_reverse = list_post_force = NULL; - list_final_integrate = list_end_of_step = NULL; - list_thermo_energy = list_thermo_energy_atom = NULL; - list_initial_integrate_respa = list_post_integrate_respa = NULL; - list_pre_force_respa = list_post_force_respa = NULL; - list_final_integrate_respa = NULL; - list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = NULL; - list_min_pre_force = list_min_pre_reverse = list_min_post_force = NULL; - list_min_energy = NULL; - - end_of_step_every = NULL; - - list_timeflag = NULL; + fix = nullptr; + fmask = nullptr; + list_initial_integrate = list_post_integrate = nullptr; + list_pre_exchange = list_pre_neighbor = list_post_neighbor = nullptr; + list_pre_force = list_pre_reverse = list_post_force = nullptr; + list_final_integrate = list_end_of_step = nullptr; + list_thermo_energy = list_thermo_energy_atom = nullptr; + list_initial_integrate_respa = list_post_integrate_respa = nullptr; + list_pre_force_respa = list_post_force_respa = nullptr; + list_final_integrate_respa = nullptr; + list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = nullptr; + list_min_pre_force = list_min_pre_reverse = list_min_post_force = nullptr; + list_min_energy = nullptr; + + end_of_step_every = nullptr; + + list_timeflag = nullptr; nfix_restart_global = 0; - id_restart_global = style_restart_global = NULL; - state_restart_global = NULL; - used_restart_global = NULL; + id_restart_global = style_restart_global = nullptr; + state_restart_global = nullptr; + used_restart_global = nullptr; nfix_restart_peratom = 0; - id_restart_peratom = style_restart_peratom = NULL; - index_restart_peratom = used_restart_peratom = NULL; + id_restart_peratom = style_restart_peratom = nullptr; + index_restart_peratom = used_restart_peratom = nullptr; ncompute = maxcompute = 0; - compute = NULL; + compute = nullptr; create_factories(); } @@ -795,17 +795,17 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // but can't think of better way // too late if instantiate fix, then check flag set in fix constructor, // since some fixes access domain settings in their constructor - // NULL must be last entry in this list + // nullptr must be last entry in this list const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx", - "deprecated", "STORE/KIM", NULL}; + "deprecated", "STORE/KIM", nullptr}; if (domain->box_exist == 0) { int m; - for (m = 0; exceptions[m] != NULL; m++) + for (m = 0; exceptions[m] != nullptr; m++) if (strcmp(arg[2],exceptions[m]) == 0) break; - if (exceptions[m] == NULL) + if (exceptions[m] == nullptr) error->all(FLERR,"Fix command before simulation box is defined"); } @@ -821,7 +821,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // warn if new group != old group // delete old fix, but do not call update_callback(), // since will replace this fix and thus other fix locs will not change - // set ptr to NULL in case new fix scans list of fixes, + // set ptr to nullptr in case new fix scans list of fixes, // e.g. scan will occur in add_callback() if called by new fix // if fix ID does not exist: // set newflag = 1 so create new fix @@ -852,7 +852,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) if (fix[ifix]->igroup != igroup && comm->me == 0) error->warning(FLERR,"Replacing a fix, but new group != old group"); delete fix[ifix]; - fix[ifix] = NULL; + fix[ifix] = nullptr; } else { newflag = 1; @@ -866,7 +866,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // create the Fix // try first with suffix appended - fix[ifix] = NULL; + fix[ifix] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -879,7 +879,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) strcpy(fix[ifix]->style,estyle.c_str()); } } - if (fix[ifix] == NULL && lmp->suffix2) { + if (fix[ifix] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; @@ -891,12 +891,12 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) } } - if (fix[ifix] == NULL && fix_map->find(arg[2]) != fix_map->end()) { + if (fix[ifix] == nullptr && fix_map->find(arg[2]) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[arg[2]]; fix[ifix] = fix_creator(lmp,narg,arg); } - if (fix[ifix] == NULL) + if (fix[ifix] == nullptr) error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp)); // check if Fix is in restart_global list @@ -1105,7 +1105,7 @@ int Modify::check_rigid_group_overlap(int groupbit) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0)) ++n; @@ -1137,7 +1137,7 @@ int Modify::check_rigid_region_overlap(int groupbit, Region *reg) for (int ifix = 0; ifix < nfix; ifix++) { if (strncmp("rigid",fix[ifix]->style,5) == 0) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0) @@ -1167,7 +1167,7 @@ int Modify::check_rigid_list_overlap(int *select) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((body[i] >= 0) && select[i]) ++n; @@ -1206,7 +1206,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) // create the Compute // try first with suffix appended - compute[ncompute] = NULL; + compute[ncompute] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -1219,7 +1219,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) strcpy(compute[ncompute]->style,estyle.c_str()); } } - if (compute[ncompute] == NULL && lmp->suffix2) { + if (compute[ncompute] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (compute_map->find(estyle) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[estyle]; @@ -1231,13 +1231,13 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) } } - if (compute[ncompute] == NULL && + if (compute[ncompute] == nullptr && compute_map->find(arg[2]) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[arg[2]]; compute[ncompute] = compute_creator(lmp,narg,arg); } - if (compute[ncompute] == NULL) + if (compute[ncompute] == nullptr) error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp)); ncompute++; @@ -1428,7 +1428,7 @@ int Modify::read_restart(FILE *fp) // nfix_restart_global = # of restart entries with global state info int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_global,1,MPI_INT,0,world); // allocate space for each entry @@ -1445,22 +1445,22 @@ int Modify::read_restart(FILE *fp) int n; for (int i = 0; i < nfix_restart_global; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); state_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(state_restart_global[i],n,MPI_CHAR,0,world); used_restart_global[i] = 0; @@ -1470,7 +1470,7 @@ int Modify::read_restart(FILE *fp) int maxsize = 0; - if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_peratom,1,MPI_INT,0,world); // allocate space for each entry @@ -1487,19 +1487,19 @@ int Modify::read_restart(FILE *fp) // set index = which set of extra data this fix represents for (int i = 0; i < nfix_restart_peratom; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); maxsize += n; diff --git a/src/molecule.cpp b/src/molecule.cpp index 0d81f49a50..6957dbdc05 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -39,16 +39,16 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : - Pointers(lmp), id(NULL), x(NULL), type(NULL), molecule(NULL), q(NULL), radius(NULL), - rmass(NULL), num_bond(NULL), bond_type(NULL), bond_atom(NULL), - num_angle(NULL), angle_type(NULL), angle_atom1(NULL), angle_atom2(NULL), - angle_atom3(NULL), num_dihedral(NULL), dihedral_type(NULL), dihedral_atom1(NULL), - dihedral_atom2(NULL), dihedral_atom3(NULL), dihedral_atom4(NULL), num_improper(NULL), - improper_type(NULL), improper_atom1(NULL), improper_atom2(NULL), - improper_atom3(NULL), improper_atom4(NULL), nspecial(NULL), special(NULL), - shake_flag(NULL), shake_atom(NULL), shake_type(NULL), avec_body(NULL), ibodyparams(NULL), - dbodyparams(NULL), fragmentmask(NULL), - dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL), fp(NULL), count(NULL) + Pointers(lmp), id(nullptr), x(nullptr), type(nullptr), molecule(nullptr), q(nullptr), radius(nullptr), + rmass(nullptr), num_bond(nullptr), bond_type(nullptr), bond_atom(nullptr), + num_angle(nullptr), angle_type(nullptr), angle_atom1(nullptr), angle_atom2(nullptr), + angle_atom3(nullptr), num_dihedral(nullptr), dihedral_type(nullptr), dihedral_atom1(nullptr), + dihedral_atom2(nullptr), dihedral_atom3(nullptr), dihedral_atom4(nullptr), num_improper(nullptr), + improper_type(nullptr), improper_atom1(nullptr), improper_atom2(nullptr), + improper_atom3(nullptr), improper_atom4(nullptr), nspecial(nullptr), special(nullptr), + shake_flag(nullptr), shake_atom(nullptr), shake_type(nullptr), avec_body(nullptr), ibodyparams(nullptr), + dbodyparams(nullptr), fragmentmask(nullptr), + dx(nullptr), dxcom(nullptr), dxbody(nullptr), quat_external(nullptr), fp(nullptr), count(nullptr) { me = comm->me; @@ -406,7 +406,7 @@ void Molecule::read(int flag) if (me == 0) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of molecule file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of molecule file"); } // read header lines @@ -511,7 +511,7 @@ void Molecule::read(int flag) // count = vector for tallying bonds,angles,etc per atom if (flag == 0) memory->create(count,natoms,"molecule:count"); - else count = NULL; + else count = nullptr; // grab keyword and skip next line @@ -1703,41 +1703,41 @@ void Molecule::initialize() centerflag = massflag = comflag = inertiaflag = 0; tag_require = 0; - x = NULL; - type = NULL; - q = NULL; - radius = NULL; - rmass = NULL; + x = nullptr; + type = nullptr; + q = nullptr; + radius = nullptr; + rmass = nullptr; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; - ibodyparams = NULL; - dbodyparams = NULL; + ibodyparams = nullptr; + dbodyparams = nullptr; - dx = NULL; - dxcom = NULL; - dxbody = NULL; + dx = nullptr; + dxcom = nullptr; + dxbody = nullptr; } /* ---------------------------------------------------------------------- @@ -1901,7 +1901,7 @@ void Molecule::deallocate() void Molecule::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open molecule file {}: {}", file, utils::getsyserror())); } @@ -1914,7 +1914,7 @@ void Molecule::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1937,11 +1937,11 @@ void Molecule::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return diff --git a/src/my_page.cpp b/src/my_page.cpp index 95dd56fecd..2416c7e76b 100644 --- a/src/my_page.cpp +++ b/src/my_page.cpp @@ -113,7 +113,7 @@ template T *MyPage::get(int n) { if (n > maxchunk) { errorflag = 1; - return NULL; + return nullptr; } ndatum += n; nchunk++; @@ -129,7 +129,7 @@ T *MyPage::get(int n) { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = n; diff --git a/src/my_page.h b/src/my_page.h index 4beb397ae2..0e4375ed7f 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -53,7 +53,7 @@ class MyPage { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = 0; diff --git a/src/nbin.cpp b/src/nbin.cpp index 1092311f6a..d3211cd629 100644 --- a/src/nbin.cpp +++ b/src/nbin.cpp @@ -27,9 +27,9 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp) { last_bin = -1; mbins = maxbin = maxatom = 0; - binhead = NULL; - bins = NULL; - atom2bin = NULL; + binhead = nullptr; + bins = nullptr; + atom2bin = nullptr; neighbor->last_setup_bins = -1; diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index c01f8ca595..fae1a2941f 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -33,9 +33,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) maxatom = 0; inum = gnum = 0; - ilist = NULL; - numneigh = NULL; - firstneigh = NULL; + ilist = nullptr; + numneigh = nullptr; + firstneigh = nullptr; // defaults, but may be reset by post_constructor() @@ -51,31 +51,31 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // ptrs - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; - listcopy = NULL; - listskip = NULL; - listfull = NULL; + listcopy = nullptr; + listskip = nullptr; + listfull = nullptr; - fix_bond = NULL; + fix_bond = nullptr; - ipage = NULL; + ipage = nullptr; // extra rRESPA lists inum_inner = gnum_inner = 0; - ilist_inner = NULL; - numneigh_inner = NULL; - firstneigh_inner = NULL; + ilist_inner = nullptr; + numneigh_inner = nullptr; + firstneigh_inner = nullptr; inum_middle = gnum_middle = 0; - ilist_middle = NULL; - numneigh_middle = NULL; - firstneigh_middle = NULL; + ilist_middle = nullptr; + numneigh_middle = nullptr; + firstneigh_middle = nullptr; - ipage_inner = NULL; - ipage_middle = NULL; + ipage_inner = nullptr; + ipage_middle = nullptr; // Kokkos package @@ -85,9 +85,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // USER-DPD package - np = NULL; + np = nullptr; - requestor = NULL; + requestor = nullptr; requestor_type = NeighList::NONE; } diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 006ff5e87b..f4c7e7e0bf 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -71,12 +71,12 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) // skip info, default is no skipping skip = 0; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; // only set when command = 1; - command_style = NULL; + command_style = nullptr; // info set by Neighbor class when morphing original requests @@ -217,8 +217,8 @@ void NeighRequest::copy_request(NeighRequest *other, int skipflag) cut = other->cut; cutoff = other->cutoff; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; if (!skipflag) return; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 66ab92496a..26e7d6b74b 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -76,7 +76,7 @@ static const char cite_neigh_multi[] = /* ---------------------------------------------------------------------- */ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp), -pairclass(NULL), pairnames(NULL), pairmasks(NULL) +pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -95,62 +95,62 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) ago = -1; cutneighmax = 0.0; - cutneighsq = NULL; - cutneighghostsq = NULL; - cuttype = NULL; - cuttypesq = NULL; - fixchecklist = NULL; + cutneighsq = nullptr; + cutneighghostsq = nullptr; + cuttype = nullptr; + cuttypesq = nullptr; + fixchecklist = nullptr; // pairwise neighbor lists and associated data structs nlist = 0; - lists = NULL; + lists = nullptr; nbin = 0; - neigh_bin = NULL; + neigh_bin = nullptr; nstencil = 0; - neigh_stencil = NULL; + neigh_stencil = nullptr; - neigh_pair = NULL; + neigh_pair = nullptr; nstencil_perpetual = 0; - slist = NULL; + slist = nullptr; npair_perpetual = 0; - plist = NULL; + plist = nullptr; nrequest = maxrequest = 0; - requests = NULL; + requests = nullptr; old_nrequest = 0; - old_requests = NULL; + old_requests = nullptr; old_style = style; old_triclinic = 0; old_pgsize = pgsize; old_oneatom = oneatom; - binclass = NULL; - binnames = NULL; - binmasks = NULL; - stencilclass = NULL; - stencilnames = NULL; - stencilmasks = NULL; + binclass = nullptr; + binnames = nullptr; + binmasks = nullptr; + stencilclass = nullptr; + stencilnames = nullptr; + stencilmasks = nullptr; // topology lists bondwhich = anglewhich = dihedralwhich = improperwhich = NONE; - neigh_bond = NULL; - neigh_angle = NULL; - neigh_dihedral = NULL; - neigh_improper = NULL; + neigh_bond = nullptr; + neigh_angle = nullptr; + neigh_dihedral = nullptr; + neigh_improper = nullptr; // coords at last neighboring maxhold = 0; - xhold = NULL; + xhold = nullptr; lastcall = -1; last_setup_bins = -1; @@ -159,14 +159,14 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) includegroup = 0; nex_type = maxex_type = 0; - ex1_type = ex2_type = NULL; - ex_type = NULL; + ex1_type = ex2_type = nullptr; + ex_type = nullptr; nex_group = maxex_group = 0; - ex1_group = ex2_group = ex1_bit = ex2_bit = NULL; + ex1_group = ex2_group = ex1_bit = ex2_bit = nullptr; nex_mol = maxex_mol = 0; - ex_mol_group = ex_mol_bit = ex_mol_intra = NULL; + ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr; // Kokkos setting @@ -270,7 +270,7 @@ void Neighbor::init() // set neighbor cutoffs (force cutoff + skin) // trigger determines when atoms migrate and neighbor lists are rebuilt // needs to be non-zero for migration distance check - // even if pair = NULL and no neighbor lists are used + // even if pair = nullptr and no neighbor lists are used // cutneigh = force cutoff + skin if cutforce > 0, else cutneigh = 0 // cutneighghost = pair cutghost if it requests it, else same as cutneigh @@ -281,7 +281,7 @@ void Neighbor::init() boxcheck = 1; n = atom->ntypes; - if (cutneighsq == NULL) { + if (cutneighsq == nullptr) { if (lmp->kokkos) init_cutneighsq_kokkos(n); else memory->create(cutneighsq,n+1,n+1,"neigh:cutneighsq"); memory->create(cutneighghostsq,n+1,n+1,"neigh:cutneighghostsq"); @@ -338,7 +338,7 @@ void Neighbor::init() if (output->restart_flag) restart_check = 1; delete [] fixchecklist; - fixchecklist = NULL; + fixchecklist = nullptr; fixchecklist = new int[modify->nfix]; fix_check = 0; @@ -378,7 +378,7 @@ void Neighbor::init() // We cannot remove special neighbors with kspace or kspace-like pair styles // as the exclusion needs to remove the full coulomb and not the damped interaction. // Special treatment is required for hybrid pair styles since Force::pair_match() - // will only return a non-NULL pointer if there is only one substyle of the kind. + // will only return a non-nullptr pointer if there is only one substyle of the kind. if (force->kspace) { special_flag[1] = special_flag[2] = special_flag[3] = 2; @@ -410,7 +410,7 @@ void Neighbor::init() if (dist_check == 0) { memory->destroy(xhold); maxhold = 0; - xhold = NULL; + xhold = nullptr; } // first time allocation @@ -515,7 +515,7 @@ void Neighbor::init() for (int i = 0; i < nrequest; i++) { delete requests[i]; - requests[i] = NULL; + requests[i] = nullptr; } nrequest = 0; @@ -809,7 +809,7 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_stencil[nstencil]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_stencil[nstencil]->nb == NULL) + if (neigh_stencil[nstencil]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor stencil"); } @@ -823,7 +823,7 @@ int Neighbor::init_pair() requests[i]->index_pair = -1; flag = lists[i]->pair_method; if (flag == 0) { - neigh_pair[i] = NULL; + neigh_pair[i] = nullptr; continue; } @@ -834,12 +834,12 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_pair[i]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_pair[i]->nb == NULL) + if (neigh_pair[i]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor pair"); } if (lists[i]->stencil_method > 0) { neigh_pair[i]->ns = neigh_stencil[requests[i]->index_stencil]; - if (neigh_pair[i]->ns == NULL) + if (neigh_pair[i]->ns == nullptr) error->all(FLERR,"Could not assign stencil method to neighbor pair"); } @@ -905,11 +905,11 @@ int Neighbor::init_pair() done = 1; for (i = 0; i < npair_perpetual; i++) { for (k = 0; k < 3; k++) { - ptr = NULL; + ptr = nullptr; if (k == 0) ptr = lists[plist[i]]->listcopy; if (k == 1) ptr = lists[plist[i]]->listskip; if (k == 2) ptr = lists[plist[i]]->listfull; - if (ptr == NULL) continue; + if (ptr == nullptr) continue; for (m = 0; m < nrequest; m++) if (ptr == lists[m]) break; for (j = 0; j < npair_perpetual; j++) @@ -1575,17 +1575,17 @@ void Neighbor::requests_new2old() /* ---------------------------------------------------------------------- find and return request made by classptr - if not found or classpt = NULL, return NULL + if not found or classpt = nullptr, return nullptr ------------------------------------------------------------------------- */ NeighRequest *Neighbor::find_request(void *classptr) { - if (classptr == NULL) return NULL; + if (classptr == nullptr) return nullptr; for (int i = 0; i < nrequest; i++) if (requests[i]->requestor == classptr) return requests[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -2138,7 +2138,7 @@ void Neighbor::build_one(class NeighList *mylist, int preflag) { // check if list structure is initialized - if (mylist == NULL) + if (mylist == nullptr) error->all(FLERR,"Trying to build an occasional neighbor list " "before initialization completed"); @@ -2283,7 +2283,7 @@ void Neighbor::modify_params(int narg, char **arg) includegroup = group->find(arg[iarg+1]); if (includegroup < 0) error->all(FLERR,"Invalid group ID in neigh_modify command"); - if (includegroup && (atom->firstgroupname == NULL || + if (includegroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR, "Neigh_modify include group != atom_modify first group"); diff --git a/src/npair.cpp b/src/npair.cpp index b63135fad6..698ff28067 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -27,10 +27,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NPair::NPair(LAMMPS *lmp) - : Pointers(lmp), nb(NULL), ns(NULL), bins(NULL), stencil(NULL) + : Pointers(lmp), nb(nullptr), ns(nullptr), bins(nullptr), stencil(nullptr) { last_build = -1; - mycutneighsq = NULL; + mycutneighsq = nullptr; molecular = atom->molecular; copymode = 0; execution_space = Host; diff --git a/src/nstencil.cpp b/src/nstencil.cpp index 431906e898..aae6c9b1d2 100644 --- a/src/nstencil.cpp +++ b/src/nstencil.cpp @@ -59,11 +59,11 @@ NStencil::NStencil(LAMMPS *lmp) : Pointers(lmp) xyzflag = 0; maxstencil = maxstencil_multi = 0; - stencil = NULL; - stencilxyz = NULL; - nstencil_multi = NULL; - stencil_multi = NULL; - distsq_multi = NULL; + stencil = nullptr; + stencilxyz = nullptr; + nstencil_multi = nullptr; + stencil_multi = nullptr; + distsq_multi = nullptr; dimension = domain->dimension; } @@ -179,8 +179,8 @@ void NStencil::create_setup() distsq_multi = new double*[n+1]; for (i = 1; i <= n; i++) { nstencil_multi[i] = 0; - stencil_multi[i] = NULL; - distsq_multi[i] = NULL; + stencil_multi[i] = nullptr; + distsq_multi[i] = nullptr; } } if (smax > maxstencil_multi) { diff --git a/src/ntopo.cpp b/src/ntopo.cpp index d4ddcc7fc0..02a86e33c0 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -33,7 +33,7 @@ NTopo::NTopo(LAMMPS *lmp) : Pointers(lmp) nbondlist = nanglelist = ndihedrallist = nimproperlist = 0; maxbond = maxangle = maxdihedral = maximproper = 0; - bondlist = anglelist = dihedrallist = improperlist = NULL; + bondlist = anglelist = dihedrallist = improperlist = nullptr; cluster_check = neighbor->cluster_check; } diff --git a/src/output.cpp b/src/output.cpp index 6c90198de4..13261396db 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -56,23 +56,23 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) delete [] newarg; thermo_every = 0; - var_thermo = NULL; + var_thermo = nullptr; ndump = 0; max_dump = 0; - every_dump = NULL; - next_dump = NULL; - last_dump = NULL; - var_dump = NULL; - ivar_dump = NULL; - dump = NULL; + every_dump = nullptr; + next_dump = nullptr; + last_dump = nullptr; + var_dump = nullptr; + ivar_dump = nullptr; + dump = nullptr; restart_flag = restart_flag_single = restart_flag_double = 0; restart_every_single = restart_every_double = 0; last_restart = -1; - restart1 = restart2a = restart2b = NULL; - var_restart_single = var_restart_double = NULL; - restart = NULL; + restart1 = restart2a = restart2b = nullptr; + var_restart_single = var_restart_double = nullptr; + restart = nullptr; dump_map = new DumpCreatorMap(); @@ -560,7 +560,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = 0; last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ivar_dump[ndump] = -1; // create the Dump @@ -573,7 +573,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = utils::inumeric(FLERR,arg[3],false,lmp); if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command"); last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ndump++; } @@ -641,7 +641,7 @@ void Output::delete_dump(char *id) int Output::find_dump(const char *id) { - if (id == NULL) return -1; + if (id == nullptr) return -1; int idump; for (idump = 0; idump < ndump; idump++) if (strcmp(id,dump[idump]->id) == 0) break; @@ -661,7 +661,7 @@ void Output::set_thermo(int narg, char **arg) // variable spaced thermo outputs to constant spaced ones. delete [] var_thermo; - var_thermo = NULL; + var_thermo = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -692,10 +692,10 @@ void Output::create_thermo(int narg, char **arg) error->warning(FLERR,"New thermo_style command, " "previous thermo_modify settings will be lost"); - // set thermo = NULL in case new Thermo throws an error + // set thermo = nullptr in case new Thermo throws an error delete thermo; - thermo = NULL; + thermo = nullptr; thermo = new Thermo(lmp,narg,arg); } @@ -721,14 +721,14 @@ void Output::create_restart(int narg, char **arg) last_restart = -1; delete restart; - restart = NULL; + restart = nullptr; delete [] restart1; delete [] restart2a; delete [] restart2b; - restart1 = restart2a = restart2b = NULL; + restart1 = restart2a = restart2b = nullptr; delete [] var_restart_single; delete [] var_restart_double; - var_restart_single = var_restart_double = NULL; + var_restart_single = var_restart_double = nullptr; return; } @@ -754,7 +754,7 @@ void Output::create_restart(int narg, char **arg) delete [] restart1; restart1 = new char[n]; strcpy(restart1,arg[1]); - if (strchr(restart1,'*') == NULL) strcat(restart1,".*"); + if (strchr(restart1,'*') == nullptr) strcat(restart1,".*"); } if (nfile == 2) { diff --git a/src/output.h b/src/output.h index 06be7b244a..6a64e67c93 100644 --- a/src/output.h +++ b/src/output.h @@ -29,7 +29,7 @@ class Output : protected Pointers { bigint next_thermo; // next timestep for thermo output int thermo_every; // output freq for thermo, 0 if first/last only bigint last_thermo; // last timestep thermo was output - char *var_thermo; // variable name for thermo freq, NULL if every + char *var_thermo; // variable name for thermo freq, nullptr if every int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations diff --git a/src/pair.cpp b/src/pair.cpp index d869bbe8d8..60a5c0d8bf 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -67,12 +67,12 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) unit_convert_flag = utils::NOCONVERT; nextra = 0; - pvector = NULL; + pvector = nullptr; single_extra = 0; - svector = NULL; + svector = nullptr; - setflag = NULL; - cutsq = NULL; + setflag = nullptr; + cutsq = nullptr; ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0; reinitflag = 1; @@ -91,19 +91,19 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) ndisptablebits = 12; tabinner = sqrt(2.0); tabinner_disp = sqrt(2.0); - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; allocated = 0; suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; num_tally_compute = 0; - list_tally_compute = NULL; + list_tally_compute = nullptr; nondefault_history_transfer = 0; beyond_contact = 0; @@ -123,7 +123,7 @@ Pair::~Pair() { num_tally_compute = 0; memory->sfree((void *) list_tally_compute); - list_tally_compute = NULL; + list_tally_compute = nullptr; if (copymode) return; @@ -331,7 +331,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) double r,grij,expm2,derfc,egamma,fgamma,rsw; double qqrd2e = force->qqrd2e; - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); double g_ewald = force->kspace->g_ewald; @@ -359,8 +359,8 @@ void Pair::init_tables(double cut_coul, double *cut_respa) memory->create(dctable,ntable,"pair:dctable"); memory->create(detable,ntable,"pair:detable"); - if (cut_respa == NULL) { - vtable = ptable = dvtable = dptable = NULL; + if (cut_respa == nullptr) { + vtable = ptable = dvtable = dptable = nullptr; } else { memory->create(vtable,ntable,"pair:vtable"); memory->create(ptable,ntable,"pair:ptable"); @@ -391,7 +391,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { rtable[i] = rsq_lookup.f; ctable[i] = qqrd2e/r; if (msmflag) { @@ -488,7 +488,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { c_tmp = qqrd2e/r; if (msmflag) { f_tmp = qqrd2e/r * fgamma; @@ -1664,7 +1664,7 @@ void Pair::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -1672,7 +1672,7 @@ void Pair::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by pair_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open pair_write file {}: {}", table_file, utils::getsyserror())); fprintf(fp,"# Pair potential %s for atom types %d %d: i,r,energy,force\n", diff --git a/src/pair.h b/src/pair.h index 00f433233e..ace233539f 100644 --- a/src/pair.h +++ b/src/pair.h @@ -197,7 +197,7 @@ class Pair : protected Pointers { // specific child-class methods for certain Pair styles - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void swap_eam(double *, double **) {} virtual void reset_dt() {} virtual void min_xf_pointers(int, double **, double **) {} diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 87aa0bab5f..777c7e4c48 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -281,16 +281,16 @@ void PairBeck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&AA[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&BB[i][j],1,MPI_DOUBLE,0,world); @@ -320,8 +320,8 @@ void PairBeck::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 5b0d3a6562..fee494fd9c 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -330,16 +330,16 @@ void PairBorn::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -370,10 +370,10 @@ void PairBorn::write_restart_settings(FILE *fp) void PairBorn::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -433,5 +433,5 @@ void *PairBorn::extract(const char *str, int &dim) if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; if (strcmp(str,"d") == 0) return (void *) d; - return NULL; + return nullptr; } diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index e4617b5c4b..abe3d1e071 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -361,16 +361,16 @@ void PairBornCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -402,11 +402,11 @@ void PairBornCoulDSF::write_restart_settings(FILE *fp) void PairBornCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 30fe8fcde9..a873ec6c62 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -360,16 +360,16 @@ void PairBornCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairBornCoulWolf::write_restart_settings(FILE *fp) void PairBornCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 1abdbcc68b..6de115a0e5 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -309,14 +309,14 @@ void PairBuck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -345,10 +345,10 @@ void PairBuck::write_restart_settings(FILE *fp) void PairBuck::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -405,5 +405,5 @@ void *PairBuck::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 9fac17aede..9cc90ebc81 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -364,15 +364,15 @@ void PairBuckCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -403,11 +403,11 @@ void PairBuckCoulCut::write_restart_settings(FILE *fp) void PairBuckCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 67c471a5e3..5aa281190e 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -247,10 +247,10 @@ void PairCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -274,9 +274,9 @@ void PairCoulCut::write_restart_settings(FILE *fp) void PairCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -307,5 +307,5 @@ void *PairCoulCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"cut_coul") == 0) return (void *) &cut; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index 2093718245..31838fbee5 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -146,10 +146,10 @@ void PairCoulDebye::write_restart_settings(FILE *fp) void PairCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index ee124c7f59..94106405b0 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -254,7 +254,7 @@ void PairCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -278,10 +278,10 @@ void PairCoulDSF::write_restart_settings(FILE *fp) void PairCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -327,5 +327,5 @@ void *PairCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index e538275b3c..6ff958483b 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -51,11 +51,11 @@ PairCoulStreitz::PairCoulStreitz(LAMMPS *lmp) : Pair(lmp) nmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -143,7 +143,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if nullptr // nelements = # of unique elements // elements = list of element names @@ -152,7 +152,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -215,7 +215,7 @@ void PairCoulStreitz::init_style() // insure use of KSpace long-range solver when ewald specified, set g_ewald if (ewaldflag) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -799,5 +799,5 @@ void *PairCoulStreitz::extract(const char *str, int &dim) if (kspacetype == 1) return (void *) &g_wolf; if (kspacetype == 2) return (void *) &g_ewald; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index e3079dcaf6..994e74fc90 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -250,7 +250,7 @@ void PairCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -274,10 +274,10 @@ void PairCoulWolf::write_restart_settings(FILE *fp) void PairCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index d0d9b98fc9..d92f4b7cca 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; PairDPD::PairDPD(LAMMPS *lmp) : Pair(lmp) { writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -314,13 +314,13 @@ void PairDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairDPD::write_restart_settings(FILE *fp) void PairDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index dd0e144953..4b9c186dab 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -232,12 +232,12 @@ void PairDPDTstat::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -265,11 +265,11 @@ void PairDPDTstat::write_restart_settings(FILE *fp) void PairDPDTstat::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&t_start,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&t_start,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&t_start,1,MPI_DOUBLE,0,world); MPI_Bcast(&t_stop,1,MPI_DOUBLE,0,world); diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 6732296764..39c8caa732 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -280,13 +280,13 @@ void PairGauss::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&b[i][j],1,MPI_DOUBLE,0,world); @@ -313,9 +313,9 @@ void PairGauss::write_restart_settings(FILE *fp) void PairGauss::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairGauss::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; - return NULL; + return nullptr; } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 0b1882f12b..7f7f795b80 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), - styles(NULL), keywords(NULL), multiple(NULL), nmap(NULL), - map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL) + styles(nullptr), keywords(nullptr), multiple(nullptr), nmap(nullptr), + map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr) { nstyles = 0; @@ -116,7 +116,7 @@ void PairHybrid::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; @@ -324,7 +324,7 @@ void PairHybrid::settings(int narg, char **arg) styles[nstyles] = force->new_pair(arg[iarg],1,dummy); force->store_style(keywords[nstyles],arg[iarg],0); - special_lj[nstyles] = special_coul[nstyles] = NULL; + special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; // determine list of arguments for pair style settings @@ -706,10 +706,10 @@ void PairHybrid::write_restart(FILE *fp) fwrite(keywords[m],sizeof(char),n,fp); styles[m]->write_restart_settings(fp); // write out per style special settings, if present - n = (special_lj[m] == NULL) ? 0 : 1; + n = (special_lj[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_lj[m],sizeof(double),4,fp); - n = (special_coul[m] == NULL) ? 0 : 1; + n = (special_coul[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_coul[m],sizeof(double),4,fp); } @@ -722,7 +722,7 @@ void PairHybrid::write_restart(FILE *fp) void PairHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); // allocate list of sub-styles @@ -745,32 +745,32 @@ void PairHybrid::read_restart(FILE *fp) // each sub-style is created via new_pair() // each reads its settings, but no coeff info - if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,nullptr,error); MPI_Bcast(compute_tally,nstyles,MPI_INT,0,world); int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_pair(keywords[m],1,dummy); styles[m]->read_restart_settings(fp); // read back per style special settings, if present - special_lj[m] = special_coul[m] = NULL; - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + special_lj[m] = special_coul[m] = nullptr; + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_lj[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_lj[m],4,MPI_DOUBLE,0,world); } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_coul[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_coul[m],4,MPI_DOUBLE,0,world); } } @@ -813,8 +813,8 @@ double PairHybrid::single(int i, int j, int itype, int jtype, if (styles[map[itype][jtype][m]]->single_enable == 0) error->one(FLERR,"Pair hybrid sub-style does not support single call"); - if ((special_lj[map[itype][jtype][m]] != NULL) || - (special_coul[map[itype][jtype][m]] != NULL)) + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) error->one(FLERR,"Pair hybrid single calls do not support" " per sub-style special bond values"); @@ -1006,13 +1006,13 @@ void PairHybrid::restore_special(double *saved) /* ---------------------------------------------------------------------- extract a ptr to a particular quantity stored by pair pass request thru to sub-styles - return first non-NULL result except for cut_coul request - for cut_coul, insure all non-NULL results are equal since required by Kspace + return first non-nullptr result except for cut_coul request + for cut_coul, insure all non-nullptr results are equal since required by Kspace ------------------------------------------------------------------------- */ void *PairHybrid::extract(const char *str, int &dim) { - void *cutptr = NULL; + void *cutptr = nullptr; void *ptr; double cutvalue = 0.0; int couldim = -1; @@ -1037,7 +1037,7 @@ void *PairHybrid::extract(const char *str, int &dim) } if (strcmp(str,"cut_coul") == 0) return cutptr; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 34c4cfe418..8d352e9f2e 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -140,7 +140,7 @@ void PairHybridOverlay::copy_svector(int itype, int jtype) if (m == map[itype][jtype][k]) { this_style = styles[m]; } else { - this_style = NULL; + this_style = nullptr; } } for (int l = 0; l < styles[m]->single_extra; ++l) { diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index a4ba3b8585..444538b253 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -41,7 +41,7 @@ PairLJ96Cut::PairLJ96Cut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -508,7 +508,7 @@ void PairLJ96Cut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -607,13 +607,13 @@ void PairLJ96Cut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -642,10 +642,10 @@ void PairLJ96Cut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index b6c91cafe2..f5f8038bef 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -279,14 +279,14 @@ void PairLJCubic::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -313,7 +313,7 @@ void PairLJCubic::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index bd42801f3b..f9b5a25523 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -502,7 +502,7 @@ void PairLJCut::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -601,13 +601,13 @@ void PairLJCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -636,10 +636,10 @@ void PairLJCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -693,5 +693,5 @@ void *PairLJCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 669d48c860..38f4316d29 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -354,14 +354,14 @@ void PairLJCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -391,11 +391,11 @@ void PairLJCutCoulCut::write_restart_settings(FILE *fp) void PairLJCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -466,5 +466,5 @@ void *PairLJCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index 3ddb898c8f..ed09e98062 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -171,11 +171,11 @@ void PairLJCutCoulDebye::write_restart_settings(FILE *fp) void PairLJCutCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 952a140039..f2c48b2229 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -377,13 +377,13 @@ void PairLJCutCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJCutCoulDSF::write_restart_settings(FILE *fp) void PairLJCutCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -477,5 +477,5 @@ void *PairLJCutCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index 749cc9e6a9..e6b00b9a56 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -370,13 +370,13 @@ void PairLJCutCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -407,12 +407,12 @@ void PairLJCutCoulWolf::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 3f711e2a15..c68c2298e5 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -325,14 +325,14 @@ void PairLJExpand::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -361,10 +361,10 @@ void PairLJExpand::write_restart_settings(FILE *fp) void PairLJExpand::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -423,5 +423,5 @@ void *PairLJExpand::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 0818c60f31..05f30bcdd5 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -339,14 +339,14 @@ void PairLJGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -376,10 +376,10 @@ void PairLJGromacs::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index 005bc44061..481e657236 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -379,12 +379,12 @@ void PairLJGromacsCoulGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJGromacsCoulGromacs::write_restart_settings(FILE *fp) void PairLJGromacsCoulGromacs::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index a53d703b8b..7afc667358 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -353,14 +353,14 @@ void PairLJSmooth::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -390,10 +390,10 @@ void PairLJSmooth::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 3697208d42..78a538f131 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -286,13 +286,13 @@ void PairLJSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -319,8 +319,8 @@ void PairLJSmoothLinear::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index 7447e143f7..5030ffc2af 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -40,7 +40,7 @@ using namespace MathConst; PairMIECut::PairMIECut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -517,7 +517,7 @@ void PairMIECut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -628,15 +628,15 @@ void PairMIECut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -667,10 +667,10 @@ void PairMIECut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -706,5 +706,5 @@ void *PairMIECut::extract(const char *str, int &dim) if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamR") == 0) return (void *) gamR; if (strcmp(str,"gamA") == 0) return (void *) gamA; - return NULL; + return nullptr; } diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index efcc1aa811..b55fc7a858 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -266,14 +266,14 @@ void PairMorse::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -301,9 +301,9 @@ void PairMorse::write_restart_settings(FILE *fp) void PairMorse::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -357,5 +357,5 @@ void *PairMorse::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index f3dd139b69..b6a3151987 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -245,12 +245,12 @@ void PairSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&prefactor[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -275,8 +275,8 @@ void PairSoft::write_restart_settings(FILE *fp) void PairSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -326,5 +326,5 @@ void *PairSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) prefactor; - return NULL; + return nullptr; } diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 1711465ffa..c0fad544d7 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -43,7 +43,7 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTable::PairTable(LAMMPS *lmp) : Pair(lmp) { ntables = 0; - tables = NULL; + tables = nullptr; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); } @@ -246,7 +246,7 @@ void PairTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -821,15 +821,15 @@ void PairTable::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to nullptr, so can be freed safely ------------------------------------------------------------------------- */ void PairTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -951,13 +951,13 @@ void PairTable::write_restart_settings(FILE *fp) void PairTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -1029,7 +1029,7 @@ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, void *PairTable::extract(const char *str, int &dim) { - if (strcmp(str,"cut_coul") != 0) return NULL; + if (strcmp(str,"cut_coul") != 0) return nullptr; if (ntables == 0) error->all(FLERR,"All pair coeffs are not set"); // only check for cutoff consistency if claiming to be KSpace compatible @@ -1042,5 +1042,5 @@ void *PairTable::extract(const char *str, int &dim) "Pair table cutoffs must all be equal to use with KSpace"); dim = 0; return &tables[0].cut; - } else return NULL; + } else return nullptr; } diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index 50cc87cf96..e1e378155a 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -278,14 +278,14 @@ void PairUFM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairUFM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -365,5 +365,5 @@ void *PairUFM::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index 6429492346..6118e5f36b 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -253,12 +253,12 @@ void PairYukawa::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -285,10 +285,10 @@ void PairYukawa::write_restart_settings(FILE *fp) void PairYukawa::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 68c63c9806..7b028de65a 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -285,10 +285,10 @@ void PairZBL::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][i],1,MPI_INT,0,world); if (setflag[i][i]) { - if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&z[i],1,MPI_DOUBLE,0,world); } } @@ -319,11 +319,11 @@ void PairZBL::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 976bb1ba33..a45fef67a5 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -178,11 +178,11 @@ void PairZero::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -207,8 +207,8 @@ void PairZero::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&coeffflag,1,MPI_INT,0,world); diff --git a/src/procmap.cpp b/src/procmap.cpp index f80af9330e..b85b0abd01 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -49,7 +49,7 @@ void ProcMap::onelevel_grid(int nprocs, int *user_procgrid, int *procgrid, // factors = list of all possible 3 factors of processor count - int npossible = factor(nprocs,NULL); + int npossible = factor(nprocs,nullptr); memory->create(factors,npossible,3,"procmap:factors"); npossible = factor(nprocs,factors); @@ -93,7 +93,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // nfactors = list of all possible 3 factors of node count // constrain by 2d - int nnpossible = factor(nprocs/ncores,NULL); + int nnpossible = factor(nprocs/ncores,nullptr); memory->create(nfactors,nnpossible,3,"procmap:nfactors"); nnpossible = factor(nprocs/ncores,nfactors); @@ -102,7 +102,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // cfactors = list of all possible 3 factors of core count // constrain by 2d - int ncpossible = factor(ncores,NULL); + int ncpossible = factor(ncores,nullptr); memory->create(cfactors,ncpossible,3,"procmap:cfactors"); ncpossible = factor(ncores,cfactors); @@ -205,7 +205,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, // initial factorization within NUMA node int **numafactors; - int numapossible = factor(procs_per_numa,NULL); + int numapossible = factor(procs_per_numa,nullptr); memory->create(numafactors,numapossible,3,"procmap:numafactors"); numapossible = factor(procs_per_numa,numafactors); @@ -230,7 +230,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, int node_count = nprocs / procs_per_numa; int **nodefactors; - int nodepossible = factor(node_count,NULL); + int nodepossible = factor(node_count,nullptr); memory->create(nodefactors,nodepossible,3,"procmap:nodefactors"); nodepossible = factor(node_count,nodefactors); @@ -281,11 +281,11 @@ void ProcMap::custom_grid(char *cfile, int nprocs, MPI_Comm_rank(world,&me); char line[MAXLINE]; - FILE *fp = NULL; + FILE *fp = nullptr; if (me == 0) { fp = fopen(cfile,"r"); - if (fp == NULL) error->one(FLERR,"Cannot open custom file"); + if (fp == nullptr) error->one(FLERR,"Cannot open custom file"); // skip header = blank and comment lines @@ -662,7 +662,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) FILE *fp; if (me == 0) { fp = fopen(file,"w"); - if (fp == NULL) error->one(FLERR,"Cannot open processors output file"); + if (fp == nullptr) error->one(FLERR,"Cannot open processors output file"); fprintf(fp,"LAMMPS mapping of processors to 3d grid\n"); fprintf(fp,"partition = %d\n",universe->iworld+1); fprintf(fp,"Px Py Pz = %d %d %d\n",procgrid[0],procgrid[1],procgrid[2]); @@ -722,7 +722,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) /* ---------------------------------------------------------------------- generate all possible 3-integer factorizations of N - store them in factors if non-NULL + store them in factors if non-nullptr return # of factorizations ------------------------------------------------------------------------- */ diff --git a/src/random_mars.cpp b/src/random_mars.cpp index 29314525a5..3f5bd7a62f 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -27,7 +27,7 @@ enum{ADD,SUBTRACT}; /* ---------------------------------------------------------------------- */ RanMars::RanMars(LAMMPS *lmp, int seed) : Pointers(lmp), - u(NULL) + u(nullptr) { int ij,kl,i,j,k,l,ii,jj,m; double s,t; diff --git a/src/rcb.cpp b/src/rcb.cpp index 03c99560b3..36e1a5474e 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -39,19 +39,19 @@ RCB::RCB(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); ndot = maxdot = 0; - dots = NULL; + dots = nullptr; nlist = maxlist = 0; - dotlist = dotmark = dotmark_select = NULL; + dotlist = dotmark = dotmark_select = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; maxrecv = maxsend = 0; - recvproc = recvindex = sendproc = sendindex = NULL; + recvproc = recvindex = sendproc = sendindex = nullptr; - tree = NULL; - irregular = NULL; + tree = nullptr; + irregular = nullptr; // create MPI data and function types for box and median AllReduce ops @@ -95,7 +95,7 @@ RCB::~RCB() NEW version: each RCB cut is tested in all dimensions dimeension that produces 2 boxes with largest min size is selected this is to prevent very narrow boxes from being produced - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -573,10 +573,10 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner @@ -632,7 +632,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, /* ---------------------------------------------------------------------- perform RCB balancing of N particles at coords X in bounding box LO/HI OLD version: each RCB cut is made in longest dimension of sub-box - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -1065,10 +1065,10 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner diff --git a/src/read_data.cpp b/src/read_data.cpp index 2a6801b3a5..231871c47a 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -62,7 +62,7 @@ enum{NONE,APPEND,VALUE,MERGE}; const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/kk", "/coul/cut","/coul/long","/coul/msm", "/coul/dsf","/coul/debye","/coul/charmm", - NULL}; + nullptr}; /* ---------------------------------------------------------------------- */ @@ -74,8 +74,8 @@ ReadData::ReadData(LAMMPS *lmp) : Pointers(lmp) style = new char[MAXLINE]; buffer = new char[CHUNK*MAXLINE]; narg = maxarg = 0; - arg = NULL; - fp = NULL; + arg = nullptr; + fp = nullptr; // customize for new sections // pointers to atom styles that store bonus info @@ -132,9 +132,9 @@ void ReadData::command(int narg, char **arg) groupbit = 0; nfix = 0; - fix_index = NULL; - fix_header = NULL; - fix_section = NULL; + fix_index = nullptr; + fix_header = nullptr; + fix_section = nullptr; int iarg = 1; while (iarg < narg) { @@ -277,7 +277,7 @@ void ReadData::command(int narg, char **arg) fix_index[nfix] = modify->find_fix(arg[iarg+1]); if (fix_index[nfix] < 0) error->all(FLERR,"Fix ID for read_data does not exist"); - if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = NULL; + if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = nullptr; else { int n = strlen(arg[iarg+2]) + 1; fix_header[nfix] = new char[n]; @@ -334,12 +334,12 @@ void ReadData::command(int narg, char **arg) // set up pointer to hold original styles while we replace them with "zero" - Pair *saved_pair = NULL; - Bond *saved_bond = NULL; - Angle *saved_angle = NULL; - Dihedral *saved_dihedral = NULL; - Improper *saved_improper = NULL; - KSpace *saved_kspace = NULL; + Pair *saved_pair = nullptr; + Bond *saved_bond = nullptr; + Angle *saved_angle = nullptr; + Dihedral *saved_dihedral = nullptr; + Improper *saved_improper = nullptr; + KSpace *saved_kspace = nullptr; if (coeffflag == 0) { char *coeffs[2]; @@ -347,33 +347,33 @@ void ReadData::command(int narg, char **arg) coeffs[1] = (char *) "nocoeff"; saved_pair = force->pair; - force->pair = NULL; + force->pair = nullptr; force->create_pair("zero",0); if (force->pair) force->pair->settings(2,coeffs); coeffs[0] = coeffs[1]; saved_bond = force->bond; - force->bond = NULL; + force->bond = nullptr; force->create_bond("zero",0); if (force->bond) force->bond->settings(1,coeffs); saved_angle = force->angle; - force->angle = NULL; + force->angle = nullptr; force->create_angle("zero",0); if (force->angle) force->angle->settings(1,coeffs); saved_dihedral = force->dihedral; - force->dihedral = NULL; + force->dihedral = nullptr; force->create_dihedral("zero",0); if (force->dihedral) force->dihedral->settings(1,coeffs); saved_improper = force->improper; - force->improper = NULL; + force->improper = nullptr; force->create_improper("zero",0); if (force->improper) force->improper->settings(1,coeffs); saved_kspace = force->kspace; - force->kspace = NULL; + force->kspace = nullptr; } // ----------------------------------------------------------------- @@ -414,7 +414,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (firstpass) utils::logmesg(lmp,"Reading data file ...\n"); open(arg[0]); - } else fp = NULL; + } else fp = nullptr; // read header info @@ -578,7 +578,7 @@ void ReadData::command(int narg, char **arg) if (firstpass) mass(); else skip_lines(ntypes); } else if (strcmp(keyword,"Pair Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before Pair Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -587,7 +587,7 @@ void ReadData::command(int narg, char **arg) paircoeffs(); } else skip_lines(ntypes); } else if (strcmp(keyword,"PairIJ Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before PairIJ Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -598,7 +598,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Bond Coeffs") == 0) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Invalid data file section: Bond Coeffs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must define bond_style before Bond Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->bond_style)) @@ -609,7 +609,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Angle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: Angle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before Angle Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->angle_style)) @@ -620,7 +620,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Dihedral Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: Dihedral Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Must define dihedral_style before Dihedral Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->dihedral_style)) @@ -631,7 +631,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Improper Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: Improper Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Must define improper_style before Improper Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->improper_style)) @@ -643,14 +643,14 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondBond Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondBond Coeffs"); if (firstpass) anglecoeffs(1); else skip_lines(nangletypes); } else if (strcmp(keyword,"BondAngle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondAngle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondAngle Coeffs"); if (firstpass) anglecoeffs(2); else skip_lines(nangletypes); @@ -659,7 +659,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: MiddleBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "MiddleBondTorsion Coeffs"); @@ -668,7 +668,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"EndBondTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: EndBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before EndBondTorsion Coeffs"); if (firstpass) dihedralcoeffs(2); @@ -676,7 +676,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: AngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before AngleTorsion Coeffs"); if (firstpass) dihedralcoeffs(3); @@ -685,7 +685,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: AngleAngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "AngleAngleTorsion Coeffs"); @@ -694,7 +694,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond13 Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: BondBond13 Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before BondBond13 Coeffs"); if (firstpass) dihedralcoeffs(5); @@ -703,7 +703,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleAngle Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: AngleAngle Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR, "Must define improper_style before AngleAngle Coeffs"); if (firstpass) impropercoeffs(1); @@ -725,7 +725,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } // done if this was 2nd pass @@ -929,7 +929,7 @@ void ReadData::header(int firstpass) if (me == 0) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } while (1) { @@ -937,7 +937,7 @@ void ReadData::header(int firstpass) // read a line and bcast length if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1289,7 +1289,7 @@ void ReadData::bonds(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1363,7 +1363,7 @@ void ReadData::angles(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1437,7 +1437,7 @@ void ReadData::dihedrals(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1511,7 +1511,7 @@ void ReadData::impropers(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1641,7 +1641,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) while (nchunk < nmax && nline <= CHUNK-MAXBODY) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); rv = sscanf(&buffer[m],"%d %d %d",&tmp,&ninteger,&ndouble); if (rv != 3) error->one(FLERR,"Incorrect format in Bodies section of data file"); @@ -1655,7 +1655,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ninteger) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1669,7 +1669,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ndouble) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1743,7 +1743,7 @@ void ReadData::paircoeffs() for (int i = 0; i < ntypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,1,2,toffset); + parse_coeffs(buf,nullptr,1,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1770,7 +1770,7 @@ void ReadData::pairIJcoeffs() for (j = i; j < ntypes; j++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,2,toffset); + parse_coeffs(buf,nullptr,0,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1795,7 +1795,7 @@ void ReadData::bondcoeffs() for (int i = 0; i < nbondtypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,1,boffset); + parse_coeffs(buf,nullptr,0,1,boffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in BondCoeffs section"); force->bond->coeff(narg,arg); @@ -1820,7 +1820,7 @@ void ReadData::anglecoeffs(int which) for (int i = 0; i < nangletypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,aoffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,aoffset); else if (which == 1) parse_coeffs(buf,"bb",0,1,aoffset); else if (which == 2) parse_coeffs(buf,"ba",0,1,aoffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in AngleCoeffs section"); @@ -1846,7 +1846,7 @@ void ReadData::dihedralcoeffs(int which) for (int i = 0; i < ndihedraltypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,doffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,doffset); else if (which == 1) parse_coeffs(buf,"mbt",0,1,doffset); else if (which == 2) parse_coeffs(buf,"ebt",0,1,doffset); else if (which == 3) parse_coeffs(buf,"at",0,1,doffset); @@ -1876,7 +1876,7 @@ void ReadData::impropercoeffs(int which) for (int i = 0; i < nimpropertypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,ioffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,ioffset); else if (which == 1) parse_coeffs(buf,"aa",0,1,ioffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in ImproperCoeffs section"); force->improper->coeff(narg,arg); @@ -1945,7 +1945,7 @@ void ReadData::open(char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -1970,15 +1970,15 @@ void ReadData::parse_keyword(int first) if (me == 0) { if (!first) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } while (eof == 0 && done == 0) { int blank = strspn(line," \t\n\r"); if ((blank == (int)strlen(line)) || (line[blank] == '#')) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } else done = 1; } - if (fgets(buffer,MAXLINE,fp) == NULL) { + if (fgets(buffer,MAXLINE,fp) == nullptr) { eof = 1; buffer[0] = '\0'; } @@ -2031,16 +2031,16 @@ void ReadData::skip_lines(bigint n) { if (me) return; if (n <= 0) return; - char *eof = NULL; + char *eof = nullptr; for (bigint i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } /* ---------------------------------------------------------------------- parse a line of coeffs into words, storing them in narg,arg trim anything from '#' onward word strings remain in line, are not copied - if addstr != NULL, add addstr as extra arg for class2 angle/dihedral/improper + if addstr != nullptr, add addstr as extra arg for class2 angle/dihedral/improper if 2nd word starts with letter, then is hybrid style, add addstr after it else add addstr before 2nd word if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2" @@ -2065,7 +2065,7 @@ void ReadData::parse_coeffs(char *line, const char *addstr, arg[narg++] = word; if (addstr && narg == 2 && islower(word[0])) arg[narg++] = (char *) addstr; if (dupflag && narg == 1) arg[narg++] = word; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } // to avoid segfaults on empty lines @@ -2094,12 +2094,12 @@ int ReadData::style_match(const char *one, const char *two) { int i,delta,len,len1,len2; - if ((one == NULL) || (two == NULL)) return 1; + if ((one == nullptr) || (two == nullptr)) return 1; len1 = strlen(one); len2 = strlen(two); - for (i = 0; suffixes[i] != NULL; i++) { + for (i = 0; suffixes[i] != nullptr; i++) { len = strlen(suffixes[i]); if ((delta = len1 - len) > 0) if (strcmp(one+delta,suffixes[i]) == 0) len1 = delta; diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 10218fe617..2fd14b547a 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -55,22 +55,22 @@ ReadDump::ReadDump(LAMMPS *lmp) : Pointers(lmp) triclinic = domain->triclinic; nfile = 0; - files = NULL; + files = nullptr; nnew = maxnew = 0; nfield = 0; - fieldtype = NULL; - fieldlabel = NULL; - fields = NULL; - buf = NULL; + fieldtype = nullptr; + fieldlabel = nullptr; + fields = nullptr; + buf = nullptr; int n = strlen("native") + 1; readerstyle = new char[n]; strcpy(readerstyle,"native"); nreader = 0; - readers = NULL; - nsnapatoms = NULL; + readers = nullptr; + nsnapatoms = nullptr; clustercomm = MPI_COMM_NULL; filereader = 0; parallel = 0; @@ -111,9 +111,9 @@ void ReadDump::command(int narg, char **arg) int nremain = narg - 2; if (nremain) nremain = fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = fields_and_keywords(0,NULL); + else nremain = fields_and_keywords(0,nullptr); if (nremain) setup_reader(nremain,&arg[narg-nremain]); - else setup_reader(0,NULL); + else setup_reader(0,nullptr); // find the snapshot and read/bcast/process header info @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid nullptr ptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid NULL ptr + newmaxnew = MAX(newmaxnew,1); // avoid nullptr ptr memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); @@ -1207,7 +1207,7 @@ int ReadDump::fields_and_keywords(int narg, char **arg) purgeflag = 0; trimflag = 0; addflag = NOADD; - for (int i = 0; i < nfield; i++) fieldlabel[i] = NULL; + for (int i = 0; i < nfield; i++) fieldlabel[i] = nullptr; scaleflag = 0; wrapflag = 1; diff --git a/src/read_restart.cpp b/src/read_restart.cpp index dcab9f834c..81a6862236 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -108,7 +108,7 @@ void ReadRestart::command(int narg, char **arg) hfile.replace(hfile.find("%"),1,"base"); } fp = fopen(hfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", hfile, utils::getsyserror())); } @@ -166,7 +166,7 @@ void ReadRestart::command(int narg, char **arg) if (multiproc && me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // read per-proc info @@ -174,7 +174,7 @@ void ReadRestart::command(int narg, char **arg) AtomVec *avec = atom->avec; int maxbuf = 0; - double *buf = NULL; + double *buf = nullptr; int m,flag; // MPI-IO input from single file @@ -255,7 +255,7 @@ void ReadRestart::command(int narg, char **arg) if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -270,34 +270,34 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",iproc)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); int procsperfile; - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); for (int i = 0; i < procsperfile; i++) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); m = 0; while (m < n) m += avec->unpack_restart(&buf[m]); } fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -334,7 +334,7 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); } @@ -342,10 +342,10 @@ void ReadRestart::command(int narg, char **arg) int flag,procsperfile; if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&procsperfile,1,MPI_INT,0,clustercomm); @@ -354,17 +354,17 @@ void ReadRestart::command(int narg, char **arg) for (int i = 0; i < procsperfile; i++) { if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); if (i % nclusterprocs) { iproc = me + (i % nclusterprocs); @@ -391,9 +391,9 @@ void ReadRestart::command(int narg, char **arg) } } - if (filereader && fp != NULL) { + if (filereader && fp != nullptr) { fclose(fp); - fp = NULL; + fp = nullptr; } MPI_Comm_free(&clustercomm); } @@ -570,11 +570,11 @@ void ReadRestart::file_search(char *inpfile, char *outfile) struct dirent *ep; DIR *dp = opendir(dirname); - if (dp == NULL) + if (dp == nullptr) error->one(FLERR,"Cannot open dir to search for restart file"); while ((ep = readdir(dp))) { if (strstr(ep->d_name,begin) != ep->d_name) continue; - if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue; + if ((ptr = strstr(&ep->d_name[nbegin],end)) == nullptr) continue; if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); *ptr = '\0'; if ((int)strlen(&ep->d_name[nbegin]) < n) { @@ -1034,7 +1034,7 @@ void ReadRestart::file_layout() memory->create(nproc_chunk_number,nprocs, "write_restart:nproc_chunk_number"); - utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,NULL,error); + utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,nullptr,error); if ((nprocs != nprocs_file) && !(atom->nextra_store)) { // nprocs differ, but atom sizes are fixed length, yeah! @@ -1232,7 +1232,7 @@ double ReadRestart::read_double() } /* ---------------------------------------------------------------------- - read a char string (including NULL) and bcast it + read a char string (including nullptr) and bcast it str is allocated here, ptr is returned, caller must deallocate ------------------------------------------------------------------------- */ @@ -1241,7 +1241,7 @@ char *ReadRestart::read_string() int n = read_int(); if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart"); char *value = new char[n]; - if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error); MPI_Bcast(value,n,MPI_CHAR,0,world); return value; } @@ -1253,7 +1253,7 @@ char *ReadRestart::read_string() void ReadRestart::read_int_vec(int n, int *vec) { if (n < 0) error->all(FLERR,"Illegal size integer vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_INT,0,world); } @@ -1264,6 +1264,6 @@ void ReadRestart::read_int_vec(int n, int *vec) void ReadRestart::read_double_vec(int n, double *vec) { if (n < 0) error->all(FLERR,"Illegal size double vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_DOUBLE,0,world); } diff --git a/src/reader.cpp b/src/reader.cpp index 8230fa3ed3..218fd75dfa 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; Reader::Reader(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -35,7 +35,7 @@ Reader::Reader(LAMMPS *lmp) : Pointers(lmp) void Reader::open_file(const char *file) { - if (fp != NULL) close_file(); + if (fp != nullptr) close_file(); compressed = 0; const char *suffix = file + strlen(file) - 3; @@ -55,7 +55,7 @@ void Reader::open_file(const char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -67,10 +67,10 @@ void Reader::open_file(const char *file) void Reader::close_file() { - if (fp == NULL) return; + if (fp == nullptr) return; if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/reader_native.cpp b/src/reader_native.cpp index e0f0d7792b..11241047a1 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -34,7 +34,7 @@ enum{UNSET,NOSCALE_NOWRAP,NOSCALE_WRAP,SCALE_NOWRAP,SCALE_WRAP}; ReaderNative::ReaderNative(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ ReaderNative::~ReaderNative() int ReaderNative::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // skip over unit and time information, if present. @@ -110,7 +110,7 @@ void ReaderNative::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flags = scaleflag+wrapflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 @@ -315,7 +315,7 @@ void ReaderNative::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); // tokenize the line std::vector words = Tokenizer(line).as_vector(); @@ -351,8 +351,8 @@ int ReaderNative::find_label(const std::string & label, const std::mapone(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index 8a2f7a3989..82fe756c2e 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,X,Y,Z}; ReaderXYZ::ReaderXYZ(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; nstep = 0; } @@ -52,7 +52,7 @@ ReaderXYZ::~ReaderXYZ() int ReaderXYZ::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // first line has to have the number of atoms // truncate the string to the first whitespace, @@ -109,7 +109,7 @@ void ReaderXYZ::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ @@ -174,7 +174,7 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); ++nid; rv = sscanf(line,"%*s%lg%lg%lg", &myx, &myy, &myz); @@ -216,8 +216,8 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) void ReaderXYZ::read_lines(int n) { - char *eof = NULL; + char *eof = nullptr; if (n <= 0) return; for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/region.cpp b/src/region.cpp index 15b6fee272..c7c2627885 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), contact(NULL), list(NULL), - xstr(NULL), ystr(NULL), zstr(NULL), tstr(NULL) + id(nullptr), style(nullptr), contact(nullptr), list(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr), tstr(nullptr) { int n = strlen(arg[0]) + 1; id = new char[n]; @@ -42,13 +42,13 @@ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : strcpy(style,arg[1]); varshape = 0; - xstr = ystr = zstr = tstr = NULL; + xstr = ystr = zstr = tstr = nullptr; dx = dy = dz = 0.0; size_restart = 5; reset_vel(); copymode = 0; - list = NULL; + list = nullptr; nregion = 1; } diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index f7676a3d74..2d40052e06 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -30,7 +30,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), c1str(NULL), c2str(NULL), rstr(NULL) + Region(lmp, narg, arg), c1str(nullptr), c2str(nullptr), rstr(nullptr) { options(narg-8,&arg[8]); diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index a61e2556b0..35c6c502ab 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), idsub(NULL) + Region(lmp, narg, arg), idsub(nullptr) { nregion = 0; diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index 4256af4213..5282095c87 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -28,7 +28,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL) + Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr) { options(narg-6,&arg[6]); diff --git a/src/region_union.cpp b/src/region_union.cpp index 677f1022f9..3ee0765f0b 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), - idsub(NULL) + idsub(nullptr) { nregion = 0; if (narg < 5) error->all(FLERR,"Illegal region command"); diff --git a/src/replicate.cpp b/src/replicate.cpp index 374d7113b2..471af6934e 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -154,7 +154,7 @@ void Replicate::command(int narg, char **arg) // also set atomKK for Kokkos version of Atom class Atom *old = atom; - atomKK = NULL; + atomKK = nullptr; if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp); else atom = new Atom(lmp); diff --git a/src/rerun.cpp b/src/rerun.cpp index 51c0f6fdb2..00cd1d4080 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -120,9 +120,9 @@ void Rerun::command(int narg, char **arg) rd->store_files(nfile,arg); if (nremain) nremain = rd->fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = rd->fields_and_keywords(0,NULL); + else nremain = rd->fields_and_keywords(0,nullptr); if (nremain) rd->setup_reader(nremain,&arg[narg-nremain]); - else rd->setup_reader(0,NULL); + else rd->setup_reader(0,nullptr); // perform the pseudo run // invoke lmp->init() only once diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index ad2caad656..10337fd18f 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -33,8 +33,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ResetMolIDs::ResetMolIDs(LAMMPS *lmp) : Pointers(lmp) { - cfa = NULL; - cca = NULL; + cfa = nullptr; + cca = nullptr; // default settings diff --git a/src/respa.cpp b/src/respa.cpp index c970c63a19..ecc6cc58f3 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -46,8 +46,8 @@ using namespace LAMMPS_NS; Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg), - step(NULL), loop(NULL), hybrid_level(NULL), hybrid_compute(NULL), - newton(NULL), fix_respa(NULL) + step(nullptr), loop(nullptr), hybrid_level(nullptr), hybrid_compute(nullptr), + newton(nullptr), fix_respa(nullptr) { nhybrid_styles = 0; if (narg < 1) error->all(FLERR,"Illegal run_style respa command"); diff --git a/src/run.cpp b/src/run.cpp index 166955d6ac..f5b571844f 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -91,7 +91,7 @@ void Run::command(int narg, char **arg) // all remaining args are commands // first,last = arg index of first/last commands - // set ncommands = 0 if single command and it is NULL + // set ncommands = 0 if single command and it is nullptr } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); @@ -140,7 +140,7 @@ void Run::command(int narg, char **arg) // if nevery, make copies of arg strings that are commands // required because re-parsing commands via input->one() will wipe out args - char **commands = NULL; + char **commands = nullptr; if (nevery && ncommands > 0) { commands = new char*[ncommands]; ncommands = 0; diff --git a/src/set.cpp b/src/set.cpp index 3b2cd44ad0..f66de96e98 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -74,7 +74,7 @@ void Set::command(int narg, char **arg) int n = strlen(arg[1]) + 1; id = new char[n]; strcpy(id,arg[1]); - select = NULL; + select = nullptr; selection(atom->nlocal); // loop over keyword/value pairs @@ -689,7 +689,7 @@ void Set::set(int keyword) { // evaluate atom-style variable(s) if necessary - vec1 = vec2 = vec3 = vec4 = NULL; + vec1 = vec2 = vec3 = vec4 = nullptr; if (varflag) { int nlocal = atom->nlocal; @@ -907,7 +907,7 @@ void Set::set(int keyword) // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { - double *quat = NULL; + double *quat = nullptr; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) diff --git a/src/special.cpp b/src/special.cpp index eb74f534f7..9661fa5ad8 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -34,7 +34,7 @@ Special::Special(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - onetwo = onethree = onefour = NULL; + onetwo = onethree = onefour = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/thermo.cpp b/src/thermo.cpp index 787b0cdda8..485974cc81 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -147,9 +147,9 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // ptrs, flags, IDs for compute objects thermo may use or create - temperature = NULL; - pressure = NULL; - pe = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; index_temp = index_press_scalar = index_press_vector = index_pe = -1; @@ -179,10 +179,10 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) sprintf(format_bigint_one_def,"%%8%s",&bigint_format[1]); sprintf(format_bigint_multi_def,"%%14%s",&bigint_format[1]); - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; } /* ---------------------------------------------------------------------- */ @@ -563,13 +563,13 @@ void Thermo::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; for (int i = 0; i < nfield_initial+1; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } iarg += 2; continue; @@ -593,7 +593,7 @@ void Thermo::modify_params(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Thermo_modify int format does not contain d character"); char str[8]; @@ -632,14 +632,14 @@ void Thermo::allocate() int n = nfield_initial + 1; keyword = new char*[n]; - for (int i = 0; i < n; i++) keyword[i] = NULL; + for (int i = 0; i < n; i++) keyword[i] = nullptr; vfunc = new FnPtr[n]; vtype = new int[n]; format = new char*[n]; for (int i = 0; i < n; i++) format[i] = new char[32]; format_column_user = new char*[n]; - for (int i = 0; i < n; i++) format_column_user[i] = NULL; + for (int i = 0; i < n; i++) format_column_user[i] = nullptr; field2index = new int[n]; argindex1 = new int[n]; @@ -893,7 +893,7 @@ void Thermo::parse_fields(char *str) // argindex1,argindex2 = int inside each bracket pair, 0 if no bracket char *ptr = strchr(id,'['); - if (ptr == NULL) argindex1[nfield] = argindex2[nfield] = 0; + if (ptr == nullptr) argindex1[nfield] = argindex2[nfield] = 0; else { *ptr = '\0'; argindex1[nfield] = diff --git a/src/universe.cpp b/src/universe.cpp index cd079a45c0..ecdd5aa04d 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -40,12 +40,12 @@ Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp) MPI_Comm_size(uworld,&nprocs); uscreen = stdout; - ulogfile = NULL; + ulogfile = nullptr; existflag = 0; nworlds = 0; - procs_per_world = NULL; - root_proc = NULL; + procs_per_world = nullptr; + root_proc = nullptr; memory->create(uni2orig,nprocs,"universe:uni2orig"); for (int i = 0; i < nprocs; i++) uni2orig[i] = i; @@ -95,7 +95,7 @@ void Universe::reorder(char *style, char *arg) if (me == 0) { FILE *fp = fopen(arg,"r"); - if (fp == NULL) + if (fp == nullptr) error->universe_one(FLERR,fmt::format("Cannot open -reorder " "file {}: {}",arg, utils::getsyserror())); @@ -156,7 +156,7 @@ void Universe::reorder(char *style, char *arg) /* ---------------------------------------------------------------------- add 1 or more worlds to universe - str == NULL -> add 1 world with all procs in universe + str == nullptr -> add 1 world with all procs in universe str = NxM -> add N worlds, each with M procs str = P -> add 1 world with P procs ------------------------------------------------------------------------- */ @@ -169,7 +169,7 @@ void Universe::add_world(char *str) n = 1; nper = 0; - if (str != NULL) { + if (str != nullptr) { // check for valid partition argument @@ -184,7 +184,7 @@ void Universe::add_world(char *str) else valid = false; if (valid) { - if ((ptr = strchr(str,'x')) != NULL) { + if ((ptr = strchr(str,'x')) != nullptr) { // 'x' may not be the first or last character diff --git a/src/update.cpp b/src/update.cpp index 399584473c..00e396c6aa 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -48,13 +48,13 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) eflag_global = vflag_global = -1; - unit_style = NULL; + unit_style = nullptr; set_units("lj"); - integrate_style = NULL; - integrate = NULL; - minimize_style = NULL; - minimize = NULL; + integrate_style = nullptr; + integrate = nullptr; + minimize_style = nullptr; + minimize = nullptr; integrate_map = new IntegrateCreatorMap(); diff --git a/src/utils.cpp b/src/utils.cpp index f63deac0dc..e985f9e6e5 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -152,7 +152,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename, Error *error) { char *rv = fgets(s,size,fp); - if (rv == NULL) { // something went wrong + if (rv == nullptr) { // something went wrong char buf[MAXPATHLENBUF]; std::string errmsg; @@ -171,7 +171,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, errmsg += "'"; if (error) error->one(srcname,srcline,errmsg); - if (s) *s = '\0'; // truncate string to empty in case error is NULL + if (s) *s = '\0'; // truncate string to empty in case error is nullptr } return; } @@ -377,19 +377,19 @@ void utils::bounds(const char *file, int line, const std::string &str, nlo = nhi = -1; if (found == std::string::npos) { // contains no '*' - nlo = nhi = strtol(str.c_str(),NULL,10); + nlo = nhi = strtol(str.c_str(),nullptr,10); } else if (str.size() == 1) { // is only '*' nlo = nmin; nhi = nmax; } else if (found == 0) { // is '*j' nlo = nmin; - nhi = strtol(str.substr(1).c_str(),NULL,10); + nhi = strtol(str.substr(1).c_str(),nullptr,10); } else if (str.size() == found+1) { // is 'i*' - nlo = strtol(str.c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); nhi = nmax; } else { // is 'i*j' - nlo = strtol(str.c_str(),NULL,10); - nhi = strtol(str.substr(found+1).c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); + nhi = strtol(str.substr(found+1).c_str(),nullptr,10); } if (error) { @@ -422,7 +422,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; char *ptr1,*ptr2,*str; - ptr1 = NULL; + ptr1 = nullptr; for (iarg = 0; iarg < narg; iarg++) { ptr1 = strchr(arg[iarg],'*'); if (ptr1) break; @@ -1000,10 +1000,10 @@ double utils::timespec2seconds(const std::string ×pec) int utils::date2num(const std::string &date) { std::size_t found = date.find_first_not_of("0123456789 "); - int num = strtol(date.substr(0,found).c_str(),NULL,10); + int num = strtol(date.substr(0,found).c_str(),nullptr,10); auto month = date.substr(found); found = month.find_first_of("0123456789 "); - num += strtol(month.substr(found).c_str(),NULL,10)*10000; + num += strtol(month.substr(found).c_str(),nullptr,10)*10000; if (num < 1000000) num += 20000000; if (strmatch(month,"^Jan")) num += 100; diff --git a/src/utils.h b/src/utils.h index 06aef4654f..cf8952b8a6 100644 --- a/src/utils.h +++ b/src/utils.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { * \param s buffer for storing the result of fgets() * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfgets(const char *srcname, int srcline, char *s, int size, @@ -75,7 +75,7 @@ namespace LAMMPS_NS { * \param size size of data elements read by fread() * \param num number of data elements read by fread() * \param fp file pointer used by fread() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfread(const char *srcname, int srcline, void *s, size_t size, @@ -354,7 +354,7 @@ namespace LAMMPS_NS { * If the potential file has a ``UNITS`` tag in the first line, the * tag's value is compared to the current unit style setting. * The behavior of the function then depends on the value of the - * *auto_convert* parameter. If it is ``NULL``, then the unit values + * *auto_convert* parameter. If it is ``nullptr``, then the unit values * must match or else the open will fail with an error. Otherwise * the bitmask that *auto_convert* points to is used check for * compatibility with possible automatic conversions by the calling @@ -363,8 +363,8 @@ namespace LAMMPS_NS { * * \param name file- or pathname of the potential file * \param lmp pointer to top-level LAMMPS class instance - * \param auto_convert pointer to unit conversion bitmask or NULL - * \return FILE pointer of the opened potential file or NULL*/ + * \param auto_convert pointer to unit conversion bitmask or nullptr + * \return FILE pointer of the opened potential file or nullptr*/ FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert); diff --git a/src/variable.cpp b/src/variable.cpp index 8d4416dfa7..5ceed4dd33 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -86,20 +86,20 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); nvar = maxvar = 0; - names = NULL; - style = NULL; - num = NULL; - which = NULL; - pad = NULL; - reader = NULL; - data = NULL; - dvalue = NULL; - vecs = NULL; + names = nullptr; + style = nullptr; + num = nullptr; + which = nullptr; + pad = nullptr; + reader = nullptr; + data = nullptr; + dvalue = nullptr; + vecs = nullptr; - eval_in_progress = NULL; + eval_in_progress = nullptr; - randomequal = NULL; - randomatom = NULL; + randomequal = nullptr; + randomatom = nullptr; // customize by assigning a precedence level @@ -207,7 +207,7 @@ void Variable::set(int narg, char **arg) num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; // WORLD // num = listed args, which = partition this proc is in, data = copied args @@ -251,7 +251,7 @@ void Variable::set(int narg, char **arg) style[nvar] = ULOOP; num[nvar] = utils::inumeric(FLERR,arg[2],false,lmp); data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; if (narg == 4) { char digits[12]; sprintf(digits,"%d",num[nvar]); @@ -265,12 +265,12 @@ void Variable::set(int narg, char **arg) if (universe->me == 0) { FILE *fp = fopen("tmp.lammps.variable","w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open temporary file for world counter: " + utils::getsyserror()); fprintf(fp,"%d\n",universe->nworlds); fclose(fp); - fp = NULL; + fp = nullptr; } for (int jvar = 0; jvar < nvar; jvar++) @@ -355,7 +355,7 @@ void Variable::set(int narg, char **arg) // ATOMFILE for numbers // which = 1st value - // data = NULL + // data = nullptr } else if (strcmp(arg[1],"atomfile") == 0) { if (narg != 3) error->all(FLERR,"Illegal variable command"); @@ -366,7 +366,7 @@ void Variable::set(int narg, char **arg) which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; reader[nvar] = new VarReader(lmp,arg[0],arg[2],ATOMFILE); int flag = reader[nvar]->read_peratom(); if (flag) error->all(FLERR,"Atomfile variable could not read values"); @@ -706,7 +706,7 @@ int Variable::next(int narg, char **arg) char buf[64]; for (int loopmax = 0; loopmax < 100; ++loopmax) { fp = fopen("tmp.lammps.variable.lock","r"); - if (fp == NULL) goto uloop_again; + if (fp == nullptr) goto uloop_again; buf[0] = buf[1] = '\0'; fread(buf,1,64,fp); @@ -731,7 +731,7 @@ int Variable::next(int narg, char **arg) fprintf(fp,"%d\n",nextindex+1); //printf("WRITE %d %d\n",universe->me,nextindex+1); fclose(fp); - fp = NULL; + fp = nullptr; rename("tmp.lammps.variable.lock","tmp.lammps.variable"); if (universe->uscreen) fprintf(universe->uscreen, @@ -840,15 +840,15 @@ int Variable::vectorstyle(int ivar) check if variable with name is PYTHON and matches funcname called by Python class before it invokes a Python function return data storage so Python function can return a value for this variable - return NULL if not a match + return nullptr if not a match ------------------------------------------------------------------------- */ char *Variable::pythonstyle(char *name, char *funcname) { int ivar = find(name); - if (ivar < 0) return NULL; - if (style[ivar] != PYTHON) return NULL; - if (strcmp(data[ivar][0],funcname) != 0) return NULL; + if (ivar < 0) return nullptr; + if (style[ivar] != PYTHON) return nullptr; + if (strcmp(data[ivar][0],funcname) != 0) return nullptr; return data[ivar][1]; } @@ -873,23 +873,23 @@ int Variable::internalstyle(int ivar) if GETENV, query environment and put result in str if PYTHON, evaluate Python function, it will put result in str if INTERNAL, convert dvalue and put result in str - if ATOM or ATOMFILE or VECTOR, return NULL - return NULL if no variable with name, or which value is bad, + if ATOM or ATOMFILE or VECTOR, return nullptr + return nullptr if no variable with name, or which value is bad, caller must respond ------------------------------------------------------------------------- */ char *Variable::retrieve(const char *name) { int ivar = find(name); - if (ivar < 0) return NULL; - if (which[ivar] >= num[ivar]) return NULL; + if (ivar < 0) return nullptr; + if (which[ivar] >= num[ivar]) return nullptr; if (eval_in_progress[ivar]) print_var_error(FLERR,"Variable has a circular dependency",ivar); eval_in_progress[ivar] = 1; - char *str = NULL; + char *str = nullptr; if (style[ivar] == INDEX || style[ivar] == WORLD || style[ivar] == UNIVERSE || style[ivar] == STRING || style[ivar] == SCALARFILE) { @@ -908,19 +908,19 @@ char *Variable::retrieve(const char *name) strcpy(data[ivar][0],result); str = data[ivar][0]; } else if (style[ivar] == EQUAL) { - double answer = evaluate(data[ivar][0],NULL,ivar); + double answer = evaluate(data[ivar][0],nullptr,ivar); sprintf(data[ivar][1],"%.15g",answer); str = data[ivar][1]; } else if (style[ivar] == FORMAT) { int jvar = find(data[ivar][0]); - if (jvar == -1) return NULL; - if (!equalstyle(jvar)) return NULL; + if (jvar == -1) return nullptr; + if (!equalstyle(jvar)) return nullptr; double answer = compute_equal(jvar); sprintf(data[ivar][2],data[ivar][1],answer); str = data[ivar][2]; } else if (style[ivar] == GETENV) { const char *result = getenv(data[ivar][0]); - if (result == NULL) result = (const char *) ""; + if (result == nullptr) result = (const char *) ""; int n = strlen(result) + 1; if (n > VALUELENGTH) { delete [] data[ivar][1]; @@ -943,7 +943,7 @@ char *Variable::retrieve(const char *name) sprintf(data[ivar][0],"%.15g",dvalue[ivar]); str = data[ivar][0]; } else if (style[ivar] == ATOM || style[ivar] == ATOMFILE || - style[ivar] == VECTOR) return NULL; + style[ivar] == VECTOR) return nullptr; eval_in_progress[ivar] = 0; @@ -965,7 +965,7 @@ double Variable::compute_equal(int ivar) eval_in_progress[ivar] = 1; double value = 0.0; - if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL,ivar); + if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],nullptr,ivar); else if (style[ivar] == INTERNAL) value = dvalue[ivar]; else if (style[ivar] == PYTHON) { int ifunc = python->find(data[ivar][0]); @@ -987,7 +987,7 @@ double Variable::compute_equal(int ivar) double Variable::compute_equal(char *str) { - return evaluate(str,NULL,-1); + return evaluate(str,nullptr,-1); } /* ---------------------------------------------------------------------- @@ -1000,7 +1000,7 @@ double Variable::compute_equal(char *str) void Variable::compute_atom(int ivar, int igroup, double *result, int stride, int sumflag) { - Tree *tree = NULL; + Tree *tree = nullptr; double *vstore; if (eval_in_progress[ivar]) @@ -1014,7 +1014,7 @@ void Variable::compute_atom(int ivar, int igroup, collapse_tree(tree); } else vstore = reader[ivar]->fixstore->vstore; - if (result == NULL) { + if (result == nullptr) { if (style[ivar] == ATOM) free_tree(tree); eval_in_progress[ivar] = 0; return; @@ -1073,7 +1073,7 @@ void Variable::compute_atom(int ivar, int igroup, int Variable::compute_vector(int ivar, double **result) { - Tree *tree = NULL; + Tree *tree = nullptr; if (vecs[ivar].currentstep == update->ntimestep) { *result = vecs[ivar].values; return vecs[ivar].n; @@ -1166,7 +1166,7 @@ void Variable::grow() reader = (VarReader **) memory->srealloc(reader,maxvar*sizeof(VarReader *),"var:reader"); - for (int i = old; i < maxvar; i++) reader[i] = NULL; + for (int i = old; i < maxvar; i++) reader[i] = nullptr; data = (char ***) memory->srealloc(data,maxvar*sizeof(char **),"var:data"); memory->grow(dvalue,maxvar,"var:dvalue"); @@ -1175,7 +1175,7 @@ void Variable::grow() for (int i = old; i < maxvar; i++) { vecs[i].nmax = 0; vecs[i].currentstep = -1; - vecs[i].values = NULL; + vecs[i].values = nullptr; } memory->grow(eval_in_progress,maxvar,"var:eval_in_progress"); @@ -1214,9 +1214,9 @@ void Variable::copy(int narg, char **from, char **to) compute = c_ID, c_ID[i], c_ID[i][j] fix = f_ID, f_ID[i], f_ID[i][j] variable = v_name, v_name[i] - equal-style variables passes in tree = NULL: + equal-style variables passes in tree = nullptr: evaluate the formula, return result as a double - atom-style and vector-style variables pass in tree = non-NULL: + atom-style and vector-style variables pass in tree = non-nullptr: parse the formula but do not evaluate it create a parse tree and return it ------------------------------------------------------------------------- */ @@ -1261,10 +1261,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) // evaluate contents and push on stack if (tree) { - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(contents,&newtree,ivar); treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = evaluate(contents,NULL,ivar); + } else argstack[nargstack++] = evaluate(contents,nullptr,ivar); delete [] contents; @@ -1297,7 +1297,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(number); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->extra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(number); @@ -1389,7 +1389,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1418,7 +1418,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1450,7 +1450,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1459,7 +1459,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->vector_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1483,7 +1483,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_vector; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1491,7 +1491,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->array_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1515,7 +1515,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_array_rows; newtree->nstride = compute->size_array_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1533,7 +1533,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= INVOKED_PERATOM; } - peratom2global(1,NULL,compute->vector_atom,1,index1, + peratom2global(1,nullptr,compute->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // c_ID[i][j] = scalar from per-atom array @@ -1554,11 +1554,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } if (compute->array_atom) - peratom2global(1,NULL,&compute->array_atom[0][index2-1], + peratom2global(1,nullptr,&compute->array_atom[0][index2-1], compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1567,7 +1567,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1587,7 +1587,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = compute->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1596,7 +1596,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1619,10 +1619,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (compute->array_atom) newtree->array = &compute->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = compute->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1686,7 +1686,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1708,7 +1708,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1733,7 +1733,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1745,7 +1745,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed at " "compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1767,7 +1767,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1778,7 +1778,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1800,7 +1800,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1814,7 +1814,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - peratom2global(1,NULL,fix->vector_atom,1,index1, + peratom2global(1,nullptr,fix->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // f_ID[i][j] = scalar from per-atom array @@ -1831,11 +1831,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) "at a compatible time",ivar); if (fix->array_atom) - peratom2global(1,NULL,&fix->array_atom[0][index2-1], + peratom2global(1,nullptr,&fix->array_atom[0][index2-1], fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1844,7 +1844,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && fix->peratom_flag && fix->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (update->whichflag > 0 && @@ -1857,7 +1857,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = fix->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1866,7 +1866,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && fix->peratom_flag && fix->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (index1 > fix->size_peratom_cols) @@ -1882,10 +1882,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (fix->array_atom) newtree->array = &fix->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = fix->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1929,7 +1929,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1941,14 +1941,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) style[ivar] != ATOMFILE && style[ivar] != VECTOR) { char *var = retrieve(word+2); - if (var == NULL) + if (var == nullptr) print_var_error(FLERR,"Invalid variable evaluation in " "variable formula",ivar); if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(var); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(var); @@ -1958,14 +1958,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOM) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atom-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Atom-style variable in " "vector-style variable formula",ivar); - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(data[ivar][0],&newtree,ivar); treestack[ntreestack++] = newtree; @@ -1973,7 +1973,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1985,7 +1985,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = reader[ivar]->fixstore->vstore; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1994,7 +1994,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == VECTOR) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Vector-style variable in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -2010,7 +2010,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -2023,7 +2023,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) double *result; memory->create(result,atom->nlocal,"variable:result"); compute_atom(ivar,0,result,1,0); - peratom2global(1,NULL,result,1,index, + peratom2global(1,nullptr,result,1,index, tree,treestack,ntreestack,argstack,nargstack); memory->destroy(result); @@ -2031,7 +2031,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket && style[ivar] == ATOMFILE) { - peratom2global(1,NULL,reader[ivar]->fixstore->vstore,1,index, + peratom2global(1,nullptr,reader[ivar]->fixstore->vstore,1,index, tree,treestack,ntreestack,argstack,nargstack); // v_name[N] = scalar from vector-style variable @@ -2050,7 +2050,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = vec[m-1]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = vec[m-1]; @@ -2098,7 +2098,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) tagint id = int_between_brackets(ptr,1); i = ptr-str+1; - peratom2global(0,word,NULL,0,id, + peratom2global(0,word,nullptr,0,id, tree,treestack,ntreestack,argstack,nargstack); // ---------------- @@ -2122,7 +2122,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2144,7 +2144,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2224,7 +2224,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->type = opprevious; if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; - newtree->second = NULL; + newtree->second = nullptr; newtree->nextra = 0; } else { newtree->second = treestack[--ntreestack]; @@ -2627,7 +2627,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->type == RANDOM) { collapse_tree(tree->first); collapse_tree(tree->second); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -2641,7 +2641,7 @@ double Variable::collapse_tree(Tree *tree) double sigma = collapse_tree(tree->second); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3021,7 +3021,7 @@ double Variable::eval_tree(Tree *tree, int i) if (tree->type == RANDOM) { double lower = eval_tree(tree->first,i); double upper = eval_tree(tree->second,i); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3034,7 +3034,7 @@ double Variable::eval_tree(Tree *tree, int i) double sigma = eval_tree(tree->second,i); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3344,7 +3344,7 @@ tagint Variable::int_between_brackets(char *&ptr, int varallow) error->all(FLERR,"Invalid variable name in variable formula"); char *var = retrieve(id); - if (var == NULL) + if (var == nullptr) error->all(FLERR,"Invalid variable evaluation in variable formula"); index = static_cast (atof(var)); @@ -3399,15 +3399,15 @@ int Variable::math_function(char *word, char *contents, Tree **tree, char *args[MAXFUNCARG]; int narg = parse_args(contents,args); - Tree *newtree = NULL; + Tree *newtree = nullptr; double value1,value2; double values[MAXFUNCARG-2]; if (tree) { newtree = new Tree(); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; - Tree *argtree = NULL; + Tree *argtree = nullptr; evaluate(args[0],&argtree,ivar); newtree->first = argtree; if (narg > 1) { @@ -3425,12 +3425,12 @@ int Variable::math_function(char *word, char *contents, Tree **tree, treestack[ntreestack++] = newtree; } else { - value1 = evaluate(args[0],NULL,ivar); + value1 = evaluate(args[0],nullptr,ivar); if (narg > 1) { - value2 = evaluate(args[1],NULL,ivar); + value2 = evaluate(args[1],nullptr,ivar); if (narg > 2) { for (int i = 2; i < narg; i++) - values[i-2] = evaluate(args[i],NULL,ivar); + values[i-2] = evaluate(args[i],nullptr,ivar); } } } @@ -3530,7 +3530,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = RANDOM; else { - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -3545,7 +3545,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, else { if (value2 < 0.0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -4029,7 +4029,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4107,8 +4107,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, if (narg != 1) print_var_error(FLERR,"Invalid special function in variable formula",ivar); - Compute *compute = NULL; - Fix *fix = NULL; + Compute *compute = nullptr; + Fix *fix = nullptr; int ivar = -1; int index,nvec,nstride; char *ptr1,*ptr2; @@ -4239,7 +4239,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, double *vec; if (index) { if (compute->array) vec = &compute->array[0][index-1]; - else vec = NULL; + else vec = nullptr; } else vec = compute->vector; int j = 0; @@ -4320,7 +4320,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4328,7 +4328,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // mask special functions } else if (strcmp(word,"gmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Gmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4341,12 +4341,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = GMASK; newtree->ivalue1 = group->bitmask[igroup]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"rmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Rmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4358,12 +4358,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = RMASK; newtree->ivalue1 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"grmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Grmask function in equal-style " "variable formula",ivar); if (narg != 2) @@ -4379,7 +4379,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->type = GRMASK; newtree->ivalue1 = group->bitmask[igroup]; newtree->ivalue2 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4409,7 +4409,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4419,7 +4419,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // set selfalloc = 1 so result will be deleted by free_tree() after eval } else if (style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile variable in " "equal-style variable formula",ivar); @@ -4435,7 +4435,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->array = result; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4456,7 +4456,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4475,7 +4475,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4494,7 +4494,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4579,7 +4579,7 @@ void Variable::peratom2global(int flag, char *word, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4622,14 +4622,14 @@ int Variable::is_atom_vector(char *word) void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntreestack) { - if (tree == NULL) + if (tree == nullptr) error->all(FLERR,"Atom vector in equal-style variable formula"); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; newtree->nstride = 3; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4756,7 +4756,7 @@ int Variable::parse_args(char *str, char **args) /* ---------------------------------------------------------------------- find next comma in str skip commas inside one or more nested parenthesis - only return ptr to comma at level 0, else NULL if not found + only return ptr to comma at level 0, else nullptr if not found ------------------------------------------------------------------------- */ char *Variable::find_next_comma(char *str) @@ -4767,7 +4767,7 @@ char *Variable::find_next_comma(char *str) else if (')' == *p) level--; else if (',' == *p && !level) return p; } - return NULL; + return nullptr; } @@ -5069,11 +5069,11 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : { me = comm->me; style = flag; - fp = NULL; + fp = nullptr; if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file variable file {}: {}", file, utils::getsyserror())); } @@ -5082,9 +5082,9 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : // allocate a new fix STORE, so they persist // id = variable-ID + VARIABLE_STORE, fix group = all - fixstore = NULL; - id_fix = NULL; - buffer = NULL; + fixstore = nullptr; + id_fix = nullptr; + buffer = nullptr; if (style == ATOMFILE) { if (atom->map_style == 0) @@ -5109,7 +5109,7 @@ VarReader::~VarReader() { if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // check modify in case all fixes have already been deleted @@ -5137,12 +5137,12 @@ int VarReader::read_scalar(char *str) if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } @@ -5180,12 +5180,12 @@ int VarReader::read_peratom() char str[MAXLINE]; if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } diff --git a/src/variable.h b/src/variable.h index efffacc7bb..58548bc276 100644 --- a/src/variable.h +++ b/src/variable.h @@ -93,9 +93,9 @@ class Variable : protected Pointers { Tree **extra; // ptrs further down tree for nextra args Tree() : - array(NULL), iarray(NULL), barray(NULL), + array(nullptr), iarray(nullptr), barray(nullptr), selfalloc(0), ivalue1(0), ivalue2(0), nextra(0), - first(NULL), second(NULL), extra(NULL) {} + first(nullptr), second(nullptr), extra(nullptr) {} }; int compute_python(int); diff --git a/src/velocity.cpp b/src/velocity.cpp index eafa98cb7c..db396fb7e3 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -82,7 +82,7 @@ void Velocity::command(int narg, char **arg) // set defaults - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -147,7 +147,7 @@ void Velocity::init_external(const char *extgroup) if (igroup == -1) error->all(FLERR,"Could not find velocity group ID"); groupbit = group->bitmask[igroup]; - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -179,18 +179,18 @@ void Velocity::create(double t_desired, int seed) } } - // if temperature = NULL or bias_flag set, + // if temperature = nullptr or bias_flag set, // create a new ComputeTemp with the velocity group int tcreate_flag = 0; - Compute *temperature_nobias = NULL; + Compute *temperature_nobias = nullptr; - if (temperature == NULL || bias_flag) { + if (temperature == nullptr || bias_flag) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; arg[2] = (char *) "temp"; - if (temperature == NULL) { + if (temperature == nullptr) { temperature = new ComputeTemp(lmp,3,arg); tcreate_flag = 1; } else temperature_nobias = new ComputeTemp(lmp,3,arg); @@ -245,7 +245,7 @@ void Velocity::create(double t_desired, int seed) int m; double vx,vy,vz,factor; - RanPark *random = NULL; + RanPark *random = nullptr; if (loop_flag == ALL) { @@ -368,7 +368,7 @@ void Velocity::create(double t_desired, int seed) // no-bias compute calculates temp only for new thermal velocities double t; - if ((bias_flag == 0) || (temperature_nobias == NULL)) + if ((bias_flag == 0) || (temperature_nobias == nullptr)) t = temperature->compute_scalar(); else t = temperature_nobias->compute_scalar(); rescale(t,t_desired); @@ -417,7 +417,7 @@ void Velocity::set(int /*narg*/, char **arg) // parse 3 args xstyle = ystyle = zstyle = CONSTANT; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -501,7 +501,7 @@ void Velocity::set(int /*narg*/, char **arg) // allocate vfield array if necessary - double **vfield = NULL; + double **vfield = nullptr; if (varflag == ATOM) memory->create(vfield,atom->nlocal,3,"velocity:vfield"); // set velocities via constants @@ -531,17 +531,17 @@ void Velocity::set(int /*narg*/, char **arg) if (xstyle == EQUAL) vx = input->variable->compute_equal(xvar); else if (xstyle == ATOM) { if (vfield) input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0); - else input->variable->compute_atom(xvar,igroup,NULL,3,0); + else input->variable->compute_atom(xvar,igroup,nullptr,3,0); } if (ystyle == EQUAL) vy = input->variable->compute_equal(yvar); else if (ystyle == ATOM) { if (vfield) input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0); - else input->variable->compute_atom(yvar,igroup,NULL,3,0); + else input->variable->compute_atom(yvar,igroup,nullptr,3,0); } if (zstyle == EQUAL) vz = input->variable->compute_equal(zvar); else if (zstyle == ATOM) { if (vfield) input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0); - else input->variable->compute_atom(zvar,igroup,NULL,3,0); + else input->variable->compute_atom(zvar,igroup,nullptr,3,0); } for (int i = 0; i < nlocal; i++) @@ -580,10 +580,10 @@ void Velocity::scale(int /*narg*/, char **arg) { double t_desired = utils::numeric(FLERR,arg[0],false,lmp); - // if temperature = NULL, create a new ComputeTemp with the velocity group + // if temperature = nullptr, create a new ComputeTemp with the velocity group int tflag = 0; - if (temperature == NULL) { + if (temperature == nullptr) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; @@ -901,7 +901,7 @@ void Velocity::options(int narg, char **arg) // error check - if (bias_flag && temperature == NULL) + if (bias_flag && temperature == nullptr) error->all(FLERR,"Cannot use velocity bias command without temp keyword"); if (bias_flag && temperature->tempbias == 0) error->all(FLERR,"Velocity temperature ID does calculate a velocity bias"); diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 121a2ed1fd..3e247f19ce 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -56,7 +56,7 @@ void WriteCoeff::command(int narg, char **arg) char str[256], coeff[256]; FILE *one = fopen(file,"wb+"); - if (one == NULL) + if (one == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file, utils::getsyserror())); @@ -90,7 +90,7 @@ void WriteCoeff::command(int narg, char **arg) rewind(one); FILE *two = fopen(file+4,"w"); - if (two == NULL) + if (two == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file+4, utils::getsyserror())); @@ -99,15 +99,15 @@ void WriteCoeff::command(int narg, char **arg) while(1) { int coeff_mode = REGULAR_MODE; - if (fgets(str,256,one) == NULL) break; + if (fgets(str,256,one) == nullptr) break; // some coeffs need special treatment - if (strstr(str,"class2") != NULL) { - if (strstr(str,"angle_style") != NULL) + if (strstr(str,"class2") != nullptr) { + if (strstr(str,"angle_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"dihedral_style") != NULL) + else if (strstr(str,"dihedral_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"improper_style") != NULL) + else if (strstr(str,"improper_style") != nullptr) coeff_mode = CLASS2_MODE; } diff --git a/src/write_data.cpp b/src/write_data.cpp index 53d277b723..6f22547b80 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -153,21 +153,21 @@ void WriteData::write(const std::string &file) // may be different than atom->nbonds,nangles, etc. if broken/turned-off if (atom->molecular == 1 && (atom->nbonds || atom->nbondtypes)) { - nbonds_local = atom->avec->pack_bond(NULL); + nbonds_local = atom->avec->pack_bond(nullptr); MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->nangles || atom->nangletypes)) { - nangles_local = atom->avec->pack_angle(NULL); + nangles_local = atom->avec->pack_angle(nullptr); MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->ndihedrals || atom->ndihedraltypes)) { - ndihedrals_local = atom->avec->pack_dihedral(NULL); + ndihedrals_local = atom->avec->pack_dihedral(nullptr); MPI_Allreduce(&ndihedrals_local,&ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == 1 && (atom->nimpropers || atom->nimpropertypes)) { - nimpropers_local = atom->avec->pack_improper(NULL); + nimpropers_local = atom->avec->pack_improper(nullptr); MPI_Allreduce(&nimpropers_local,&nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); } @@ -175,7 +175,7 @@ void WriteData::write(const std::string &file) if (me == 0) { fp = fopen(file.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open data file {}: {}", file, utils::getsyserror())); } @@ -665,7 +665,7 @@ void WriteData::bonus(int flag) // communication buffer for all my Bonus info // maxvalues = largest buffer needed by any proc - int nvalues = atom->avec->pack_data_bonus(NULL,flag); + int nvalues = atom->avec->pack_data_bonus(nullptr,flag); int maxvalues; MPI_Allreduce(&nvalues,&maxvalues,1,MPI_INT,MPI_MAX,world); diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 56839a2f5e..fd359ec2ba 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -45,7 +45,7 @@ void WriteDump::command(int narg, char **arg) // create the Dump instance // create dump command line with extra required args - Dump *dump = NULL; + Dump *dump = nullptr; char **dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 256d7a377e..01ad917e86 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -49,7 +49,7 @@ WriteRestart::WriteRestart(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); multiproc = 0; noinit = 0; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -231,7 +231,7 @@ void WriteRestart::write(std::string file) if (multiproc) base.replace(base.find("%"),1,"base"); fp = fopen(base.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", base, utils::getsyserror())); } @@ -286,7 +286,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } std::string multiname = file; @@ -294,7 +294,7 @@ void WriteRestart::write(std::string file) if (filewriter) { fp = fopen(multiname.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", multiname, utils::getsyserror())); write_int(PROCSPERFILE,nclusterprocs); @@ -363,7 +363,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } mpiio->openForWrite(file.c_str()); mpiio->write(headerOffset,send_size,buf); @@ -393,7 +393,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } else { MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE); @@ -661,7 +661,7 @@ void WriteRestart::write_double(int flag, double value) } /* ---------------------------------------------------------------------- - write a flag and a char string (including NULL) into restart file + write a flag and a char string (including nullptr) into restart file ------------------------------------------------------------------------- */ void WriteRestart::write_string(int flag, const char *value) -- GitLab From f524fa758dc25aecc216f2c3c776ee805fe93e35 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 08:53:44 -0600 Subject: [PATCH 10/21] T2345: Replace instances of NULL with nullptr Per guidance from Axel, revert lib/kokkos and lib/colvars to remove nullptr changes. --- lib/colvars/colvar.cpp | 20 +++---- lib/colvars/colvaratoms.cpp | 8 +-- lib/colvars/colvarbias.cpp | 26 ++++---- lib/colvars/colvarbias.h | 4 +- lib/colvars/colvarbias_abf.cpp | 42 ++++++------- lib/colvars/colvarbias_histogram.cpp | 4 +- lib/colvars/colvarbias_meta.cpp | 46 +++++++------- lib/colvars/colvarcomp.cpp | 8 +-- lib/colvars/colvarcomp_coordnums.cpp | 38 ++++++------ lib/colvars/colvarcomp_distances.cpp | 2 +- lib/colvars/colvardeps.cpp | 2 +- lib/colvars/colvargrid.cpp | 14 ++--- lib/colvars/colvarmodule.cpp | 60 +++++++++---------- lib/colvars/colvarmodule.h | 6 +- lib/colvars/colvarparams.cpp | 6 +- lib/colvars/colvarparse.cpp | 10 ++-- lib/colvars/colvarparse.h | 8 +-- lib/colvars/colvarproxy.cpp | 16 ++--- lib/colvars/colvarproxy.h | 2 +- lib/colvars/colvarscript.cpp | 20 +++---- lib/colvars/colvarscript.h | 2 +- lib/colvars/colvartypes.h | 4 +- lib/colvars/lepton/include/lepton/Operation.h | 12 ++-- lib/colvars/lepton/src/CompiledExpression.cpp | 8 +-- lib/colvars/lepton/src/ExpressionTreeNode.cpp | 8 +-- lib/colvars/lepton/src/ParsedExpression.cpp | 2 +- lib/kokkos/cmake/compile_tests/pthread.cpp | 6 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 2 +- lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp | 2 +- .../core/src/impl/Kokkos_SharedAlloc.cpp | 2 +- lib/kokkos/core/unit_test/TestCTestDevice.cpp | 2 +- 31 files changed, 196 insertions(+), 196 deletions(-) diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index 61e83f44ab..1002dc35d8 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -22,7 +22,7 @@ colvar::colvar() { - runave_os = nullptr; + runave_os = NULL; prev_timestep = -1L; after_restart = false; @@ -62,7 +62,7 @@ int colvar::init(std::string const &conf) get_keyval(conf, "name", this->name, (std::string("colvar")+cvm::to_str(cv->variables()->size()))); - if ((cvm::colvar_by_name(this->name) != nullptr) && + if ((cvm::colvar_by_name(this->name) != NULL) && (cvm::colvar_by_name(this->name) != this)) { cvm::error("Error: this colvar cannot have the same name, \""+this->name+ "\", as another colvar.\n", @@ -744,7 +744,7 @@ template int colvar::init_components_type(std::string c : ".\n")); cvm::increase_depth(); cvc *cvcp = new def_class_name(def_conf); - if (cvcp != nullptr) { + if (cvcp != NULL) { cvcs.push_back(cvcp); cvcp->check_keywords(def_conf, def_config_key); cvcp->config_key = def_config_key; @@ -994,7 +994,7 @@ int colvar::parse_analysis(std::string const &conf) acf_type = acf_vel; enable(f_cv_fdiff_velocity); colvar *cv2 = cvm::colvar_by_name(acf_colvar_name); - if (cv2 == nullptr) { + if (cv2 == NULL) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -1215,14 +1215,14 @@ colvar::~colvar() for (std::vector::iterator cei = value_evaluators.begin(); cei != value_evaluators.end(); ++cei) { - if (*cei != nullptr) delete (*cei); + if (*cei != NULL) delete (*cei); } value_evaluators.clear(); for (std::vector::iterator gei = gradient_evaluators.begin(); gei != gradient_evaluators.end(); ++gei) { - if (*gei != nullptr) delete (*gei); + if (*gei != NULL) delete (*gei); } gradient_evaluators.clear(); #endif @@ -1972,7 +1972,7 @@ void const *colvar::get_cvc_param_ptr(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return nullptr; + return NULL; } @@ -1983,7 +1983,7 @@ colvarvalue const *colvar::get_cvc_param_grad(std::string const ¶m_name) } cvm::error("Error: calling colvar::get_cvc_param_grad() for a variable " "with more than one component.\n", COLVARS_NOT_IMPLEMENTED); - return nullptr; + return NULL; } @@ -2422,7 +2422,7 @@ int colvar::calc_acf() // the pointer to each vector is changed at every step colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name); - if (cfcv == nullptr) { + if (cfcv == NULL) { return cvm::error("Error: collective variable \""+acf_colvar_name+ "\" is not defined at this time.\n", INPUT_ERROR); } @@ -2660,7 +2660,7 @@ int colvar::calc_runave() if ((*x_history_p).size() >= runave_length-1) { - if (runave_os == nullptr) { + if (runave_os == NULL) { if (runave_outfile.size() == 0) { runave_outfile = std::string(cvm::output_prefix()+"."+ this->name+".runave.traj"); diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index 2796f3d28b..180fc69a85 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -105,7 +105,7 @@ cvm::atom_group::~atom_group() if (fitting_group) { delete fitting_group; - fitting_group = nullptr; + fitting_group = NULL; } cvm::main()->unregister_named_atom_group(this); @@ -217,7 +217,7 @@ int cvm::atom_group::init() b_center = false; b_rotate = false; b_user_defined_fit = false; - fitting_group = nullptr; + fitting_group = NULL; noforce = false; @@ -368,7 +368,7 @@ int cvm::atom_group::parse(std::string const &group_conf) // Optional group name will let other groups reuse atom definition if (get_keyval(group_conf, "name", name)) { - if ((cvm::atom_group_by_name(this->name) != nullptr) && + if ((cvm::atom_group_by_name(this->name) != NULL) && (cvm::atom_group_by_name(this->name) != this)) { cvm::error("Error: this atom group cannot have the same name, \""+this->name+ "\", as another atom group.\n", @@ -395,7 +395,7 @@ int cvm::atom_group::parse(std::string const &group_conf) std::string atoms_of = ""; if (get_keyval(group_conf, "atomsOfGroup", atoms_of)) { atom_group * ag = atom_group_by_name(atoms_of); - if (ag == nullptr) { + if (ag == NULL) { cvm::error("Error: cannot find atom group with name " + atoms_of + ".\n"); return COLVARS_ERROR; } diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index cdbc13699b..09bcca01b5 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -47,7 +47,7 @@ int colvarbias::init(std::string const &conf) { colvarbias *bias_with_name = cvm::bias_by_name(this->name); - if (bias_with_name != nullptr) { + if (bias_with_name != NULL) { if ((bias_with_name->rank != this->rank) || (bias_with_name->bias_type != this->bias_type)) { cvm::error("Error: this bias cannot have the same name, \""+this->name+ @@ -295,8 +295,8 @@ int colvarbias::update() colvar_values[i] = colvars[i]->value(); } - error_code |= calc_energy(nullptr); - error_code |= calc_forces(nullptr); + error_code |= calc_energy(NULL); + error_code |= calc_forces(NULL); return error_code; } @@ -547,8 +547,8 @@ colvarbias_ti::colvarbias_ti(char const *key) : colvarbias(key) { provide(f_cvb_calc_ti_samples); - ti_avg_forces = nullptr; - ti_count = nullptr; + ti_avg_forces = NULL; + ti_count = NULL; } @@ -560,13 +560,13 @@ colvarbias_ti::~colvarbias_ti() int colvarbias_ti::clear_state_data() { - if (ti_avg_forces != nullptr) { + if (ti_avg_forces != NULL) { delete ti_avg_forces; - ti_avg_forces = nullptr; + ti_avg_forces = NULL; } - if (ti_count != nullptr) { + if (ti_count != NULL) { delete ti_count; - ti_count = nullptr; + ti_count = NULL; } return COLVARS_OK; } @@ -622,7 +622,7 @@ int colvarbias_ti::init(std::string const &conf) int colvarbias_ti::init_grids() { if (is_enabled(f_cvb_calc_ti_samples)) { - if (ti_avg_forces == nullptr) { + if (ti_avg_forces == NULL) { ti_bin.resize(num_variables()); ti_system_forces.resize(num_variables()); for (size_t icv = 0; icv < num_variables(); icv++) { @@ -643,7 +643,7 @@ int colvarbias_ti::init_grids() int colvarbias_ti::update() { - return update_system_forces(nullptr); + return update_system_forces(NULL); } @@ -679,7 +679,7 @@ int colvarbias_ti::update_system_forces(std::vector const ti_system_forces[i] = variables(i)->total_force(); } else { ti_system_forces[i] = variables(i)->total_force() - - ((subtract_forces != nullptr) ? + ((subtract_forces != NULL) ? (*subtract_forces)[i] : previous_colvar_forces[i]); } } @@ -759,7 +759,7 @@ int colvarbias_ti::write_output_files() std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name; - std::ostream *os = nullptr; + std::ostream *os = NULL; if (is_enabled(f_cvb_write_ti_samples)) { std::string const ti_count_file_name(ti_output_prefix+".ti.count"); diff --git a/lib/colvars/colvarbias.h b/lib/colvars/colvarbias.h index 20c346f81c..5179c42853 100644 --- a/lib/colvars/colvarbias.h +++ b/lib/colvars/colvarbias.h @@ -58,12 +58,12 @@ public: virtual int update(); /// Compute the energy of the bias - /// Uses the vector of colvar values provided if not nullptr, and the values + /// Uses the vector of colvar values provided if not NULL, and the values /// currently cached in the bias instance otherwise virtual int calc_energy(std::vector const *values); /// Compute the forces due to the bias - /// Uses the vector of colvar values provided if not nullptr, and the values + /// Uses the vector of colvar values provided if not NULL, and the values /// currently cached in the bias instance otherwise virtual int calc_forces(std::vector const *values); diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index 9926579a8d..5382a828f7 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -18,16 +18,16 @@ colvarbias_abf::colvarbias_abf(char const *key) b_UI_estimator(false), b_CZAR_estimator(false), pabf_freq(0), - system_force(nullptr), - gradients(nullptr), - samples(nullptr), - pmf(nullptr), - z_gradients(nullptr), - z_samples(nullptr), - czar_gradients(nullptr), - czar_pmf(nullptr), - last_gradients(nullptr), - last_samples(nullptr) + system_force(NULL), + gradients(NULL), + samples(NULL), + pmf(NULL), + z_gradients(NULL), + z_samples(NULL), + czar_gradients(NULL), + czar_pmf(NULL), + last_gradients(NULL), + last_samples(NULL) { } @@ -261,37 +261,37 @@ colvarbias_abf::~colvarbias_abf() { if (samples) { delete samples; - samples = nullptr; + samples = NULL; } if (gradients) { delete gradients; - gradients = nullptr; + gradients = NULL; } if (pmf) { delete pmf; - pmf = nullptr; + pmf = NULL; } if (z_samples) { delete z_samples; - z_samples = nullptr; + z_samples = NULL; } if (z_gradients) { delete z_gradients; - z_gradients = nullptr; + z_gradients = NULL; } if (czar_gradients) { delete czar_gradients; - czar_gradients = nullptr; + czar_gradients = NULL; } if (czar_pmf) { delete czar_pmf; - czar_pmf = nullptr; + czar_pmf = NULL; } // shared ABF @@ -299,17 +299,17 @@ colvarbias_abf::~colvarbias_abf() // but now we can call shared externally if (last_samples) { delete last_samples; - last_samples = nullptr; + last_samples = NULL; } if (last_gradients) { delete last_gradients; - last_gradients = nullptr; + last_gradients = NULL; } if (system_force) { delete [] system_force; - system_force = nullptr; + system_force = NULL; } } @@ -488,7 +488,7 @@ int colvarbias_abf::update() } /// Add the bias energy for 1D ABF - bias_energy = calc_energy(nullptr); + bias_energy = calc_energy(NULL); return COLVARS_OK; } diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 44862ba256..92985b0f61 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -15,7 +15,7 @@ colvarbias_histogram::colvarbias_histogram(char const *key) : colvarbias(key), - grid(nullptr), out_name("") + grid(NULL), out_name("") { provide(f_cvb_bypass_ext_lagrangian); // Allow histograms of actual cv for extended-Lagrangian } @@ -105,7 +105,7 @@ colvarbias_histogram::~colvarbias_histogram() { if (grid) { delete grid; - grid = nullptr; + grid = NULL; } } diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 03c1886a8f..05f293d872 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key) : colvarbias(key), colvarbias_ti(key) { new_hills_begin = hills.end(); - hills_traj_os = nullptr; + hills_traj_os = NULL; hill_width = 0.0; @@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key) use_grids = true; grids_freq = 0; rebin_grids = false; - hills_energy = nullptr; - hills_energy_gradients = nullptr; + hills_energy = NULL; + hills_energy_gradients = NULL; dump_fes = true; keep_hills = false; @@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf) get_keyval(conf, "keepHills", keep_hills, keep_hills); get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save); - if (hills_energy == nullptr) { + if (hills_energy == NULL) { hills_energy = new colvar_grid_scalar(colvars); hills_energy_gradients = new colvar_grid_gradient(colvars); } @@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf) int colvarbias_meta::init_ebmeta_params(std::string const &conf) { // for ebmeta - target_dist = nullptr; + target_dist = NULL; get_keyval(conf, "ebMeta", ebmeta, false); if(ebmeta){ if (use_grids && expand_grids) { @@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta() if (hills_traj_os) { proxy->close_output_stream(hills_traj_file_name()); - hills_traj_os = nullptr; + hills_traj_os = NULL; } if (target_dist) { delete target_dist; - target_dist = nullptr; + target_dist = NULL; } } @@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data() { if (hills_energy) { delete hills_energy; - hills_energy = nullptr; + hills_energy = NULL; } if (hills_energy_gradients) { delete hills_energy_gradients; - hills_energy_gradients = nullptr; + hills_energy_gradients = NULL; } hills.clear(); @@ -451,8 +451,8 @@ int colvarbias_meta::update() error_code |= replica_share(); } - error_code |= calc_energy(nullptr); - error_code |= calc_forces(nullptr); + error_code |= calc_energy(NULL); + error_code |= calc_forces(NULL); return error_code; } @@ -593,7 +593,7 @@ int colvarbias_meta::update_bias() std::vector curr_bin = hills_energy->get_colvars_index(); hills_energy_sum_here = hills_energy->value(curr_bin); } else { - calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr); + calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL); } hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann())); } @@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first, std::vector colvar_forces_scalar(num_variables()); std::vector he_ix = he->new_index(); - std::vector hg_ix = (hg != nullptr) ? hg->new_index() : std::vector (0); + std::vector hg_ix = (hg != NULL) ? hg->new_index() : std::vector (0); cvm::real hills_energy_here = 0.0; std::vector hills_forces_here(num_variables(), 0.0); size_t count = 0; size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1))); - if (hg != nullptr) { + if (hg != NULL) { // loop over the points of the grid for ( ; @@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) hills_energy_gradients = new colvar_grid_gradient(colvars); } - colvar_grid_scalar *hills_energy_backup = nullptr; - colvar_grid_gradient *hills_energy_gradients_backup = nullptr; + colvar_grid_scalar *hills_energy_backup = NULL; + colvar_grid_gradient *hills_energy_gradients_backup = NULL; if (has_data) { if (cvm::debug()) @@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_pos = is.tellg(); std::string key; if (!(is >> key)) { - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == nullptr) + if (hills_energy_backup == NULL) cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const hills_energy_gradients_pos = is.tellg(); if (!(is >> key)) { - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { delete hills_energy; delete hills_energy_gradients; hills_energy = hills_energy_backup; @@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) is.seekg(hills_energy_gradients_pos, std::ios::beg); grids_from_restart_file = false; if (!rebin_grids) { - if (hills_energy_backup == nullptr) + if (hills_energy_backup == NULL) cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+ this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n"); - if (hills_energy_backup != nullptr) { + if (hills_energy_backup != NULL) { // now that we have successfully updated the grids, delete the // backup copies if (cvm::debug()) @@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output() // TODO: one may want to specify the path manually for intricated filesystems? char *pwd = new char[3001]; - if (GETCWD(pwd, 3000) == nullptr) + if (GETCWD(pwd, 3000) == NULL) cvm::fatal_error("Error: cannot get the path of the current working directory.\n"); replica_list_file = (std::string(pwd)+std::string(PATHSEP)+ @@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file() { int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; - if (proxy->get_output_stream(replica_hills_file) != nullptr) { + if (proxy->get_output_stream(replica_hills_file) != NULL) { error_code |= proxy->close_output_stream(replica_hills_file); } error_code |= proxy->remove_file(replica_hills_file); diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index d45d85111a..05d1195d58 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -135,7 +135,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf, char const *group_key, bool optional) { - cvm::atom_group *group = nullptr; + cvm::atom_group *group = NULL; std::string group_conf; if (key_lookup(conf, group_key, &group_conf)) { @@ -298,7 +298,7 @@ colvar::cvc::~cvc() free_children_deps(); remove_all_children(); for (size_t i = 0; i < atom_groups.size(); i++) { - if (atom_groups[i] != nullptr) delete atom_groups[i]; + if (atom_groups[i] != NULL) delete atom_groups[i]; } } @@ -344,7 +344,7 @@ colvarvalue const *colvar::cvc::get_param_grad(std::string const ¶m_name) { colvarvalue const *ptr = reinterpret_cast(get_param_grad_ptr(param_name)); - return ptr != nullptr ? ptr : nullptr; + return ptr != NULL ? ptr : NULL; } @@ -553,7 +553,7 @@ void colvar::cvc::debug_gradients() } } - if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != nullptr)) { + if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) { cvm::atom_group *ref_group = group->fitting_group; group->read_positions(); group->calc_required_properties(); diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index f36d055528..f0fbabfc4f 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -91,7 +91,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0, colvar::coordnum::coordnum(std::string const &conf) - : cvc(conf), b_anisotropic(false), pairlist(nullptr) + : cvc(conf), b_anisotropic(false), pairlist(NULL) { function_type = "coordnum"; @@ -102,7 +102,7 @@ colvar::coordnum::coordnum(std::string const &conf) group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); - if (group1 == nullptr || group2 == nullptr) { + if (group1 == NULL || group2 == NULL) { cvm::error("Error: failed to initialize atom groups.\n", INPUT_ERROR); return; @@ -183,7 +183,7 @@ colvar::coordnum::coordnum(std::string const &conf) colvar::coordnum::~coordnum() { - if (pairlist != nullptr) { + if (pairlist != NULL) { delete [] pairlist; } } @@ -218,11 +218,11 @@ template void colvar::coordnum::main_loop(bool **pairlist_elem) template int colvar::coordnum::compute_coordnum() { - bool const use_pairlist = (pairlist != nullptr); - bool const rebuild_pairlist = (pairlist != nullptr) && + bool const use_pairlist = (pairlist != NULL); + bool const rebuild_pairlist = (pairlist != NULL) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : nullptr; + bool *pairlist_elem = use_pairlist ? pairlist : NULL; if (b_anisotropic) { @@ -239,7 +239,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags | ef_anisotropic; - main_loop(nullptr); + main_loop(NULL); } } else { @@ -257,7 +257,7 @@ template int colvar::coordnum::compute_coordnum() } else { int const flags = compute_flags; - main_loop(nullptr); + main_loop(NULL); } } @@ -367,7 +367,7 @@ void colvar::h_bond::calc_value() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - nullptr, 0.0); + NULL, 0.0); } @@ -378,7 +378,7 @@ void colvar::h_bond::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, (*atom_groups[0])[0], (*atom_groups[0])[1], - nullptr, 0.0); + NULL, 0.0); } @@ -393,7 +393,7 @@ simple_scalar_dist_functions(h_bond) colvar::selfcoordnum::selfcoordnum(std::string const &conf) - : cvc(conf), pairlist(nullptr) + : cvc(conf), pairlist(NULL) { function_type = "selfcoordnum"; x.type(colvarvalue::type_scalar); @@ -438,7 +438,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf) colvar::selfcoordnum::~selfcoordnum() { - if (pairlist != nullptr) { + if (pairlist != NULL) { delete [] pairlist; } } @@ -448,11 +448,11 @@ template int colvar::selfcoordnum::compute_selfcoordnum() { cvm::rvector const r0_vec(0.0); // TODO enable the flag? - bool const use_pairlist = (pairlist != nullptr); - bool const rebuild_pairlist = (pairlist != nullptr) && + bool const use_pairlist = (pairlist != NULL); + bool const rebuild_pairlist = (pairlist != NULL) && (cvm::step_relative() % pairlist_freq == 0); - bool *pairlist_elem = use_pairlist ? pairlist : nullptr; + bool *pairlist_elem = use_pairlist ? pairlist : NULL; size_t i = 0, j = 0; size_t const n = group1->size(); @@ -601,13 +601,13 @@ void colvar::groupcoordnum::calc_value() x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } else { int const flags = coordnum::ef_null; x.real_value = coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } } @@ -624,13 +624,13 @@ void colvar::groupcoordnum::calc_gradients() coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } else { int const flags = coordnum::ef_gradients; coordnum::switching_function(r0, r0_vec, en, ed, group1_com_atom, group2_com_atom, - nullptr, 0.0); + NULL, 0.0); } group1->set_weighted_gradient(group1_com_atom.grad); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index 88a5088aaf..c3c1ee55d5 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -964,7 +964,7 @@ colvar::rmsd::rmsd(std::string const &conf) } bool b_Jacobian_derivative = true; - if (atoms->fitting_group != nullptr && b_Jacobian_derivative) { + if (atoms->fitting_group != NULL && b_Jacobian_derivative) { cvm::log("The option \"fittingGroup\" (alternative group for fitting) was enabled: " "Jacobian derivatives of the RMSD will not be calculated.\n"); b_Jacobian_derivative = false; diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index f647211f6e..f83458b51c 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -33,7 +33,7 @@ colvardeps::~colvardeps() { // Do not delete features if it's a static object // may change in the future though // for (i=0; i &colvars, {} colvar_grid_scalar::colvar_grid_scalar() - : colvar_grid(), samples(nullptr) + : colvar_grid(), samples(NULL) {} colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g) - : colvar_grid(g), samples(nullptr) + : colvar_grid(g), samples(NULL) { } colvar_grid_scalar::colvar_grid_scalar(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, 1), samples(nullptr) + : colvar_grid(nx_i, 0.0, 1), samples(NULL) { } colvar_grid_scalar::colvar_grid_scalar(std::vector &colvars, bool margin) - : colvar_grid(colvars, 0.0, 1, margin), samples(nullptr) + : colvar_grid(colvars, 0.0, 1, margin), samples(NULL) { } @@ -122,15 +122,15 @@ cvm::real colvar_grid_scalar::entropy() const colvar_grid_gradient::colvar_grid_gradient() - : colvar_grid(), samples(nullptr) + : colvar_grid(), samples(NULL) {} colvar_grid_gradient::colvar_grid_gradient(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, nx_i.size()), samples(nullptr) + : colvar_grid(nx_i, 0.0, nx_i.size()), samples(NULL) {} colvar_grid_gradient::colvar_grid_gradient(std::vector &colvars) - : colvar_grid(colvars, 0.0, colvars.size()), samples(nullptr) + : colvar_grid(colvars, 0.0, colvars.size()), samples(NULL) {} void colvar_grid_gradient::write_1D_integral(std::ostream &os) diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 48a38a6076..1d5f75bbca 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -30,11 +30,11 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) depth_s = 0; log_level_ = 10; - cv_traj_os = nullptr; + cv_traj_os = NULL; xyz_reader_use_count = 0; - if (proxy == nullptr) { + if (proxy == NULL) { proxy = proxy_in; // Pointer to the proxy object parse = new colvarparse(); // Parsing object for global options version_int = proxy->get_version_from_string(COLVARS_VERSION); @@ -573,7 +573,7 @@ colvarbias * colvarmodule::bias_by_name(std::string const &name) return (*bi); } } - return nullptr; + return NULL; } @@ -587,7 +587,7 @@ colvar *colvarmodule::colvar_by_name(std::string const &name) return (*cvi); } } - return nullptr; + return NULL; } @@ -601,7 +601,7 @@ cvm::atom_group *colvarmodule::atom_group_by_name(std::string const &name) return (*agi); } } - return nullptr; + return NULL; } @@ -631,7 +631,7 @@ int colvarmodule::change_configuration(std::string const &bias_name, cvm::increase_depth(); colvarbias *b; b = bias_by_name(bias_name); - if (b == nullptr) { + if (b == NULL) { cvm::error("Error: bias not found: " + bias_name); return COLVARS_ERROR; } @@ -647,7 +647,7 @@ std::string colvarmodule::read_colvar(std::string const &name) colvar *c; std::stringstream ss; c = colvar_by_name(name); - if (c == nullptr) { + if (c == NULL) { cvm::error("Error: colvar not found: " + name); return std::string(); } @@ -663,7 +663,7 @@ cvm::real colvarmodule::energy_difference(std::string const &bias_name, colvarbias *b; cvm::real energy_diff = 0.; b = bias_by_name(bias_name); - if (b == nullptr) { + if (b == NULL) { cvm::error("Error: bias not found: " + bias_name); return 0.; } @@ -678,7 +678,7 @@ int colvarmodule::bias_current_bin(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->current_bin(); } else { cvm::error("Error: bias not found.\n"); @@ -695,7 +695,7 @@ int colvarmodule::bias_bin_num(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->bin_num(); } else { cvm::error("Error: bias not found.\n"); @@ -712,7 +712,7 @@ int colvarmodule::bias_bin_count(std::string const &bias_name, size_t bin_index) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { ret = b->bin_count(bin_index); } else { cvm::error("Error: bias not found.\n"); @@ -729,7 +729,7 @@ int colvarmodule::bias_share(std::string const &bias_name) int ret; colvarbias *b = bias_by_name(bias_name); - if (b != nullptr) { + if (b != NULL) { b->replica_share(); ret = COLVARS_OK; } else { @@ -1037,7 +1037,7 @@ int colvarmodule::write_restart_file(std::string const &out_name) int colvarmodule::write_traj_files() { - if (cv_traj_os == nullptr) { + if (cv_traj_os == NULL) { if (open_traj_file(cv_traj_name) != COLVARS_OK) { return cvm::get_error(); } else { @@ -1057,7 +1057,7 @@ int colvarmodule::write_traj_files() write_traj(*cv_traj_os); } - if (restart_out_freq && (cv_traj_os != nullptr)) { + if (restart_out_freq && (cv_traj_os != NULL)) { // flush the trajectory file if we are at the restart frequency if ( (cvm::step_relative() > 0) && ((cvm::step_absolute() % restart_out_freq) == 0) ) { @@ -1151,8 +1151,8 @@ colvarmodule::~colvarmodule() atom_group::delete_features(); delete parse; - parse = nullptr; - proxy = nullptr; + parse = NULL; + proxy = NULL; } } @@ -1184,7 +1184,7 @@ int colvarmodule::reset() proxy->reset(); - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { // Do not close traj file here, as we might not be done with it yet. proxy->flush_output_stream(cv_traj_os); } @@ -1395,7 +1395,7 @@ std::istream & colvarmodule::read_objects_state(std::istream &is) if (static_cast(is.tellg()) == pos) { // This block has not been read by any object: discard it and move on // to the next one - is >> colvarparse::read_block(word, nullptr); + is >> colvarparse::read_block(word, NULL); } if (!is) break; @@ -1456,7 +1456,7 @@ int colvarmodule::write_output_files() } cvm::decrease_depth(); - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { // do not close, there may be another run command proxy->flush_output_stream(cv_traj_os); } @@ -1575,7 +1575,7 @@ std::ostream & colvarmodule::write_restart(std::ostream &os) int colvarmodule::open_traj_file(std::string const &file_name) { - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { return COLVARS_OK; } @@ -1591,7 +1591,7 @@ int colvarmodule::open_traj_file(std::string const &file_name) cv_traj_os = (cvm::proxy)->output_stream(file_name); } - if (cv_traj_os == nullptr) { + if (cv_traj_os == NULL) { cvm::error("Error: cannot write to file \""+file_name+"\".\n", FILE_ERROR); } @@ -1602,9 +1602,9 @@ int colvarmodule::open_traj_file(std::string const &file_name) int colvarmodule::close_traj_file() { - if (cv_traj_os != nullptr) { + if (cv_traj_os != NULL) { proxy->close_output_stream(cv_traj_name); - cv_traj_os = nullptr; + cv_traj_os = NULL; } return cvm::get_error(); } @@ -1672,7 +1672,7 @@ void cvm::log(std::string const &message, int min_log_level) { if (cvm::log_level() < min_log_level) return; // allow logging when the module is not fully initialized - size_t const d = (cvm::main() != nullptr) ? depth() : 0; + size_t const d = (cvm::main() != NULL) ? depth() : 0; if (d > 0) { proxy->log((std::string(2*d, ' '))+message); } else { @@ -1780,7 +1780,7 @@ int cvm::read_index_file(char const *filename) } if (index_of_group < 0) { index_group_names.push_back(group_name); - index_groups.push_back(nullptr); + index_groups.push_back(NULL); index_of_group = index_groups.size()-1; } } else { @@ -1799,7 +1799,7 @@ int cvm::read_index_file(char const *filename) pos = is.tellg(); } - if (old_index_group != nullptr) { + if (old_index_group != NULL) { bool equal = false; if (new_index_group->size() == old_index_group->size()) { if (std::equal(new_index_group->begin(), new_index_group->end(), @@ -1810,13 +1810,13 @@ int cvm::read_index_file(char const *filename) if (! equal) { new_index_group->clear(); delete new_index_group; - new_index_group = nullptr; + new_index_group = NULL; return cvm::error("Error: the index group \""+group_name+ "\" was redefined.\n", INPUT_ERROR); } else { old_index_group->clear(); delete old_index_group; - old_index_group = nullptr; + old_index_group = NULL; } } @@ -1850,7 +1850,7 @@ int colvarmodule::reset_index_groups() size_t i = 0; for ( ; i < index_groups.size(); i++) { delete index_groups[i]; - index_groups[i] = nullptr; + index_groups[i] = NULL; } index_group_names.clear(); index_groups.clear(); @@ -2179,7 +2179,7 @@ std::string cvm::wrap_string(std::string const &s, size_t nchars) // shared pointer to the proxy object -colvarproxy *colvarmodule::proxy = nullptr; +colvarproxy *colvarmodule::proxy = NULL; // static runtime data cvm::real colvarmodule::debug_gradients_step_size = 1.0e-07; diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index e06f05aca0..9346e8e1d6 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -459,13 +459,13 @@ public: /// Backup a file before writing it static int backup_file(char const *filename); - /// Look up a bias by name; returns nullptr if not found + /// Look up a bias by name; returns NULL if not found static colvarbias * bias_by_name(std::string const &name); - /// Look up a colvar by name; returns nullptr if not found + /// Look up a colvar by name; returns NULL if not found static colvar * colvar_by_name(std::string const &name); - /// Look up a named atom group by name; returns nullptr if not found + /// Look up a named atom group by name; returns NULL if not found static atom_group * atom_group_by_name(std::string const &name); /// Load new configuration for the given bias - diff --git a/lib/colvars/colvarparams.cpp b/lib/colvars/colvarparams.cpp index ea45c01104..e957a1841d 100644 --- a/lib/colvars/colvarparams.cpp +++ b/lib/colvars/colvarparams.cpp @@ -76,7 +76,7 @@ void const *colvarparams::get_param_ptr(std::string const ¶m_name) return param_map[param_name]; } cvm::error("Error: parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return nullptr; + return NULL; } @@ -87,7 +87,7 @@ void const *colvarparams::get_param_grad_ptr(std::string const ¶m_name) } cvm::error("Error: gradient of parameter \""+param_name+"\" not found.\n", INPUT_ERROR); - return nullptr; + return NULL; } @@ -95,7 +95,7 @@ cvm::real colvarparams::get_param(std::string const ¶m_name) { cvm::real const *ptr = reinterpret_cast(get_param_ptr(param_name)); - return ptr != nullptr ? *ptr : 0.0; + return ptr != NULL ? *ptr : 0.0; } diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index e61ebf355f..a09d6be9ef 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -674,12 +674,12 @@ bool colvarparse::key_lookup(std::string const &conf, std::string const conf_lower(to_lower_cppstr(conf)); // by default, there is no value, unless we found one - if (data != nullptr) { + if (data != NULL) { data->clear(); } // start from the first occurrence of key - size_t pos = conf_lower.find(key, (save_pos != nullptr) ? *save_pos : 0); + size_t pos = conf_lower.find(key, (save_pos != NULL) ? *save_pos : 0); // iterate over all instances of the substring until it finds it as isolated keyword while (true) { @@ -727,7 +727,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != nullptr) { + if (save_pos != NULL) { // save the pointer for a future call (when iterating over multiple // valid instances of the same keyword) *save_pos = pos + key.size(); @@ -820,7 +820,7 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != nullptr) { + if (data != NULL) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) { @@ -834,7 +834,7 @@ bool colvarparse::key_lookup(std::string const &conf, } } - if (save_pos != nullptr) *save_pos = line_end; + if (save_pos != NULL) *save_pos = line_end; return true; } diff --git a/lib/colvars/colvarparse.h b/lib/colvars/colvarparse.h index fc1362b2b1..b7d42fdffa 100644 --- a/lib/colvars/colvarparse.h +++ b/lib/colvars/colvarparse.h @@ -275,12 +275,12 @@ public: /// The keyword that identifies the block std::string const key; - /// Where to keep the data (may be nullptr) + /// Where to keep the data (may be NULL) std::string * const data; public: - read_block(std::string const &key_in, std::string *data_in = nullptr); + read_block(std::string const &key_in, std::string *data_in = NULL); ~read_block(); @@ -300,8 +300,8 @@ public: /// within "conf", useful when doing multiple calls bool key_lookup(std::string const &conf, char const *key, - std::string *data = nullptr, - size_t *save_pos = nullptr); + std::string *data = NULL, + size_t *save_pos = NULL); /// \brief Reads a configuration line, adds it to config_string, and returns /// the stream \param is Input stream \param line String that will hold the diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 7eb0b22cb5..63ae07a57c 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -296,7 +296,7 @@ void colvarproxy_atom_groups::clear_atom_group(int index) colvarproxy_smp::colvarproxy_smp() { b_smp_active = true; // May be disabled by user option - omp_lock_state = nullptr; + omp_lock_state = NULL; #if defined(_OPENMP) if (smp_thread_id() == 0) { omp_lock_state = reinterpret_cast(new omp_lock_t); @@ -459,7 +459,7 @@ int colvarproxy_smp::smp_unlock() colvarproxy_script::colvarproxy_script() { - script = nullptr; + script = NULL; } @@ -507,7 +507,7 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name colvarproxy_tcl::colvarproxy_tcl() { - tcl_interp_ = nullptr; + tcl_interp_ = NULL; } @@ -528,7 +528,7 @@ char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj) #if defined(COLVARS_TCL) return Tcl_GetString(reinterpret_cast(obj)); #else - return nullptr; + return NULL; #endif } @@ -666,7 +666,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, } std::ostream *os = get_output_stream(output_name); - if (os != nullptr) return os; + if (os != NULL) return os; if (!(mode & (std::ios_base::app | std::ios_base::ate))) { backup_file(output_name); @@ -675,7 +675,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name, if (!osf->is_open()) { cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n", FILE_ERROR); - return nullptr; + return NULL; } output_stream_names.push_back(output_name); output_files.push_back(osf); @@ -692,7 +692,7 @@ std::ostream *colvarproxy_io::get_output_stream(std::string const &output_name) return *osi; } } - return nullptr; + return NULL; } @@ -794,7 +794,7 @@ int colvarproxy_io::rename_file(char const *filename, char const *newfilename) colvarproxy::colvarproxy() { - colvars = nullptr; + colvars = NULL; b_simulation_running = true; b_delete_requested = false; } diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index a46589a526..ba91afb40e 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -607,7 +607,7 @@ public: std::ios_base::openmode mode = std::ios_base::out); - /// Returns a reference to output_name if it exists, nullptr otherwise + /// Returns a reference to output_name if it exists, NULL otherwise virtual std::ostream *get_output_stream(std::string const &output_name); /// \brief Flushes the given output channel diff --git a/lib/colvars/colvarscript.cpp b/lib/colvars/colvarscript.cpp index a8b5d6ab2f..10b276c89e 100644 --- a/lib/colvars/colvarscript.cpp +++ b/lib/colvars/colvarscript.cpp @@ -97,7 +97,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvar *cv = cvm::colvar_by_name(name); - if (cv == nullptr) { + if (cv == NULL) { result = "Colvar not found: " + name; return COLVARSCRIPT_ERROR; } @@ -111,7 +111,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } std::string const name(obj_to_str(objv[2])); colvarbias *b = cvm::bias_by_name(name); - if (b == nullptr) { + if (b == NULL) { result = "Bias not found: " + name; return COLVARSCRIPT_ERROR; } @@ -186,7 +186,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) /// Parse config from string if (cmd == "config") { - return exec_command(cv_config, nullptr, objc, objv); + return exec_command(cv_config, NULL, objc, objv); } /// Load an input state file @@ -247,7 +247,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } else if (objc == 3) { // Failure of this function does not trigger an error, but // returns nonzero, to let scripts detect available frames - int error = proxy->set_frame(strtol(obj_to_str(objv[2]), nullptr, 10)); + int error = proxy->set_frame(strtol(obj_to_str(objv[2]), NULL, 10)); result = cvm::to_str(error == COLVARS_OK ? 0 : -1); return COLVARS_OK; } else { @@ -258,7 +258,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) if (cmd == "addenergy") { if (objc == 3) { - colvars->total_bias_energy += strtod(obj_to_str(objv[2]), nullptr); + colvars->total_bias_energy += strtod(obj_to_str(objv[2]), NULL); return COLVARS_OK; } else { result = "Wrong arguments to command \"addenergy\"\n" + help_string(); @@ -267,7 +267,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } if (cmd == "help") { - return exec_command(cv_help, nullptr, objc, objv); + return exec_command(cv_help, NULL, objc, objv); } result = "Syntax error\n" + help_string(); @@ -320,7 +320,7 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[]) // colvar destructor is tasked with the cleanup delete cv; // TODO this could be done by the destructors - if (colvars->cv_traj_os != nullptr) { + if (colvars->cv_traj_os != NULL) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -513,7 +513,7 @@ int colvarscript::proc_bias(colvarbias *b, int objc, unsigned char *const objv[] // the bias destructor takes care of the cleanup at cvm level delete b; // TODO this could be done by the destructors - if (colvars->cv_traj_os != nullptr) { + if (colvars->cv_traj_os != NULL) { colvars->write_traj_label(*(colvars->cv_traj_os)); } return COLVARS_OK; @@ -564,7 +564,7 @@ int colvarscript::proc_features(colvardeps *obj, if ((subcmd == "get") || (subcmd == "set")) { std::vector const &features = obj->features(); std::string const req_feature(obj_to_str(objv[3])); - colvardeps::feature *f = nullptr; + colvardeps::feature *f = NULL; int fid = 0; for (fid = 0; fid < int(features.size()); fid++) { if (features[fid]->description == @@ -574,7 +574,7 @@ int colvarscript::proc_features(colvardeps *obj, } } - if (f == nullptr) { + if (f == NULL) { result = "Error: feature \""+req_feature+"\" does not exist.\n"; return COLVARSCRIPT_ERROR; diff --git a/lib/colvars/colvarscript.h b/lib/colvars/colvarscript.h index 04679b37ad..69d52cbb51 100644 --- a/lib/colvars/colvarscript.h +++ b/lib/colvars/colvarscript.h @@ -278,7 +278,7 @@ extern "C" { 1, 1, { "E (float) - Amount of energy to add" }, cvm::main()->total_bias_energy += - strtod(script->obj_to_str(objv[2]), nullptr); + strtod(script->obj_to_str(objv[2]), NULL); return COLVARS_OK; ) diff --git a/lib/colvars/colvartypes.h b/lib/colvars/colvartypes.h index 55401576b1..e5f12154e6 100644 --- a/lib/colvars/colvartypes.h +++ b/lib/colvars/colvartypes.h @@ -59,7 +59,7 @@ public: if (data.size() > 0) { return &(data[0]); } else { - return nullptr; + return NULL; } } @@ -520,7 +520,7 @@ public: if (rows.size() > 0) { return &(pointers[0]); } else { - return nullptr; + return NULL; } } diff --git a/lib/colvars/lepton/include/lepton/Operation.h b/lib/colvars/lepton/include/lepton/Operation.h index 68474137f1..1ddde0b8c0 100644 --- a/lib/colvars/lepton/include/lepton/Operation.h +++ b/lib/colvars/lepton/include/lepton/Operation.h @@ -186,7 +186,7 @@ public: } bool operator!=(const Operation& op) const { const Constant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -217,7 +217,7 @@ public: ExpressionTreeNode differentiate(const std::vector& children, const std::vector& childDerivs, const std::string& variable) const; bool operator!=(const Operation& op) const { const Variable* o = dynamic_cast(&op); - return (o == nullptr || o->name != name); + return (o == NULL || o->name != name); } private: std::string name; @@ -264,7 +264,7 @@ public: } bool operator!=(const Operation& op) const { const Custom* o = dynamic_cast(&op); - return (o == nullptr || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); + return (o == NULL || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder); } private: std::string name; @@ -955,7 +955,7 @@ public: } bool operator!=(const Operation& op) const { const AddConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -988,7 +988,7 @@ public: } bool operator!=(const Operation& op) const { const MultiplyConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } private: double value; @@ -1042,7 +1042,7 @@ public: } bool operator!=(const Operation& op) const { const PowerConstant* o = dynamic_cast(&op); - return (o == nullptr || o->value != value); + return (o == NULL || o->value != value); } bool isInfixOperator() const { return true; diff --git a/lib/colvars/lepton/src/CompiledExpression.cpp b/lib/colvars/lepton/src/CompiledExpression.cpp index 6abcad2de2..1ad348b47d 100644 --- a/lib/colvars/lepton/src/CompiledExpression.cpp +++ b/lib/colvars/lepton/src/CompiledExpression.cpp @@ -40,10 +40,10 @@ using namespace std; using namespace asmjit; #endif -CompiledExpression::CompiledExpression() : jitCode(nullptr) { +CompiledExpression::CompiledExpression() : jitCode(NULL) { } -CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(nullptr) { +CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(NULL) { ParsedExpression expr = expression.optimize(); // Just in case it wasn't already optimized. vector > temps; compileExpression(expr.getRootNode(), temps); @@ -59,11 +59,11 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit CompiledExpression::~CompiledExpression() { for (int i = 0; i < (int) operation.size(); i++) - if (operation[i] != nullptr) + if (operation[i] != NULL) delete operation[i]; } -CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(nullptr) { +CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(NULL) { *this = expression; } diff --git a/lib/colvars/lepton/src/ExpressionTreeNode.cpp b/lib/colvars/lepton/src/ExpressionTreeNode.cpp index 09c5352d20..8519878262 100644 --- a/lib/colvars/lepton/src/ExpressionTreeNode.cpp +++ b/lib/colvars/lepton/src/ExpressionTreeNode.cpp @@ -59,14 +59,14 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati throw Exception("wrong number of arguments to function: "+operation->getName()); } -ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == nullptr ? nullptr : node.operation->clone()), children(node.getChildren()) { +ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) { } -ExpressionTreeNode::ExpressionTreeNode() : operation(nullptr) { +ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) { } ExpressionTreeNode::~ExpressionTreeNode() { - if (operation != nullptr) + if (operation != NULL) delete operation; } @@ -91,7 +91,7 @@ bool ExpressionTreeNode::operator==(const ExpressionTreeNode& node) const { } ExpressionTreeNode& ExpressionTreeNode::operator=(const ExpressionTreeNode& node) { - if (operation != nullptr) + if (operation != NULL) delete operation; operation = node.getOperation().clone(); children = node.getChildren(); diff --git a/lib/colvars/lepton/src/ParsedExpression.cpp b/lib/colvars/lepton/src/ParsedExpression.cpp index c259756346..fd3b091d3c 100644 --- a/lib/colvars/lepton/src/ParsedExpression.cpp +++ b/lib/colvars/lepton/src/ParsedExpression.cpp @@ -46,7 +46,7 @@ ParsedExpression::ParsedExpression(const ExpressionTreeNode& rootNode) : rootNod } const ExpressionTreeNode& ParsedExpression::getRootNode() const { - if (&rootNode.getOperation() == nullptr) + if (&rootNode.getOperation() == NULL) throw Exception("Illegal call to an initialized ParsedExpression"); return rootNode; } diff --git a/lib/kokkos/cmake/compile_tests/pthread.cpp b/lib/kokkos/cmake/compile_tests/pthread.cpp index 7fa98611be..92310da029 100644 --- a/lib/kokkos/cmake/compile_tests/pthread.cpp +++ b/lib/kokkos/cmake/compile_tests/pthread.cpp @@ -4,11 +4,11 @@ void* kokkos_test(void* args) { return args; } int main(void) { pthread_t thread; - /* Use nullptr to avoid C++11. Some compilers + /* Use NULL to avoid C++11. Some compilers do not have C++11 by default. Forcing C++11 in the compile tests can be done, but is unnecessary */ - pthread_create(&thread, nullptr, kokkos_test, nullptr); - pthread_join(thread, nullptr); + pthread_create(&thread, NULL, kokkos_test, NULL); + pthread_join(thread, NULL); return 0; } diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index d4db2c538d..a97fb2f7cc 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -640,7 +640,7 @@ void SharedAllocationRecord:: /*--------------------------------------------------------------------------*/ void* hip_resize_scratch_space(size_t bytes, bool force_shrink) { - static void* ptr = nullptr; + static void* ptr = NULL; static size_t current_size = 0; if (current_size == 0) { current_size = bytes; diff --git a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp index 613793fc60..fad36c02f1 100644 --- a/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp @@ -139,7 +139,7 @@ void *HBWSpace::allocate(const char *arg_label, const size_t arg_alloc_size, } msg << " ]( " << arg_alloc_size << " ) FAILED"; if (ptr == nullptr) { - msg << " NULL"; + msg << " nullptr"; } else { msg << " NOT ALIGNED " << ptr; } diff --git a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp index 2b11adbf6d..a9a2778813 100644 --- a/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp @@ -215,7 +215,7 @@ SharedAllocationRecord::SharedAllocationRecord( } else { Kokkos::Impl::throw_runtime_exception( - "Kokkos::Impl::SharedAllocationRecord given NULL allocation"); + "Kokkos::Impl::SharedAllocationRecord given nullptr allocation"); } } diff --git a/lib/kokkos/core/unit_test/TestCTestDevice.cpp b/lib/kokkos/core/unit_test/TestCTestDevice.cpp index c54c75f94b..b2ee79b856 100644 --- a/lib/kokkos/core/unit_test/TestCTestDevice.cpp +++ b/lib/kokkos/core/unit_test/TestCTestDevice.cpp @@ -13,7 +13,7 @@ int setenv(const char *name, const char *value, int overwrite) { int errcode = 0; if (!overwrite) { size_t envsize = 0; - errcode = getenv_s(&envsize, nullptr, 0, name); + errcode = getenv_s(&envsize, NULL, 0, name); if (errcode || envsize) return errcode; } return _putenv_s(name, value); -- GitLab From ed57554e186af6b3f0392fdbc2e617ee735b59be Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 09:54:15 -0600 Subject: [PATCH 11/21] T2345: Replace instances of NULL with nullptr revert lib/poems to remove nullptr changes. Walking back changes to lib as needed. --- lib/poems/SystemProcessor.h | 30 +++++++++--------- lib/poems/poemsnodelib.h | 20 ++++++------ lib/poems/poemstree.h | 62 ++++++++++++++++++------------------- lib/poems/poemstreenode.cpp | 2 +- lib/poems/poemstreenode.h | 2 +- lib/poems/solver.cpp | 2 +- lib/poems/system.cpp | 10 +++--- lib/poems/workspace.cpp | 6 ++-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index c1c45a86a7..4fc8785dd7 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != nullptr) + if(currentNode != NULL) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != nullptr); //repeat this until all chains have been added + while(currentNode != NULL); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null + if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null { - return nullptr; + return NULL; } int * tmp; - POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = nullptr; //temporary variable to hold data - while(tempNode != nullptr) //when we have followed all links, stop + POEMSChain * tempChain = NULL; //temporary variable to hold data + while(tempNode != NULL) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == nullptr) + if(aNode == NULL) { - return nullptr; + return NULL; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == nullptr) //and if we find nothing... + if(returnVal == NULL) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == nullptr) //if we could not find any chains + if(returnVal == NULL) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be nullptr if no new chains are + return returnVal; //return what we find (will be NULL if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists + while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list + while(tmp->value != NULL || tmp2->value != NULL) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 04f0f4b79b..446fa2013f 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); +TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != nullptr) + if (t != NULL) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != nullptr) + if (t != NULL) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value nullptr +// The pointers have default value NULL TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == nullptr) + if (p == NULL) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=nullptr) + if(t !=NULL) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == nullptr && t->Right() == nullptr) + if (t->Left() == NULL && t->Right() == NULL) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == nullptr) + if (t == NULL) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=nullptr - if (t != nullptr) + //print tree with root t, as long as t!=NULL + if (t != NULL) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index 14f5fd4008..ee07a33255 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = nullptr); + void Insert(const int& item, const int& data, void * AuxData = NULL); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = nullptr; + DeleteAuxData = NULL; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return nullptr +// address and a pointer to its parent; otherwise, return NULL TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is nullptr - parent = nullptr; + // the parent of the root is NULL + parent = NULL; // terminate on empty subtree - while(t != nullptr) + while(t != NULL) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; nullptr if not found + // return pointer to node; NULL if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != nullptr) + if (current != NULL) { item = current->data; return current->GetAuxData(); } else // item not found in the tree. return False - return nullptr; + return NULL; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,nullptr,nullptr); + newNode = GetTreeNode(item,NULL,NULL); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == nullptr) + if (tree == NULL) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) + if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) return; - // If D has nullptr pointer, the + // If D has NULL pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == nullptr) + if (DNodePtr->right == NULL) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == nullptr) + else if (DNodePtr->left == NULL) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-nullptr + // Both pointers of DNodePtr are non-NULL else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != nullptr) + while (RNodePtr->right != NULL) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == nullptr) + if (PNodePtr == NULL) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=nullptr && current->data == item) + if (current !=NULL && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == nullptr) - return nullptr; + if (t == NULL) + return NULL; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns nullptr. + // present it makes a copy of left child or returns NULL. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=nullptr) + if (t->Left() !=NULL) newlptr = CopyTree(t->Left()); else - newlptr = nullptr; + newlptr = NULL; - if (t->Right() !=nullptr) + if (t->Right() !=NULL) newrptr = CopyTree(t->Right()); else - newrptr = nullptr; + newrptr = NULL; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != nullptr) { + if (t != NULL) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != nullptr) { - if (DeleteAuxData != nullptr) { + if (aux != NULL) { + if (DeleteAuxData != NULL) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to nullptr +// set the root pointer back to NULL void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = nullptr; // root now nullptr + t = NULL; // root now NULL } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 52905fc40f..051e13d6e0 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value nullptr assigns a empty subtree +// The pointer value NULL assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/poemstreenode.h b/lib/poems/poemstreenode.h index e5673344a9..a1835ba025 100644 --- a/lib/poems/poemstreenode.h +++ b/lib/poems/poemstreenode.h @@ -18,7 +18,7 @@ #ifndef TREENODE_H #define TREENODE_H -//#define nullptr 0 +//#define NULL 0 //Tree depends on TreeNode diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 7b1e718b93..67f5b607e3 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return nullptr; + default: return NULL; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 23554f4117..369213f7d0 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = nullptr; + mappings = NULL; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = nullptr; + Body* body = NULL; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = nullptr; + Point* point_ch = NULL; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = nullptr; + Body* body = NULL; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = nullptr; + Point* point_ch = NULL; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 21819d4c02..2b3257b0dd 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = nullptr; + system = NULL; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != nullptr) { + while(NodeValue != NULL) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return nullptr; + return NULL; } } -- GitLab From 96b01f2383a9d5571b7319f81c35eedda07f7c0e Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 10:24:51 -0600 Subject: [PATCH 12/21] T2345: Walking back nullptr changes to lib/awpmd --- lib/awpmd/ivutils/include/logexc.h | 8 +++--- lib/awpmd/ivutils/include/pairhash.h | 28 +++++++++---------- lib/awpmd/ivutils/include/refobj.h | 20 ++++++------- lib/awpmd/ivutils/include/vector_3.h | 14 +++++----- lib/awpmd/ivutils/src/logexc.cpp | 2 +- lib/awpmd/systems/interact/TCP/wpmd.h | 20 ++++++------- lib/awpmd/systems/interact/TCP/wpmd_split.cpp | 4 +-- lib/awpmd/systems/interact/TCP/wpmd_split.h | 16 +++++------ 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 2eebfcc0ce..7bf6125bc6 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(nullptr),next(nullptr){ + :descriptor(descriptor_),prev(NULL),next(NULL){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=nullptr; - prev=nullptr; + glogp->next=NULL; + prev=NULL; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index 0f79fc4184..c29f72773f 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(nullptr),incr(0){} + iterator():ptr(NULL),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(nullptr,1) { + recmatrix(): parr(NULL,1) { sizey=sizex=0; - arr=nullptr; + arr=NULL; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(nullptr,0); + parr.reset(NULL,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(nullptr),incr(0){} + iterator():ptr(NULL),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(nullptr,1) { + sqmatrix(): parr(NULL,1) { size=0; - arr=nullptr; + arr=NULL; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ + sqmatrix(const sqmatrix &other):size(0),arr(NULL){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(nullptr,0); + parr.reset(NULL,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not nullptr, puts the found value there - virtual int Find(long i, long j, T *retval=nullptr)=0; - virtual int Find(long i, long j, T **retval=nullptr)=0; + //e if retval is not NULL, puts the found value there + virtual int Find(long i, long j, T *retval=NULL)=0; + virtual int Find(long i, long j, T **retval=NULL)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=nullptr){ + int Find(long i, long j, T *retval=NULL){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index 8e5fc7df45..a1a4feb0ff 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=nullptr, int managed=0){ + void reset(T* ptr=NULL, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==nullptr than p is not managed (as in mngptr) + int *num; //if num==NULL than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=nullptr; + else num=NULL; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=nullptr; + else num=NULL; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=nullptr; + else num=NULL; } public: - shptr(T* p=nullptr, int managed=1){ + shptr(T* p=NULL, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=nullptr; + num=NULL; } - p=nullptr; + p=NULL; } } bool valid() const { - return p!=nullptr; + return p!=NULL; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 534cea44aa..468abbda99 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=nullptr) const { + T maxcoord(int *ind=NULL) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 6e809dd65c..7e82af0f65 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=nullptr; +message_logger *message_logger::glogp=NULL; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index 4c65440014..e118b76f36 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ + void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=nullptr )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); + /// Default (q=NULL )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=nullptr); + virtual int interaction_ii(int flag,Vector_3P fi=NULL); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 55105066de..2c58bdaf28 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be nullptr, \n +/// will not update electronic force arrays, which may be NULL, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 0ffef2645d..44fb757576 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); + /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be nullptr, \n + /// will not update electronic force arrays, which may be NULL, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, - Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); + int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, + Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n -- GitLab From 96f0e7e0d07dfa0045b5cf253c617c7d35770efe Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Fri, 11 Sep 2020 10:48:48 -0600 Subject: [PATCH 13/21] T2345: Walking back nullptr changes in #defines in STUBS/mpi.h --- src/STUBS/mpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 5df63682b7..063dc542be 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -50,7 +50,7 @@ extern "C" { #define MPI_GROUP_EMPTY -1 #define MPI_ANY_SOURCE -1 -#define MPI_STATUS_IGNORE nullptr +#define MPI_STATUS_IGNORE NULL #define MPI_Comm int #define MPI_Request int @@ -60,7 +60,7 @@ extern "C" { #define MPI_Group int #define MPI_Offset long -#define MPI_IN_PLACE nullptr +#define MPI_IN_PLACE NULL #define MPI_MAX_PROCESSOR_NAME 128 #define MPI_MAX_LIBRARY_VERSION_STRING 128 -- GitLab From a57a5c76a5be1b35a8634b5e58d8fbe0a701332a Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Sat, 12 Sep 2020 09:02:31 -0600 Subject: [PATCH 14/21] T2345: After examining comments changed by batch conversion of NULL to nullptr, I've corrected a small number where it seemed clear that the previous NULL should have been either "NULL" (where the code is looking for a string with that value), or null char / null byte (where the comment is talking about the char/byte that terminates a c-style string). Also changed 6 places where the batch change had changed 'NULL ptr' to 'nullptr ptr'. Now they simply say 'nullptr'. --- src/GPU/pair_eam_alloy_gpu.cpp | 2 +- src/GPU/pair_eam_fs_gpu.cpp | 2 +- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 2 +- src/KOKKOS/pair_eam_fs_kokkos.cpp | 2 +- src/MANYBODY/pair_adp.cpp | 2 +- src/MANYBODY/pair_airebo.cpp | 2 +- src/MANYBODY/pair_airebo.h | 2 +- src/MANYBODY/pair_comb.cpp | 2 +- src/MANYBODY/pair_comb3.cpp | 2 +- src/MANYBODY/pair_eam_alloy.cpp | 2 +- src/MANYBODY/pair_eam_fs.cpp | 2 +- src/MANYBODY/pair_eim.cpp | 2 +- src/MANYBODY/pair_gw.cpp | 2 +- src/MANYBODY/pair_lcbop.cpp | 4 ++-- src/MANYBODY/pair_lcbop.h | 2 +- src/MANYBODY/pair_nb3b_harmonic.cpp | 2 +- src/MANYBODY/pair_polymorphic.cpp | 2 +- src/MANYBODY/pair_sw.cpp | 2 +- src/MANYBODY/pair_tersoff.cpp | 2 +- src/MANYBODY/pair_vashishta.cpp | 2 +- src/USER-COLVARS/fix_colvars.cpp | 2 +- src/USER-INTEL/pair_eam_alloy_intel.cpp | 2 +- src/USER-INTEL/pair_eam_fs_intel.cpp | 2 +- src/USER-MEAMC/pair_meamc.cpp | 2 +- src/USER-MISC/pair_agni.cpp | 2 +- src/USER-MISC/pair_drip.cpp | 2 +- src/USER-MISC/pair_edip.cpp | 2 +- src/USER-MISC/pair_edip_multi.cpp | 2 +- src/USER-MISC/pair_extep.cpp | 2 +- src/USER-MISC/pair_ilp_graphene_hbn.cpp | 2 +- src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 2 +- src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 2 +- src/USER-MISC/pair_lebedeva_z.cpp | 2 +- src/USER-MISC/pair_meam_spline.cpp | 2 +- src/USER-MISC/pair_meam_sw_spline.cpp | 2 +- src/USER-MISC/pair_tersoff_table.cpp | 2 +- src/USER-OMP/pair_eam_alloy_omp.cpp | 2 +- src/USER-OMP/pair_eam_fs_omp.cpp | 2 +- src/USER-REAXC/pair_reaxc.cpp | 2 +- src/USER-SMTBQ/pair_smtbq.cpp | 2 +- src/atom.cpp | 4 ++-- src/fix_spring_rg.cpp | 2 +- src/input.cpp | 12 ++++++------ src/pair_coul_streitz.cpp | 2 +- src/read_dump.cpp | 8 ++++---- src/run.cpp | 2 +- 46 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 9dd5c85c49..998ca92936 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -324,7 +324,7 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 10f6b4ebe9..5559bb470f 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -324,7 +324,7 @@ void PairEAMFSGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 4e0c44acba..52882c8be8 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMAlloyKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 2714da9cae..d697cfbe9a 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMFSKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 4eeab89381..3b98c91cb8 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -465,7 +465,7 @@ void PairADP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 8643f54812..eb92e0c58a 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -185,7 +185,7 @@ void PairAIREBO::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and H - // map[i] = which element (0,1) the Ith atom type is, -1 if nullptr + // map[i] = which element (0,1) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index d605ddc2d8..7539cc5e7f 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -40,7 +40,7 @@ class PairAIREBO : public Pair { enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code protected: - int *map; // 0 (C), 1 (H), or -1 (nullptr) for each type + int *map; // 0 (C), 1 (H), or -1 ("NULL") for each type int variant; int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 0e2ac8dac9..95b49b98f9 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -456,7 +456,7 @@ void PairComb::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index fd4f1b3822..01a1538f7b 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -192,7 +192,7 @@ void PairComb3::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 055a2baf11..f17d500a40 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -70,7 +70,7 @@ void PairEAMAlloy::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index 90c24bb254..1c055e1bcf 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -70,7 +70,7 @@ void PairEAMFS::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index 69e2832b37..8f229060cf 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -388,7 +388,7 @@ void PairEIM::coeff(int narg, char **arg) read_file(arg[2+nelements]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3 + nelements; i < narg; i++) { m = i - (3+nelements) + 1; diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index dd9b55b7bf..6a97975d45 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -283,7 +283,7 @@ void PairGW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index c84361d7a6..760ffc8cd8 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -135,8 +135,8 @@ void PairLCBOP::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read args that map atom types to C and nullptr - // map[i] = which element (0 for C) the Ith atom type is, -1 if nullptr + // read args that map atom types to C and "NULL" + // map[i] = which element (0 for C) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index 9ca2e3d55e..dacbe74158 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,7 +39,7 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 (nullptr) for each type + int *map; // 0 (C) or -1 ("NULL") for each type int me; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index a361955fa7..859652dd10 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -198,7 +198,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index cdf9a7f23a..99eb2fec55 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 9db9adf423..b74eda0f85 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -262,7 +262,7 @@ void PairSW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 21a8f7de67..b8379d15cc 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -306,7 +306,7 @@ void PairTersoff::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index fea414f5fb..10ac2c418f 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -269,7 +269,7 @@ void PairVashishta::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index eaa0d272c3..57162df249 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -961,7 +961,7 @@ void FixColvars::write_restart(FILE *fp) proxy->serialize_status(rest_text); // TODO call write_output_files() const char *cvm_state = rest_text.c_str(); - int len = strlen(cvm_state) + 1; // need to include terminating nullptr byte. + int len = strlen(cvm_state) + 1; // need to include terminating null byte. fwrite(&len,sizeof(int),1,fp); fwrite(cvm_state,1,len,fp); } diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index b93c9bc8c0..b78baf896f 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 2165f10aff..84cfcb8a11 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -69,7 +69,7 @@ void PairEAMFSIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 133bb611ca..4c4a3dcf62 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -556,7 +556,7 @@ void PairMEAMC::read_files(const std::string &globalfile, delete [] rozero; delete [] found; - // done if user param file is nullptr + // done if user param file is "NULL" if (userfile == "NULL") return; diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index afd600594b..0361942af1 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -266,7 +266,7 @@ void PairAGNI::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 449cf86699..b5b39a65a7 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -139,7 +139,7 @@ void PairDRIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 31dda8bb03..62d09e0c46 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -779,7 +779,7 @@ void PairEDIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 1a5d4925d9..07245b1728 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -539,7 +539,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 6d9f74de8e..d8fa565ae1 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -467,7 +467,7 @@ void PairExTeP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index f0c197ca3d..63ba47448a 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -167,7 +167,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index c308990839..0804f42b86 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -168,7 +168,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 80f57fb5dc..617a48c0fe 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -232,7 +232,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index cb65dc85f6..3168a35ab7 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -228,7 +228,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 455a21ada3..3be2a3858b 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -398,7 +398,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 0013fa5577..a8977a09d4 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -393,7 +393,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 6e0cacaff7..bc6be2d399 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -755,7 +755,7 @@ void PairTersoffTable::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index 9a797dafa2..2f29aced65 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index d474e039bf..a7fd0cac51 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -69,7 +69,7 @@ void PairEAMFSOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 6a2ba7d754..fd97a26359 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -327,7 +327,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" int itmp = 0; int nreax_types = system->reax_param.num_atom_types; diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index a40f676ff1..d84f302304 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -277,7 +277,7 @@ void PairSMTBQ::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/atom.cpp b/src/atom.cpp index a58e1e3181..539bf6fc0b 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2201,10 +2201,10 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find nullptr ptr: + // if find nullptr: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find nullptr ptr: + // if don't find nullptr: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 2805395053..6cd8637a5c 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -67,7 +67,7 @@ void FixSpringRG::init() { masstotal = group->mass(igroup); - // if rg0 was specified as nullptr, compute current Rg + // Compute current Rg // only occurs on 1st run if (rg0_flag) { diff --git a/src/input.cpp b/src/input.cpp index 5efbdfba3d..5e40d2dede 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -467,10 +467,10 @@ char *Input::nextword(char *str, char **next) // start = first char beyond quote // stop = first char of matching quote // next = first char beyond matching quote - // next must be nullptr or whitespace + // next must be null char or whitespace // if start is not single/double/triple quote: // stop = first whitespace char after start - // next = char after stop, or stop itself if stop is nullptr + // next = char after stop, or stop itself if stop is null char if (strstr(start,"\"\"\"") == start) { stop = strstr(&start[3],"\"\"\""); @@ -492,7 +492,7 @@ char *Input::nextword(char *str, char **next) else *next = stop+1; } - // set stop to nullptr to terminate word + // set stop to null char to terminate word *stop = '\0'; return start; @@ -510,9 +510,9 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // use str2 as scratch space to expand str, then copy back to str // reallocate str and str2 as necessary // do not replace $ inside single/double/triple quotes - // var = pts at variable name, ended by nullptr - // if $ is followed by '{', trailing '}' becomes nullptr - // else $x becomes x followed by nullptr + // var = pts at variable name, ended by null char + // if $ is followed by '{', trailing '}' becomes null char + // else $x becomes x followed by null char // beyond = points to text following variable int i,n,paren_count; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 6ff958483b..101aaf36a3 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -143,7 +143,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if nullptr + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 2fd14b547a..dcbb95fccc 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr ptr + maxnew = MAX(nnew,1); // avoid nullptr memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid nullptr ptr + newmaxnew = MAX(newmaxnew,1); // avoid nullptr memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); diff --git a/src/run.cpp b/src/run.cpp index f5b571844f..2e55fba439 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -91,7 +91,7 @@ void Run::command(int narg, char **arg) // all remaining args are commands // first,last = arg index of first/last commands - // set ncommands = 0 if single command and it is nullptr + // set ncommands = 0 if single command and it is "NULL" } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); -- GitLab From ec1fe4e445b777138a1778a9a2a2e5861c2c5120 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 12 Sep 2020 14:04:23 -0400 Subject: [PATCH 15/21] update molfile plugin headers with latest versions from VMD --- lib/molfile/molfile_plugin.h | 127 +++++++++++++++++++++++++++++------ lib/molfile/vmdplugin.h | 4 +- 2 files changed, 109 insertions(+), 22 deletions(-) diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 2b7c57b840..491cd375bb 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -11,7 +11,7 @@ * * $RCSfile: molfile_plugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.108 $ $Date: 2016/02/26 03:17:01 $ + * $Revision: 1.112 $ $Date: 2019/10/17 06:12:24 $ * ***************************************************************************/ @@ -111,7 +111,7 @@ typedef struct { char resname[8]; /**< required residue name string */ int resid; /**< required integer residue ID */ char segid[8]; /**< required segment name string, or "" */ -#if 0 && vmdplugin_ABIVERSION > 17 +#if 0 && vmdplugin_ABIVERSION > 10000 /* The new PDB file formats allows for much larger structures, */ /* which can therefore require longer chain ID strings. The */ /* new PDBx/mmCIF file formats do not have length limits on */ @@ -187,13 +187,58 @@ typedef struct molfile_timestep_metadata { int has_velocities; /**< if timesteps have velocities */ } molfile_timestep_metadata_t; + /* - * Per-timestep atom coordinates and periodic cell information + * + * Per-timestep atom coordinates, velocities, forces, energies, + * and periodic cell information + * + */ + +#if 0 +/** + * Periodically stored energies of various kinds + */ +typedef struct { + int energyflags; // XXX indicate use and semantics of data fields + + double total_energy; // XXX these copied from DESRES_READ_TIMESTEP2 case + double potential_energy; + double kinetic_energy; + double extended_energy; + double force_energy; + double total_pressure; + + // Alchemical free energy methods need to store individual energy samples. + // We don't really want pre-averaged quantities, they lead to problems later. + double lambda; // data gen sim parm: + aux scheduling + soft core parm + double temperature; // temp set by thermostat + // either we use deltaU, or we store U and Uprime... + double deltaU; // Ulambda - Ulambdaprime + double Ulambda; // U for lambda + double Ulambdaprime; // U for lambdaprime + + // IDWS methods + // XXX both values of lambdaprime and required de-interleaving information + + // Replica exchange methods + // XXX rectangle sample params? + + // REST2 method + // XXX + +} molfile_energies_t; +#endif + + +/** + * Per-timestep atom coordinates, velocities, time, energies + * and periodic cell info */ typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ float *velocities; /**< space for velocities of all atoms; same layout */ - /**< nullptr unless has_velocities is set */ + /**< NULL unless has_velocities is set */ /*@{*/ /** @@ -517,7 +562,7 @@ typedef struct { * form {orbital1(c1),orbital1(c2),.....,orbitalM(cN)} */ float *orbital_energies; /**< list of orbital energies for wavefunction */ float *occupancies; /**< orbital occupancies */ - int *orbital_ids; /**< orbital ID numbers; If nullptr then VMD will + int *orbital_ids; /**< orbital ID numbers; If NULL then VMD will * assume 1,2,3,...num_orbs. */ } molfile_qm_wavefunction_t; @@ -588,7 +633,7 @@ color r, g, b /** - * Main file reader API. Any function in this struct may be nullptr + * Main file reader API. Any function in this struct may be NULL * if not implemented by the plugin; the application checks this to determine * what functionality is present in the plugin. */ @@ -599,7 +644,7 @@ typedef struct { vmdplugin_HEAD /** - * Filename extension for this file type. May be nullptr if no filename + * Filename extension for this file type. May be NULL if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" @@ -611,7 +656,7 @@ typedef struct { const char *filename_extension; /** - * Try to open the file for reading. Return an opaque handle, or nullptr on + * Try to open the file for reading. Return an opaque handle, or NULL on * failure. Set the number of atoms; if the number of atoms cannot be * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; @@ -638,20 +683,20 @@ typedef struct { * the caller. * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be - * set to 0 and from/to should be set to nullptr to indicate that no bond + * set to 0 and from/to should be set to NULL to indicate that no bond * information was actually present, and automatic bond search should be * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to nullptr, in which case the caller will provide a + * pointer should be set to NULL, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array * will contain the bond type index for each from/to pair. These numbers * are consecutive integers starting from 0. * the bondtypenames list, contains the corresponding names, if available, - * as a nullptr string terminated list. nbondtypes is provided for convenience + * as a NULL string terminated list. nbondtypes is provided for convenience * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. @@ -662,11 +707,11 @@ typedef struct { int **bondtype, int *nbondtypes, char ***bondtypename); /** - * XXX this function will be augmented and possibly superseded by a + * XXX this function will be augmented and possibly superceded by a * new QM-capable version named read_timestep(), when finished. * * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is nullptr, then + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then * the frame should be skipped. Otherwise, the application must prepare * molfile_timestep_t by allocating space in coords for the corresponding * number of coordinates. @@ -684,7 +729,7 @@ typedef struct { /** * Open a coordinate file for writing using the given header information. - * Return an opaque handle, or nullptr on failure. The application must + * Return an opaque handle, or NULL on failure. The application must * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ @@ -757,7 +802,7 @@ typedef struct { * from/to and to/from versions of each. * This function must be called before write_structure(). * - * Like the read_bonds() routine, the bondorder pointer is set to nullptr + * Like the read_bonds() routine, the bondorder pointer is set to NULL * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. @@ -767,7 +812,7 @@ typedef struct { * index (consecutive integers starting from 0) and bondtypenames * contain the corresponding strings, in case the naming/numbering * scheme is different from the index numbers. - * if the pointers are set to nullptr, then this information is not available. + * if the pointers are set to NULL, then this information is not available. * bondtypenames can only be used of bondtypes is also given. * Return MOLFILE_SUCCESS if no errors occur. */ @@ -839,16 +884,39 @@ typedef struct { int (* read_qm_rundata)(void *, molfile_qm_t *qmdata); + /** + * Query the molfile plugin to determine whether or not memory + * allocations used for atomic coordinates and PBC unit cell information + * need to be aligned to a particular virtual memory or filesystem + * page size boundary to facilitate kernel-bypass unbuffered I/O, + * e.g., as used by jsplugin. This API should be called prior to the + * first call to read a timestep. The required page alignment size + * (in bytes) is returned to the caller. If this API has not been + * called, then the molfile plugin should revert to standard + * kernel-buffered I/O and suffer the associated performance loss. + * The caller can be assured that the plugin will not request any + * page alignment size that is greater than the value of + * MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, both as a runtime sanity check, + * and to ensure that a caller that is unable to perform the max + * aligned allocation doesn't call the API in the first place. + * If a page-aligned allocation is not required for the file being read, + * the plugin will return an alignment size of 1. + */ +#if vmdplugin_ABIVERSION > 17 + int (* read_timestep_pagealign_size)(void *, int *pagealignsize); +#endif + + /** * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are nullptr, then the coordinate or qm data should be skipped. + * arguments are NULL, then the coordinate or qm data should be skipped. * Otherwise, the application must prepare molfile_timestep_t and * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or nullptr pointers for the molfile_timestep_t and + * valid, or NULL pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. * The natoms and qm metadata parameters exist because some file formats @@ -862,6 +930,25 @@ typedef struct { int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *); int (* read_qm_timestep_metadata)(void *, molfile_qm_timestep_metadata_t *); + +#if defined(EXPERIMENTAL_DIRECTIO_APIS) + /** + * Calculate file offsets and I/O lengths for performing + * kernel-bypass direct I/O or using GPU-Direct Storage APIs, + * thereby enabling peak I/O rates to be achieved for analysis + * worksloads like clustering of trajectories. + */ + int (* calc_fileoffsets_timestep)(void *, + molfile_ssize_t frameindex, + int firstatom, + int lastatom, + int *firstatom, + int *pageoffset, + molfile_ssize_t *startoffset, + molfile_ssize_t *readlen); +#endif + + #if defined(DESRES_READ_TIMESTEP2) /** * Read a specified timestep! @@ -886,9 +973,9 @@ typedef struct { * caller the ability to prioritize, buffer, and redirect console messages * to an appropriate output channel, window, etc. This enables the use of * graphical consoles like TkCon without losing console output from plugins. - * If the function pointer is nullptr, no console output service is provided + * If the function pointer is NULL, no console output service is provided * by the calling application, and the output should default to stdout - * stream. If the function pointer is non-nullptr, all output will be + * stream. If the function pointer is non-NULL, all output will be * subsequently dealt with by the calling application. * * XXX this should really be put into a separate block of diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index 842d1e431c..7afc358e97 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -11,7 +11,7 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.33 $ $Date: 2015/10/29 05:10:54 $ + * $Revision: 1.34 $ $Date: 2018/05/02 03:12:56 $ * ***************************************************************************/ @@ -144,7 +144,7 @@ typedef struct { /** * Use this macro to initialize the abiversion member of each plugin */ -#define vmdplugin_ABIVERSION 17 +#define vmdplugin_ABIVERSION 18 /*@{*/ /** Use this macro to indicate a plugin's thread-safety at registration time */ -- GitLab From 58a17532bf11c2eacc5464b40dc83566aebd3ad5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 12 Sep 2020 14:26:34 -0400 Subject: [PATCH 16/21] fix up some comments --- src/BODY/body_rounded_polygon.cpp | 2 +- src/BODY/body_rounded_polyhedron.cpp | 2 +- src/BODY/fix_wall_body_polygon.cpp | 2 +- src/BODY/fix_wall_body_polyhedron.cpp | 2 +- src/BODY/pair_body_rounded_polyhedron.cpp | 2 +- src/GPU/pppm_gpu.cpp | 2 +- src/GRANULAR/fix_wall_gran.cpp | 4 ++-- src/GRANULAR/fix_wall_gran.h | 2 +- src/GRANULAR/pair_gran_hooke_history.h | 2 +- src/GRANULAR/pair_granular.h | 2 +- src/KIM/fix_store_kim.h | 4 ++-- src/KIM/kim_interactions.cpp | 2 +- src/KOKKOS/atom_kokkos.cpp | 2 +- src/KOKKOS/pair_kokkos.h | 2 +- src/LATTE/fix_latte.cpp | 2 +- src/MISC/dump_xtc.cpp | 2 +- src/USER-DPD/pair_multi_lucy.cpp | 2 +- src/USER-DPD/pair_multi_lucy_rx.cpp | 2 +- src/USER-PHONON/fix_phonon.cpp | 2 +- src/atom.cpp | 4 ++-- src/atom.h | 2 +- src/comm.cpp | 12 ++++++------ src/compute_chunk_atom.h | 2 +- src/dump.cpp | 2 +- src/error.cpp | 8 ++++---- src/fix_property_atom.cpp | 2 +- src/input.cpp | 4 ++-- src/modify.cpp | 2 +- src/neighbor.cpp | 2 +- src/output.h | 2 +- src/pair_table.cpp | 2 +- src/read_dump.cpp | 8 ++++---- src/utils.cpp | 2 +- src/utils.h | 4 ++-- 34 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index f2e798c93c..c7d006c67f 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -321,7 +321,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is nullptr, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolygon::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index b647c7e541..423a3b3443 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -373,7 +373,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is nullptr, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolyhedron::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 99ae8ed094..2e69f70af7 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -226,7 +226,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 2507b94d25..472fe5fb21 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -233,7 +233,7 @@ void FixWallBodyPolyhedron::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 1d7461199d..a3cffef9cc 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -1880,7 +1880,7 @@ void PairBodyRoundedPolyhedron::project_pt_plane(const double* q, face_index = face index of the body xmi = atom i's coordinates q1 = tested point on the face (e.g. the projection of a point) - q2 = another point (can be nullptr) for face-edge intersection + q2 = another point (can be a null pointer) for face-edge intersection Output: inside1 = 1 if q1 is inside the polygon, 0 otherwise inside2 = 1 if q2 is inside the polygon, 0 otherwise diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 9b753edd68..a2e3e3ab98 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -117,7 +117,7 @@ void PPPMGPU::init() // thru its deallocate(), allocate() // NOTE: could free density_brick and vdxyz_brick after PPPM allocates them, // before allocating db_gpu and vd_brick down below, if don't need, - // if do this, make sure to set them to nullptr + // if do this, make sure to set them to a null pointer destroy_3d_offset(density_brick_gpu,nzlo_out,nylo_out); destroy_3d_offset(vd_brick,nzlo_out,nylo_out); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 25d271be9d..9482aae3e7 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -416,7 +416,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : mass_rigid = nullptr; // initialize history as if particle is not touching region - // history_one will be nullptr for wallstyle = REGION + // history_one will be a null pointer for wallstyle = REGION if (use_history && history_one) { int nlocal = atom->nlocal; @@ -576,7 +576,7 @@ void FixWallGran::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to nullptr, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential // set history if pair potential stores history diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 1b3be22e7f..a81a4c787c 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -103,7 +103,7 @@ class FixWallGran : public Fix { // rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index dd9a843142..c27ce8a9af 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -61,7 +61,7 @@ class PairGranHookeHistory : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index ce417812de..7ef4f2af98 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -56,7 +56,7 @@ class PairGranular : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, nullptr if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 4e4890ea6e..5775056876 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -79,8 +79,8 @@ class FixStoreKIM : public Fix { private: void *simulator_model; // pointer to KIM simulator model class void *model_name; // string of KIM model name - void *model_units; // string of unit conversion origin or nullptr - void *user_units; // string of unit conversion target or nullptr + void *model_units; // string of unit conversion origin or null pointer + void *user_units; // string of unit conversion target or null pointer }; } diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 7551216072..c5ae2ec380 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -108,7 +108,7 @@ void KimInteractions::do_setup(int narg, char **arg) // check if we had a kim_init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. - // validate model name if not given as nullptr. + // validate model name if not given as null pointer. int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index ed0cfccd43..e9093ee0a1 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -282,7 +282,7 @@ int AtomKokkos::add_custom(const char *name, int flag) /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to nullptr + free memory for vector and name and set ptrs to a null pointer ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 1eaf20eadb..cb55dd3141 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -94,7 +94,7 @@ struct PairComputeFunctor { dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); }; - // Call cleanup_copy which sets allocations nullptr which are destructed by the PairStyle + // Call cleanup_copy which sets allocations to null which are destructed by the PairStyle ~PairComputeFunctor() {c.cleanup_copy();list.copymode = 1;}; KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const { diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 0581f1e359..055e62c418 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -74,7 +74,7 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : thermo_virial = 1; // store ID of compute pe/atom used to generate Coulomb potential for LATTE - // nullptr means LATTE will compute Coulombic potential + // null pointer means LATTE will compute Coulombic potential coulomb = 0; id_pe = nullptr; diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 5c3ca7264e..35cca32871 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -137,7 +137,7 @@ void DumpXTC::init_style() void DumpXTC::openfile() { // XTC maintains it's own XDR file ptr - // set fp to nullptr so parent dump class will not use it + // set fp to a null pointer so parent dump class will not use it fp = nullptr; if (me == 0) diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 2e556d82e4..a266e94ccb 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -582,7 +582,7 @@ void PairMultiLucy::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucy::null_table(Table *tb) diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index e56743ea1d..d8356d20c4 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -727,7 +727,7 @@ void PairMultiLucyRX::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucyRX::null_table(Table *tb) diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index c80073f3c7..d8900d2348 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -162,7 +162,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fft = new FFT3d(lmp,world,nz,ny,nx,0,nz-1,0,ny-1,nxlo,nxhi,0,nz-1,0,ny-1,nxlo,nxhi,0,0,&mysize,0); memory->create(fft_data, MAX(1,mynq)*2, "fix_phonon:fft_data"); - // allocate variables; MAX(1,... is used because nullptr buffer will result in error for MPI + // allocate variables; MAX(1,... is used because a null buffer will result in error for MPI memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); diff --git a/src/atom.cpp b/src/atom.cpp index 539bf6fc0b..e140d2e473 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2201,10 +2201,10 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find nullptr: + // if find null pointer: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find nullptr: + // if don't find null pointer: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) diff --git a/src/atom.h b/src/atom.h index 841d224d23..4ea4157fa2 100644 --- a/src/atom.h +++ b/src/atom.h @@ -55,7 +55,7 @@ class Atom : protected Pointers { int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc - char *firstgroupname; // group-ID to store first, nullptr if unset + char *firstgroupname; // group-ID to store first, null pointer if unset // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variable diff --git a/src/comm.cpp b/src/comm.cpp index becb52df91..32a4152294 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -888,7 +888,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, if (inorder) nrvous = irregular->create_data_grouped(n,procs); else nrvous = irregular->create_data(n,procs); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -925,7 +925,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); @@ -967,7 +967,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!inorder) { memory->create(procs_a2a,nprocs,"rendezvous:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer inbuf_a2a = (char *) memory->smalloc((bigint) n*insize+1, "rendezvous:inbuf"); @@ -1032,7 +1032,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, } // all2all comm of inbuf from caller decomp to rendezvous decomp - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -1074,7 +1074,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!outorder) { memory->create(procs_a2a,nprocs,"rendezvous_a2a:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); @@ -1135,7 +1135,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of outbuf from rendezvous decomp back to caller decomp // caller will free outbuf - // add 1 item to the allocated buffer size, so the returned pointer is not nullptr + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,"rendezvous:outbuf"); diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 14c86383b7..392179043a 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -96,7 +96,7 @@ class ComputeChunkAtom : public Compute { class FixStore *fixstore; class Fix *lockfix; // ptr to FixAveChunk that is locking out setups - // nullptr if no lock currently in place + // null pointer if no lock currently in place bigint lockstart,lockstop; // timesteps for start and stop of locking bigint invoked_setup; // last timestep setup_chunks and nchunk calculated diff --git a/src/dump.cpp b/src/dump.cpp index 3f1e997d13..2259f9ef3e 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -202,7 +202,7 @@ Dump::~Dump() delete[] nameslist; } - // XTC style sets fp to nullptr since it closes file in its destructor + // XTC style sets fp to a null pointer since it closes file in its destructor if (multifile == 0 && fp != nullptr) { if (compressed) { diff --git a/src/error.cpp b/src/error.cpp index d89ea5b681..fff3072bb1 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -95,7 +95,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -143,7 +143,7 @@ void Error::all(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -192,7 +192,7 @@ void Error::one(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be nullptr when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 35ac20e370..e6ed9ea023 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -152,7 +152,7 @@ FixPropertyAtom::~FixPropertyAtom() if (border) atom->delete_callback(id,2); // deallocate per-atom vectors in Atom class - // set ptrs to nullptr, so they no longer exist for Atom class + // set ptrs to a null pointer, so they no longer exist for Atom class for (int m = 0; m < nvalue; m++) { if (style[m] == MOLECULE) { diff --git a/src/input.cpp b/src/input.cpp index 5e40d2dede..4539dfabf8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -338,7 +338,7 @@ char *Input::one(const std::string &single) } // parse the line - // if no command, just return nullptr + // if no command, just return a null pointer parse(); if (command == nullptr) return nullptr; @@ -450,7 +450,7 @@ void Input::parse() treat text between single/double/triple quotes as one arg matching quote must be followed by whitespace char if not end of string strip quotes from returned word - return ptr to start of word or nullptr if no word in string + return ptr to start of word or null pointer if no word in string also return next = ptr after word ------------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index a908cfc7af..0f0a86cdd8 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -821,7 +821,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // warn if new group != old group // delete old fix, but do not call update_callback(), // since will replace this fix and thus other fix locs will not change - // set ptr to nullptr in case new fix scans list of fixes, + // set ptr to a null pointer in case new fix scans list of fixes, // e.g. scan will occur in add_callback() if called by new fix // if fix ID does not exist: // set newflag = 1 so create new fix diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 26e7d6b74b..db67f71548 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -378,7 +378,7 @@ void Neighbor::init() // We cannot remove special neighbors with kspace or kspace-like pair styles // as the exclusion needs to remove the full coulomb and not the damped interaction. // Special treatment is required for hybrid pair styles since Force::pair_match() - // will only return a non-nullptr pointer if there is only one substyle of the kind. + // will only return a non-null pointer if there is only one substyle of the kind. if (force->kspace) { special_flag[1] = special_flag[2] = special_flag[3] = 2; diff --git a/src/output.h b/src/output.h index 6a64e67c93..1af03df228 100644 --- a/src/output.h +++ b/src/output.h @@ -29,7 +29,7 @@ class Output : protected Pointers { bigint next_thermo; // next timestep for thermo output int thermo_every; // output freq for thermo, 0 if first/last only bigint last_thermo; // last timestep thermo was output - char *var_thermo; // variable name for thermo freq, nullptr if every + char *var_thermo; // variable name for thermo freq, null pointer if every int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations diff --git a/src/pair_table.cpp b/src/pair_table.cpp index c0fad544d7..a92d2e4911 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -821,7 +821,7 @@ void PairTable::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to nullptr, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairTable::null_table(Table *tb) diff --git a/src/read_dump.cpp b/src/read_dump.cpp index dcbb95fccc..426d0f5a92 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid nullptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid nullptr + newmaxnew = MAX(newmaxnew,1); // avoid null pointer memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); diff --git a/src/utils.cpp b/src/utils.cpp index e985f9e6e5..b0928fd18a 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -171,7 +171,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, errmsg += "'"; if (error) error->one(srcname,srcline,errmsg); - if (s) *s = '\0'; // truncate string to empty in case error is nullptr + if (s) *s = '\0'; // truncate string to empty in case error is null pointer } return; } diff --git a/src/utils.h b/src/utils.h index cf8952b8a6..c9e958365d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { * \param s buffer for storing the result of fgets() * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() - * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfgets(const char *srcname, int srcline, char *s, int size, @@ -75,7 +75,7 @@ namespace LAMMPS_NS { * \param size size of data elements read by fread() * \param num number of data elements read by fread() * \param fp file pointer used by fread() - * \param filename file name associated with fp (may be nullptr; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfread(const char *srcname, int srcline, void *s, size_t size, -- GitLab From 430d1516603644cc74ea48246302ae02058db148 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Mon, 14 Sep 2020 08:53:59 -0600 Subject: [PATCH 17/21] Revert commit 05d41cd50de992fe806e4f4a3d8b42b6e39579a4 which walked-back the NULL->nullptr changes for lib/poems. Then, hand-applied a minor cleanup to comments, ala Axel's changes to the rest of the codebase. --- lib/poems/SystemProcessor.h | 30 ++++++++--------- lib/poems/poemsnodelib.h | 20 ++++++------ lib/poems/poemstree.h | 64 ++++++++++++++++++------------------- lib/poems/poemstreenode.cpp | 2 +- lib/poems/solver.cpp | 2 +- lib/poems/system.cpp | 10 +++--- lib/poems/workspace.cpp | 6 ++-- 7 files changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index 4fc8785dd7..f009794f66 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != NULL) + if(currentNode != nullptr) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != NULL); //repeat this until all chains have been added + while(currentNode != nullptr); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null + if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null { - return NULL; + return nullptr; } int * tmp; - POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = NULL; //temporary variable to hold data - while(tempNode != NULL) //when we have followed all links, stop + POEMSChain * tempChain = nullptr; //temporary variable to hold data + while(tempNode != nullptr) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == NULL) + if(aNode == nullptr) { - return NULL; + return nullptr; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == NULL) //and if we find nothing... + if(returnVal == nullptr) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == NULL) //if we could not find any chains + if(returnVal == nullptr) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be NULL if no new chains are + return returnVal; //return what we find (will be a null pointer if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists + while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != NULL || tmp2->value != NULL) //go through the list + while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 446fa2013f..04f0f4b79b 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); +TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value NULL +// The pointers have default value nullptr TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == NULL) + if (p == nullptr) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=NULL) + if(t !=nullptr) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == NULL && t->Right() == NULL) + if (t->Left() == nullptr && t->Right() == nullptr) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == NULL) + if (t == nullptr) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=NULL - if (t != NULL) + //print tree with root t, as long as t!=nullptr + if (t != nullptr) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index ee07a33255..cb9499cfd4 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = NULL); + void Insert(const int& item, const int& data, void * AuxData = nullptr); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = NULL; + DeleteAuxData = nullptr; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return NULL +// address and a pointer to its parent; otherwise, return a null pointer TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is NULL - parent = NULL; + // the parent of the root is a null pointer + parent = nullptr; // terminate on empty subtree - while(t != NULL) + while(t != nullptr) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; NULL if not found + // return pointer to node; a null pointer if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != NULL) + if (current != nullptr) { item = current->data; return current->GetAuxData(); } else - // item not found in the tree. return False - return NULL; + // item not found in the tree. return a null pointer + return nullptr; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,NULL,NULL); + newNode = GetTreeNode(item,nullptr,nullptr); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == NULL) + if (tree == nullptr) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) + if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) return; - // If D has NULL pointer, the + // If D has null pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == NULL) + if (DNodePtr->right == nullptr) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == NULL) + else if (DNodePtr->left == nullptr) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-NULL + // Both pointers of DNodePtr are non-null pointers else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != NULL) + while (RNodePtr->right != nullptr) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == NULL) + if (PNodePtr == nullptr) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=NULL && current->data == item) + if (current !=nullptr && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == NULL) - return NULL; + if (t == nullptr) + return nullptr; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns NULL. + // present it makes a copy of left child or returns a null pointer. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=NULL) + if (t->Left() !=nullptr) newlptr = CopyTree(t->Left()); else - newlptr = NULL; + newlptr = nullptr; - if (t->Right() !=NULL) + if (t->Right() !=nullptr) newrptr = CopyTree(t->Right()); else - newrptr = NULL; + newrptr = nullptr; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != NULL) { + if (t != nullptr) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != NULL) { - if (DeleteAuxData != NULL) { + if (aux != nullptr) { + if (DeleteAuxData != nullptr) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to NULL +// set the root pointer back to a null pointer void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = NULL; // root now NULL + t = nullptr; // root now a null pointer } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 051e13d6e0..0b475c0a85 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value NULL assigns a empty subtree +// A null pointer value assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 67f5b607e3..7b1e718b93 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return NULL; + default: return nullptr; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 369213f7d0..23554f4117 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = NULL; + mappings = nullptr; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 2b3257b0dd..21819d4c02 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = NULL; + system = nullptr; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != NULL) { + while(NodeValue != nullptr) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return NULL; + return nullptr; } } -- GitLab From 6315b277c8798fbce824004b115c70819de459c9 Mon Sep 17 00:00:00 2001 From: Anne Gunn Date: Mon, 14 Sep 2020 10:12:48 -0600 Subject: [PATCH 18/21] Revert commit 14dfd3876ac4a53855804baa7f27abfb6a1a9d46 which walked-back the NULL->nullptr changes for lib/awpmd. Then, hand-applied a minor cleanup to comments, ala Axel's changes to the rest of the codebase. --- lib/awpmd/ivutils/include/logexc.h | 8 +++--- lib/awpmd/ivutils/include/pairhash.h | 28 +++++++++---------- lib/awpmd/ivutils/include/refobj.h | 20 ++++++------- lib/awpmd/ivutils/include/vector_3.h | 14 +++++----- lib/awpmd/ivutils/src/logexc.cpp | 2 +- lib/awpmd/systems/interact/TCP/wpmd.h | 20 ++++++------- lib/awpmd/systems/interact/TCP/wpmd_split.cpp | 4 +-- lib/awpmd/systems/interact/TCP/wpmd_split.h | 16 +++++------ 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 7bf6125bc6..2eebfcc0ce 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(NULL),next(NULL){ + :descriptor(descriptor_),prev(nullptr),next(nullptr){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=NULL; - prev=NULL; + glogp->next=nullptr; + prev=nullptr; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index c29f72773f..401b7b91e3 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(NULL,1) { + recmatrix(): parr(nullptr,1) { sizey=sizex=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(NULL,1) { + sqmatrix(): parr(nullptr,1) { size=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(NULL){ + sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not NULL, puts the found value there - virtual int Find(long i, long j, T *retval=NULL)=0; - virtual int Find(long i, long j, T **retval=NULL)=0; + //e if retval is not a null pointer, puts the found value there + virtual int Find(long i, long j, T *retval=nullptr)=0; + virtual int Find(long i, long j, T **retval=nullptr)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=NULL){ + int Find(long i, long j, T *retval=nullptr){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index a1a4feb0ff..8e5fc7df45 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=NULL, int managed=0){ + void reset(T* ptr=nullptr, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==NULL than p is not managed (as in mngptr) + int *num; //if num==nullptr than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=NULL; + else num=nullptr; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } public: - shptr(T* p=NULL, int managed=1){ + shptr(T* p=nullptr, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=NULL; + num=nullptr; } - p=NULL; + p=nullptr; } } bool valid() const { - return p!=NULL; + return p!=nullptr; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 468abbda99..5711d3bf35 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=NULL) const { + T maxcoord(int *ind=nullptr) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 7e82af0f65..6e809dd65c 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=NULL; +message_logger *message_logger::glogp=nullptr; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index e118b76f36..4c65440014 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ + void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=NULL )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); + /// Default (q=nullptr )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=NULL); + virtual int interaction_ii(int flag,Vector_3P fi=nullptr); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 2c58bdaf28..f85b1ebf59 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be NULL, \n +/// will not update electronic force arrays, which may be null pointers, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 44fb757576..10a8bda558 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); + /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be NULL, \n + /// will not update electronic force arrays, which may be null pointers, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n -- GitLab From baa49984c25765a35d43b45a43f34752ace0b8a2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 15 Sep 2020 14:19:40 -0400 Subject: [PATCH 19/21] update comments --- src/write_restart.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 01ad917e86..09fe85fd1a 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -631,7 +631,7 @@ void WriteRestart::version_numeric() } /* ---------------------------------------------------------------------- - write a flag and an int into restart file + write a flag and an int into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_int(int flag, int value) @@ -641,7 +641,7 @@ void WriteRestart::write_int(int flag, int value) } /* ---------------------------------------------------------------------- - write a flag and a bigint into restart file + write a flag and a bigint into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_bigint(int flag, bigint value) @@ -651,7 +651,7 @@ void WriteRestart::write_bigint(int flag, bigint value) } /* ---------------------------------------------------------------------- - write a flag and a double into restart file + write a flag and a double into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_double(int flag, double value) @@ -661,7 +661,8 @@ void WriteRestart::write_double(int flag, double value) } /* ---------------------------------------------------------------------- - write a flag and a char string (including nullptr) into restart file + write a flag and a C-style char string (including the terminating null + byte) into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_string(int flag, const char *value) @@ -673,7 +674,7 @@ void WriteRestart::write_string(int flag, const char *value) } /* ---------------------------------------------------------------------- - write a flag and vector of N ints into restart file + write a flag and vector of N ints into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_int_vec(int flag, int n, int *vec) @@ -684,7 +685,7 @@ void WriteRestart::write_int_vec(int flag, int n, int *vec) } /* ---------------------------------------------------------------------- - write a flag and vector of N doubles into restart file + write a flag and vector of N doubles into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_double_vec(int flag, int n, double *vec) -- GitLab From 16749566f8a6b16450d11dcf5cf74c7538fc082a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 15 Sep 2020 14:42:00 -0400 Subject: [PATCH 20/21] Revert "fix issue with local variable shadowing a global variable" This reverts commit 3368eb79d843265d1a35570fb4f9965beae5de22. --- src/KSPACE/msm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 2634b7633c..2b025fbe3e 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -1028,7 +1028,6 @@ void MSM::set_grid_global() int flag = 0; int xlevels,ylevels,zlevels; - xlevels = ylevels = zlevels = 1; while (!factorable(nx_max,flag,xlevels)) { double k = log(nx_max)/log(2.0); @@ -1433,15 +1432,16 @@ void MSM::setup_grid() return 1 if yes, 0 if no ------------------------------------------------------------------------- */ -int MSM::factorable(int n, int &flag, int &nlevels) +int MSM::factorable(int n, int &flag, int &levels) { int i; + levels = 1; while (n > 1) { for (i = 0; i < nfactors; i++) { if (n % factors[i] == 0) { n /= factors[i]; - nlevels++; + levels++; break; } } -- GitLab From 3dd3c6a2a56f5f69781bd2091cf377d572c71621 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 15 Sep 2020 14:48:55 -0400 Subject: [PATCH 21/21] redo fix for class member shadowing while avoiding overflowing levels --- src/KSPACE/msm.cpp | 6 +- .../force-styles/tests/kspace-msm_nopbc.yaml | 60 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 2b025fbe3e..fa96123b29 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -1432,16 +1432,16 @@ void MSM::setup_grid() return 1 if yes, 0 if no ------------------------------------------------------------------------- */ -int MSM::factorable(int n, int &flag, int &levels) +int MSM::factorable(int n, int &flag, int &nlevels) { int i; - levels = 1; + nlevels = 1; while (n > 1) { for (i = 0; i < nfactors; i++) { if (n % factors[i] == 0) { n /= factors[i]; - levels++; + nlevels++; break; } } diff --git a/unittest/force-styles/tests/kspace-msm_nopbc.yaml b/unittest/force-styles/tests/kspace-msm_nopbc.yaml index 99bbd2ae97..028ee43aaf 100644 --- a/unittest/force-styles/tests/kspace-msm_nopbc.yaml +++ b/unittest/force-styles/tests/kspace-msm_nopbc.yaml @@ -1,6 +1,6 @@ --- lammps_version: 24 Aug 2020 -date_generated: Sat Sep 12 10:33:36 202 +date_generated: Tue Sep 15 14:47:38 202 epsilon: 5e-11 prerequisites: ! | atom full @@ -58,33 +58,33 @@ run_coul: 0 run_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 run_forces: ! |2 - 1 -1.0348864007239668e-01 3.2761800817797082e-01 -2.7223154925249687e-01 - 2 1.1547721105281426e-02 -2.2227221129297944e-01 1.9829831292225819e-01 - 3 -6.1369788686855553e-03 1.1473670690755385e-02 -1.2235119385263003e-02 - 4 2.8809534480886322e-02 -4.5070713784827680e-02 4.5263724656363712e-02 - 5 4.2323185781698226e-02 -5.2976717776467216e-02 4.9736627529403242e-02 - 6 3.8194733647326694e-02 -2.4587855825158134e-01 4.1856615868672892e-01 - 7 4.5246314631942265e-02 2.0099417967365288e-01 -4.3512916657147588e-01 - 8 2.2478550451619471e-02 2.0362301286740869e-01 -4.3516590120465981e-01 - 9 -1.4178329999306901e-03 -1.5368030392367521e-01 2.6080100301013964e-01 - 10 -2.0495450209946312e-02 -2.0851530662446178e-02 7.4319850349891012e-02 - 11 -3.0029358892398838e-02 -2.0702279983167187e-02 9.8520949030575691e-02 - 12 1.3289689675296273e-01 9.3775108342107519e-02 -3.0419584939008770e-01 - 13 -5.5922486140088226e-02 -2.4843666409380370e-02 1.0515381624429042e-01 - 14 -4.4208019862361184e-02 -2.8633675987750289e-02 9.8140924300998925e-02 - 15 -3.8534805055538454e-02 -4.3447767456428393e-02 9.5052177465633700e-02 - 16 -2.0197663776900704e-01 -9.6067608908760441e-02 5.1267317994067874e-01 - 17 1.1536172816123620e-01 1.2150176721849106e-01 -4.0576909205923889e-01 - 18 3.2654836490027450e-01 4.3181659922436294e-01 -6.4631937847140064e-01 - 19 -1.7012391318923387e-01 -1.9294196901436866e-01 3.0171461650625692e-01 - 20 -1.6090393021018687e-01 -1.8797301084913640e-01 2.9016061976069074e-01 - 21 4.6464803590088510e-01 2.0966755173124815e-01 -8.4865286121979111e-01 - 22 -2.2714234064511640e-01 -1.1056430229170305e-01 3.8599855632265567e-01 - 23 -1.9865351580467286e-01 -1.1110079780224448e-01 3.9440435138483038e-01 - 24 -1.1755770692492392e-02 7.9361803570205403e-01 -3.4523386783293764e-01 - 25 5.0411795551073120e-02 -3.8916839645964540e-01 1.9278646898979940e-01 - 26 -2.9733815594164319e-02 -4.1142305819442143e-01 1.7495936527287648e-01 - 27 -5.2243746980854566e-01 2.4806539986837281e-01 -3.8666209074075969e-01 - 28 2.9308687168280761e-01 -1.5702803664966208e-01 2.0612286277862657e-01 - 29 2.5153793410884945e-01 -1.2745488321867574e-01 1.8930202039662150e-01 + 1 -1.0725057415020919e-01 3.3019907950838151e-01 -2.9323265400347975e-01 + 2 1.4273516924286595e-02 -2.2195304769099961e-01 2.1172398888943439e-01 + 3 -6.2191160687439613e-03 1.1636479086601327e-02 -1.3193542766995693e-02 + 4 2.8789530000554349e-02 -4.5707077957577419e-02 4.8949304170325961e-02 + 5 4.2918140819301939e-02 -5.3982290008046191e-02 5.4071851700930415e-02 + 6 4.0693195898835278e-02 -2.5124364388294529e-01 4.4409525619111351e-01 + 7 4.3902199408654773e-02 2.0718378754835146e-01 -4.5693181215217060e-01 + 8 1.8355056045104463e-02 2.1019458646438235e-01 -4.5977818830587547e-01 + 9 1.6926987410114289e-03 -1.5785316258950571e-01 2.7688718669924633e-01 + 10 -1.9845368939794925e-02 -2.2016564601343797e-02 7.7877659664832483e-02 + 11 -2.9242294066982408e-02 -2.2678746148089381e-02 1.0272772972867131e-01 + 12 1.2960469545860479e-01 9.7367043788644400e-02 -3.1763881493481549e-01 + 13 -5.4829808348627301e-02 -2.6026456048508360e-02 1.0948080578658986e-01 + 14 -4.3113220503693823e-02 -2.9962591673432723e-02 1.0219446255502410e-01 + 15 -3.7688395823574243e-02 -4.4115392571750824e-02 9.9676983434799277e-02 + 16 -1.9855722830658068e-01 -1.0361163893486998e-01 5.3648057305505858e-01 + 17 1.1217353766495122e-01 1.2665752635347602e-01 -4.2776774483665475e-01 + 18 3.1619456057296186e-01 4.2101932424007404e-01 -6.7203553906529401e-01 + 19 -1.6723605125535490e-01 -1.8745079364937817e-01 3.1118730606879103e-01 + 20 -1.5510498316646221e-01 -1.8060202958376245e-01 3.0126314730021070e-01 + 21 4.5618585311145787e-01 2.3416325579619782e-01 -8.7525764015858531e-01 + 22 -2.2272028927958532e-01 -1.2422014484239144e-01 3.9660449946839177e-01 + 23 -1.9381556909487696e-01 -1.2213865056926680e-01 4.0697283949615592e-01 + 24 -1.7632222754297714e-02 8.0868006192947306e-01 -3.6871343152445346e-01 + 25 5.5196078243586418e-02 -3.9602778003476646e-01 2.0694223014380941e-01 + 26 -2.8010525620160029e-02 -4.1949748612714061e-01 1.8579634676877732e-01 + 27 -5.3081154989654455e-01 2.5084075406488837e-01 -4.1028201045412238e-01 + 28 2.9697439332712672e-01 -1.5978637451711275e-01 2.1926787644097381e-01 + 29 2.5525638787732113e-01 -1.2899390363572455e-01 2.0303208126884240e-01 ... -- GitLab