diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 34ff47d804..3dbf8e2ec3 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -460,7 +460,7 @@ double PairLJClass2CoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairLJClass2CoulLong::extract(char *str, int &dim) +void *PairLJClass2CoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; diff --git a/src/CLASS2/pair_lj_class2_coul_long.h b/src/CLASS2/pair_lj_class2_coul_long.h index e2f1b17e78..0e5ebd6a1a 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.h +++ b/src/CLASS2/pair_lj_class2_coul_long.h @@ -38,7 +38,7 @@ class PairLJClass2CoulLong : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_lj_global; diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index 2e607cd74d..88112d5496 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -489,7 +489,7 @@ double PairBornCoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairBornCoulLong::extract(char *str, int &dim) +void *PairBornCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; diff --git a/src/KSPACE/pair_born_coul_long.h b/src/KSPACE/pair_born_coul_long.h index ec60f2927f..5debacd85d 100644 --- a/src/KSPACE/pair_born_coul_long.h +++ b/src/KSPACE/pair_born_coul_long.h @@ -38,7 +38,7 @@ class PairBornCoulLong : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_lj_global; diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index a68029f367..f3fa4d50d8 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -459,7 +459,7 @@ double PairBuckCoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairBuckCoulLong::extract(char *str, int &dim) +void *PairBuckCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; diff --git a/src/KSPACE/pair_buck_coul_long.h b/src/KSPACE/pair_buck_coul_long.h index 01bf658892..96de53c26b 100644 --- a/src/KSPACE/pair_buck_coul_long.h +++ b/src/KSPACE/pair_buck_coul_long.h @@ -38,7 +38,7 @@ class PairBuckCoulLong : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_lj_global; diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 6a3f70b351..0ec33fb711 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -556,7 +556,7 @@ double PairCoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairCoulLong::extract(char *str, int &dim) +void *PairCoulLong::extract(const char *str, int &dim) { if (strcmp(str,"cut_coul") == 0) { dim = 0; diff --git a/src/KSPACE/pair_coul_long.h b/src/KSPACE/pair_coul_long.h index d0920fda80..d67aea8141 100644 --- a/src/KSPACE/pair_coul_long.h +++ b/src/KSPACE/pair_coul_long.h @@ -38,7 +38,7 @@ class PairCoulLong : public Pair { virtual void write_restart_settings(FILE *); virtual void read_restart_settings(FILE *); virtual double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_coul,cut_coulsq; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 1ff61a5ec0..bee8e33cab 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -1181,7 +1181,7 @@ double PairLJCharmmCoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairLJCharmmCoulLong::extract(char *str, int &dim) +void *PairLJCharmmCoulLong::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"lj14_1") == 0) return (void *) lj14_1; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.h b/src/KSPACE/pair_lj_charmm_coul_long.h index 09a0e1bc34..47cf005d76 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.h +++ b/src/KSPACE/pair_lj_charmm_coul_long.h @@ -44,7 +44,7 @@ class PairLJCharmmCoulLong : public Pair { void compute_inner(); void compute_middle(); void compute_outer(int, int); - void *extract(char *, int &); + void *extract(const char *, int &); protected: int implicit; diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index ff8fb1fd22..1b619974de 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -1122,7 +1122,7 @@ double PairLJCutCoulLong::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairLJCutCoulLong::extract(char *str, int &dim) +void *PairLJCutCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; diff --git a/src/KSPACE/pair_lj_cut_coul_long.h b/src/KSPACE/pair_lj_cut_coul_long.h index d43becdb87..5ba9c1360f 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.h +++ b/src/KSPACE/pair_lj_cut_coul_long.h @@ -43,7 +43,7 @@ class PairLJCutCoulLong : public Pair { void compute_inner(); void compute_middle(); void compute_outer(int, int); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_lj_global; diff --git a/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp b/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp index ece15c6839..0ed7d439ac 100644 --- a/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp @@ -503,7 +503,7 @@ void PairLJCutCoulLongTIP4P::find_M(int i, int &iH1, int &iH2, double *xM) /* ---------------------------------------------------------------------- */ -void *PairLJCutCoulLongTIP4P::extract(char *str, int &dim) +void *PairLJCutCoulLongTIP4P::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"qdist") == 0) return (void *) &qdist; diff --git a/src/KSPACE/pair_lj_cut_coul_long_tip4p.h b/src/KSPACE/pair_lj_cut_coul_long_tip4p.h index 4fb036484e..20060ea0fd 100644 --- a/src/KSPACE/pair_lj_cut_coul_long_tip4p.h +++ b/src/KSPACE/pair_lj_cut_coul_long_tip4p.h @@ -32,7 +32,7 @@ class PairLJCutCoulLongTIP4P : public PairLJCutCoulLong { void init_style(); void write_restart_settings(FILE *fp); void read_restart_settings(FILE *fp); - void *extract(char *, int &); + void *extract(const char *, int &); protected: int typeH,typeO; // atom types of TIP4P water H and O atoms diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 1984f9f40b..4003e437f8 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -67,8 +67,8 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; - newarg[1] = "all"; - newarg[2] = "temp"; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tflag = 1; diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index fda4c6b3c1..4afb5e1d0f 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -36,10 +36,11 @@ using namespace LAMMPS_NS; enum{FCC,BCC,HCP,DIM,DIAMOND,B1,C11,L12,B2}; int nkeywords = 21; -char *keywords[] = {"Ec","alpha","rho0","delta","lattce", - "attrac","repuls","nn2","Cmin","Cmax","rc","delr", - "augt1","gsmooth_factor","re","ialloy","mixture_ref_t", - "erose_form","zbl","emb_lin_neg","bkgd_dyn"}; +const char *keywords[] = {"Ec","alpha","rho0","delta","lattce", + "attrac","repuls","nn2","Cmin","Cmax","rc","delr", + "augt1","gsmooth_factor","re","ialloy", + "mixture_ref_t","erose_form","zbl", + "emb_lin_neg","bkgd_dyn"}; /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 1a4aeed1d3..bb67d9ca99 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -493,7 +493,7 @@ double PairLJCharmmCoulCharmm::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairLJCharmmCoulCharmm::extract(char *str, int &dim) +void *PairLJCharmmCoulCharmm::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"lj14_1") == 0) return (void *) lj14_1; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.h b/src/MOLECULE/pair_lj_charmm_coul_charmm.h index 4e85a54c58..03e453d9ee 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.h +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.h @@ -38,7 +38,7 @@ class PairLJCharmmCoulCharmm : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); virtual double single(int, int, int, int, double, double, double, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: int implicit; diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 3f5f401c4b..fb2e13298d 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -69,7 +69,8 @@ void ComputeEventDisplace::init() if (id_event != NULL) { int ifix = modify->find_fix(id_event); - if (ifix < 0) error->all(FLERR,"Could not find compute event/displace fix ID"); + if (ifix < 0) error->all(FLERR, + "Could not find compute event/displace fix ID"); fix_event = (FixEvent*) modify->fix[ifix]; if (strcmp(fix_event->style,"EVENT/PRD") != 0 && @@ -145,7 +146,7 @@ double ComputeEventDisplace::compute_scalar() /* ---------------------------------------------------------------------- */ -void ComputeEventDisplace::reset_extra_compute_fix(char *id_new) +void ComputeEventDisplace::reset_extra_compute_fix(const char *id_new) { delete [] id_event; id_event = NULL; diff --git a/src/REPLICA/compute_event_displace.h b/src/REPLICA/compute_event_displace.h index a8b197b840..87135d2be4 100644 --- a/src/REPLICA/compute_event_displace.h +++ b/src/REPLICA/compute_event_displace.h @@ -30,7 +30,7 @@ class ComputeEventDisplace : public Compute { ~ComputeEventDisplace(); void init(); double compute_scalar(); - void reset_extra_compute_fix(char *); + void reset_extra_compute_fix(const char *); private: int triclinic; diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index ff20afe735..cc0ec9d0cf 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -768,12 +768,12 @@ void PRD::options(int narg, char **arg) maxeval = 50; temp_flag = 0; - char *str = "geom"; + char *str = (char *) "geom"; int n = strlen(str) + 1; loop_setting = new char[n]; strcpy(loop_setting,str); - str = "gaussian"; + str = (char *) "gaussian"; n = strlen(str) + 1; dist_setting = new char[n]; strcpy(dist_setting,str); diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 50e352ebd5..9bc23ac488 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -932,16 +932,16 @@ void TAD::compute_tlo(int ievent) // update first event - char* statstr = "D "; + char* statstr = (char *) "D "; if (ievent == 0) { deltfirst = deltlo; event_first = ievent; - statstr = "DF"; + statstr = (char *) "DF"; } else if (deltlo < deltfirst) { deltfirst = deltlo; event_first = ievent; - statstr = "DF"; + statstr = (char *) "DF"; } // first-replica output about each event diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 1ba47ee146..267989f309 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -175,8 +175,8 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; - newarg[1] = "all"; - newarg[2] = "temp"; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tflag = 1; @@ -192,8 +192,8 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : newarg = new char*[4]; newarg[0] = id_press; - newarg[1] = "all"; - newarg[2] = "pressure"; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "pressure"; newarg[3] = id_temp; modify->add_compute(4,newarg); delete [] newarg; diff --git a/src/compute.cpp b/src/compute.cpp index 5b8dc93f2a..b33fe7595e 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -44,7 +44,8 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) for (int i = 0; i < n-1; i++) if (!isalnum(id[i]) && id[i] != '_') - error->all(FLERR,"Compute ID must be alphanumeric or underscore characters"); + error->all(FLERR, + "Compute ID must be alphanumeric or underscore characters"); igroup = group->find(arg[1]); if (igroup == -1) error->all(FLERR,"Could not find compute group ID"); @@ -135,9 +136,10 @@ void Compute::reset_extra_dof() /* ---------------------------------------------------------------------- */ -void Compute::reset_extra_compute_fix(char *) +void Compute::reset_extra_compute_fix(const char *) { - error->all(FLERR,"Compute does not allow an extra compute or fix to be reset"); + error->all(FLERR, + "Compute does not allow an extra compute or fix to be reset"); } /* ---------------------------------------------------------------------- diff --git a/src/compute.h b/src/compute.h index 899f8243e3..e8f185ee24 100644 --- a/src/compute.h +++ b/src/compute.h @@ -103,7 +103,7 @@ class Compute : protected Pointers { virtual void restore_bias(int, double *) {} virtual void restore_bias_all() {} - virtual void reset_extra_compute_fix(char *); + virtual void reset_extra_compute_fix(const char *); void addstep(bigint); int matchstep(bigint); diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index edd6910cce..5f981db3cc 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -277,7 +277,7 @@ void ComputePressure::virial_compute(int n, int ndiag) /* ---------------------------------------------------------------------- */ -void ComputePressure::reset_extra_compute_fix(char *id_new) +void ComputePressure::reset_extra_compute_fix(const char *id_new) { delete [] id_temp; int n = strlen(id_new) + 1; diff --git a/src/compute_pressure.h b/src/compute_pressure.h index 44524228e9..ab59481141 100644 --- a/src/compute_pressure.h +++ b/src/compute_pressure.h @@ -31,7 +31,7 @@ class ComputePressure : public Compute { void init(); double compute_scalar(); void compute_vector(); - void reset_extra_compute_fix(char *); + void reset_extra_compute_fix(const char *); protected: double boltz,nktv2p,inv_volume; diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 2365fb3e2e..a9dfdcc03c 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -74,13 +74,13 @@ void DumpAtom::init_style() // setup column string if (scale_flag == 0 && image_flag == 0) - columns = "id type x y z"; + columns = (char *) "id type x y z"; else if (scale_flag == 0 && image_flag == 1) - columns = "id type x y z ix iy iz"; + columns = (char *) "id type x y z ix iy iz"; else if (scale_flag == 1 && image_flag == 0) - columns = "id type xs ys zs"; + columns = (char *) "id type xs ys zs"; else if (scale_flag == 1 && image_flag == 1) - columns = "id type xs ys zs ix iy iz"; + columns = (char *) "id type xs ys zs ix iy iz"; // setup function ptrs diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 16f677327e..eeef5adf10 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1833,9 +1833,9 @@ double *DumpImage::value2color(double value) search user-defined color names first, then the list of NCOLORS names ------------------------------------------------------------------------- */ -double *DumpImage::color2rgb(char *color) +double *DumpImage::color2rgb(const char *color) { - static char *name[NCOLORS] = { + static const char *name[NCOLORS] = { "aliceblue", "antiquewhite", "aqua", @@ -2136,8 +2136,7 @@ double *DumpImage::color2rgb(char *color) double *DumpImage::element2color(char *element) { - - static char *name[NELEMENTS] = { + static const char *name[NELEMENTS] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", @@ -2276,7 +2275,7 @@ double *DumpImage::element2color(char *element) double DumpImage::element2diam(char *element) { - static char *name[NELEMENTS] = { + static const char *name[NELEMENTS] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", diff --git a/src/dump_image.h b/src/dump_image.h index fd72ea3d13..a464202113 100644 --- a/src/dump_image.h +++ b/src/dump_image.h @@ -152,7 +152,7 @@ class DumpImage : public DumpCustom { void write_PPM(); double *value2color(double); - double *color2rgb(char *); + double *color2rgb(const char *); double *element2color(char *); double element2diam(char *); diff --git a/src/dump_local.cpp b/src/dump_local.cpp index c95f77e7c0..f44781194a 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -88,7 +88,7 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : // setup default label string - char *str = "ENTRIES"; + char *str = (char *) "ENTRIES"; n = strlen(str) + 1; label = new char[n]; strcpy(label,str); diff --git a/src/error.cpp b/src/error.cpp index 9465a6f97c..350f8fe1fb 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -129,7 +129,7 @@ void Error::warning(const char *file, int line, const char *str, int logflag) write message to screen and logfile (if logflag is set) ------------------------------------------------------------------------- */ -void Error::message(const char *file, int line, char *str, int logflag) +void Error::message(const char *file, int line, const char *str, int logflag) { if (screen) fprintf(screen,"%s (%s:%d)\n",str,file,line); if (logflag && logfile) fprintf(logfile,"%s (%s:%d)\n",str,file,line); diff --git a/src/error.h b/src/error.h index 28595ac876..df25f7c41a 100644 --- a/src/error.h +++ b/src/error.h @@ -28,7 +28,7 @@ class Error : protected Pointers { void all(const char *, int, const char *); void one(const char *, int, const char *); void warning(const char *, int, const char *, int = 1); - void message(const char *, int, char *, int = 1); + void message(const char *, int, const char *, int = 1); void done(); }; diff --git a/src/input.cpp b/src/input.cpp index b0358004d8..f04717e523 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1167,9 +1167,9 @@ void Input::package() } else if (strcmp(arg[0],"gpu") == 0) { char **fixarg = new char*[2+narg]; - fixarg[0] = "package_gpu"; - fixarg[1] = "all"; - fixarg[2] = "GPU"; + fixarg[0] = (char *) "package_gpu"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "GPU"; for (int i = 1; i < narg; i++) fixarg[i+2] = arg[i]; modify->allow_early_fix = 1; modify->add_fix(2+narg,fixarg,NULL); @@ -1178,9 +1178,9 @@ void Input::package() } else if (strcmp(arg[0],"omp") == 0) { char **fixarg = new char*[2+narg]; - fixarg[0] = "package_omp"; - fixarg[1] = "all"; - fixarg[2] = "OMP"; + fixarg[0] = (char *) "package_omp"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "OMP"; for (int i = 1; i < narg; i++) fixarg[i+2] = arg[i]; modify->allow_early_fix = 1; modify->add_fix(2+narg,fixarg,NULL); diff --git a/src/kspace.cpp b/src/kspace.cpp index 116535f8ee..aa50ec1cd7 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -73,7 +73,7 @@ void KSpace::modify_params(int narg, char **arg) /* ---------------------------------------------------------------------- */ -void *KSpace::extract(char *str) +void *KSpace::extract(const char *str) { if (strcmp(str,"scale") == 0) return (void *) &scale; return NULL; diff --git a/src/kspace.h b/src/kspace.h index 2e4a7e8cb6..fa54e48375 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -29,7 +29,7 @@ class KSpace : protected Pointers { KSpace(class LAMMPS *, int, char **); virtual ~KSpace() {} void modify_params(int, char **); - void *extract(char *); + void *extract(const char *); virtual void init() = 0; virtual void setup() = 0; diff --git a/src/min.cpp b/src/min.cpp index eebfd03dcd..d4e841e2a0 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -750,15 +750,15 @@ double Min::fnorm_inf() char *Min::stopstrings(int n) { - char *strings[] = {"max iterations", - "max force evaluations", - "energy tolerance", - "force tolerance", - "search direction is not downhill", - "linesearch alpha is zero", - "forces are zero", - "quadratic factors are zero", - "trust region too small", - "HFTN minimizer error"}; - return strings[n]; + const char *strings[] = {"max iterations", + "max force evaluations", + "energy tolerance", + "force tolerance", + "search direction is not downhill", + "linesearch alpha is zero", + "forces are zero", + "quadratic factors are zero", + "trust region too small", + "HFTN minimizer error"}; + return (char *) strings[n]; } diff --git a/src/modify.cpp b/src/modify.cpp index c07416ac44..aeafe61d57 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -839,7 +839,7 @@ void Modify::modify_compute(int narg, char **arg) delete a Compute from list of Computes ------------------------------------------------------------------------- */ -void Modify::delete_compute(char *id) +void Modify::delete_compute(const char *id) { int icompute = find_compute(id); if (icompute < 0) error->all(FLERR,"Could not find compute ID to delete"); @@ -856,7 +856,7 @@ void Modify::delete_compute(char *id) return index of compute or -1 if not found ------------------------------------------------------------------------- */ -int Modify::find_compute(char *id) +int Modify::find_compute(const char *id) { int icompute; for (icompute = 0; icompute < ncompute; icompute++) diff --git a/src/modify.h b/src/modify.h index 21c2981435..695d314294 100644 --- a/src/modify.h +++ b/src/modify.h @@ -88,8 +88,8 @@ class Modify : protected Pointers { void add_compute(int, char **, char *suffix = NULL); void modify_compute(int, char **); - void delete_compute(char *); - int find_compute(char *); + void delete_compute(const char *); + int find_compute(const char *); void clearstep_compute(); void addstep_compute(bigint); void addstep_compute_all(bigint); diff --git a/src/pair.h b/src/pair.h index a1dca5c744..756c894dec 100644 --- a/src/pair.h +++ b/src/pair.h @@ -120,7 +120,7 @@ class Pair : protected Pointers { // specific child-class methods for certain Pair styles - virtual void *extract(char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return NULL;} virtual void swap_eam(double *, double **) {} virtual void reset_dt() {} virtual void min_xf_pointers(int, double **, double **) {} diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 271b7b1f7a..68905a95d2 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -399,7 +399,7 @@ double PairBorn::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairBorn::extract(char *str, int &dim) +void *PairBorn::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; diff --git a/src/pair_born.h b/src/pair_born.h index bc5943d3d8..566fdc7c44 100644 --- a/src/pair_born.h +++ b/src/pair_born.h @@ -38,7 +38,7 @@ class PairBorn : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 1a3464e27e..abd3d2dada 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -369,7 +369,7 @@ double PairBuck::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairBuck::extract(char *str, int &dim) +void *PairBuck::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; diff --git a/src/pair_buck.h b/src/pair_buck.h index 4feeaae2b7..fe9034329c 100644 --- a/src/pair_buck.h +++ b/src/pair_buck.h @@ -37,7 +37,7 @@ class PairBuck : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index fbe2bfdfc2..2fb10dabd6 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -300,7 +300,7 @@ double PairCoulCut::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -void *PairCoulCut::extract(char *str, int &dim) +void *PairCoulCut::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; diff --git a/src/pair_coul_cut.h b/src/pair_coul_cut.h index 4835b32e89..6e3e1fdc85 100644 --- a/src/pair_coul_cut.h +++ b/src/pair_coul_cut.h @@ -38,7 +38,7 @@ class PairCoulCut : public Pair { virtual void write_restart_settings(FILE *); virtual void read_restart_settings(FILE *); virtual double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 4649cdb0e2..820d1e8b7e 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -327,7 +327,7 @@ double PairGauss::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ -void *PairGauss::extract(char *str, int &dim) +void *PairGauss::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; diff --git a/src/pair_gauss.h b/src/pair_gauss.h index fe0f6a65b3..115a8948be 100644 --- a/src/pair_gauss.h +++ b/src/pair_gauss.h @@ -37,7 +37,7 @@ class PairGauss : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 71a1366001..20f72100f6 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -676,7 +676,7 @@ double PairHybrid::memory_usage() for cut_coul, insure all non-NULL results are equal since required by Kspace ------------------------------------------------------------------------- */ -void *PairHybrid::extract(char *str, int &dim) +void *PairHybrid::extract(const char *str, int &dim) { void *cutptr = NULL; void *ptr; diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index db0459deae..6b4bf80517 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -47,7 +47,7 @@ class PairHybrid : public Pair { void compute_inner(); void compute_middle(); void compute_outer(int, int); - void *extract(char *, int &); + void *extract(const char *, int &); void reset_dt(); int check_ijtype(int, int, char *); diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index f5ea2887d3..69add0d110 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -696,7 +696,7 @@ double PairLJCut::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ -void *PairLJCut::extract(char *str, int &dim) +void *PairLJCut::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; diff --git a/src/pair_lj_cut.h b/src/pair_lj_cut.h index 200f4ab434..8eb4a4867e 100644 --- a/src/pair_lj_cut.h +++ b/src/pair_lj_cut.h @@ -39,7 +39,7 @@ class PairLJCut : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); void compute_inner(); void compute_middle(); diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index 63f0b72b05..fb2889ddfc 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -299,7 +299,7 @@ double PairSoft::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ -void *PairSoft::extract(char *str, int &dim) +void *PairSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) prefactor; diff --git a/src/pair_soft.h b/src/pair_soft.h index 0156a877ee..c5927cefda 100644 --- a/src/pair_soft.h +++ b/src/pair_soft.h @@ -40,7 +40,7 @@ class PairSoft : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_table.cpp b/src/pair_table.cpp index c27c667abc..b2c34d98bc 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -947,7 +947,7 @@ double PairTable::single(int i, int j, int itype, int jtype, double rsq, no way to know which tables are active since pair::init() not yet called ------------------------------------------------------------------------- */ -void *PairTable::extract(char *str, int &dim) +void *PairTable::extract(const char *str, int &dim) { if (strcmp(str,"cut_coul") != 0) return NULL; if (ntables == 0) error->all(FLERR,"All pair coeffs are not set"); @@ -955,7 +955,8 @@ void *PairTable::extract(char *str, int &dim) double cut_coul = tables[0].cut; for (int m = 1; m < ntables; m++) if (tables[m].cut != cut_coul) - error->all(FLERR,"Pair table cutoffs must all be equal to use with KSpace"); + error->all(FLERR, + "Pair table cutoffs must all be equal to use with KSpace"); dim = 0; return &tables[0].cut; } diff --git a/src/pair_table.h b/src/pair_table.h index 80c8f556ca..11ffa4d758 100644 --- a/src/pair_table.h +++ b/src/pair_table.h @@ -38,7 +38,7 @@ class PairTable : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); double single(int, int, int, int, double, double, double, double &); - void *extract(char *, int &); + void *extract(const char *, int &); protected: int tabstyle,tablength; diff --git a/src/read_data.cpp b/src/read_data.cpp index 872076b112..31addac3a5 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -325,7 +325,7 @@ void ReadData::header(int flag) // customize for new sections - char *section_keywords[NSECTIONS] = + const char *section_keywords[NSECTIONS] = {"Atoms","Velocities","Ellipsoids","Lines","Triangles", "Bonds","Angles","Dihedrals","Impropers", "Masses","Pair Coeffs","Bond Coeffs","Angle Coeffs", @@ -604,7 +604,7 @@ void ReadData::velocities() to find atoms, must build atom map if not a molecular system ------------------------------------------------------------------------- */ -void ReadData::bonus(bigint nbonus, AtomVec *ptr, char *type) +void ReadData::bonus(bigint nbonus, AtomVec *ptr, const char *type) { int i,m,nchunk; @@ -1426,7 +1426,7 @@ void ReadData::skip_lines(int n) if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2" ------------------------------------------------------------------------- */ -void ReadData::parse_coeffs(char *line, char *addstr, int dupflag) +void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag) { char *ptr; if (ptr = strchr(line,'#')) *ptr = '\0'; @@ -1439,9 +1439,9 @@ void ReadData::parse_coeffs(char *line, char *addstr, int dupflag) arg = (char **) memory->srealloc(arg,maxarg*sizeof(char *),"read_data:arg"); } - if (addstr && narg == 1 && !islower(word[0])) arg[narg++] = addstr; + if (addstr && narg == 1 && !islower(word[0])) arg[narg++] = (char *) addstr; arg[narg++] = word; - if (addstr && narg == 2 && islower(word[0])) arg[narg++] = addstr; + 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"); } diff --git a/src/read_data.h b/src/read_data.h index 6426054a44..9ef79f7060 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -51,11 +51,11 @@ class ReadData : protected Pointers { void header(int); void parse_keyword(int, int); void skip_lines(int); - void parse_coeffs(char *, char *, int); + void parse_coeffs(char *, const char *, int); void atoms(); void velocities(); - void bonus(bigint, class AtomVec *, char *); + void bonus(bigint, class AtomVec *, const char *); void bonds(); void angles(); diff --git a/src/thermo.cpp b/src/thermo.cpp index 57cfd4d45b..7dadacd8a6 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -134,7 +134,7 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // format strings - char *bigint_format = BIGINT_FORMAT; + char *bigint_format = (char *) BIGINT_FORMAT; char *fformat_multi = (char *) "---------------- Step %%8%s ----- " "CPU = %%11.4f (sec) ----------------"; diff --git a/src/velocity.cpp b/src/velocity.cpp index ef95a873a7..eb46bc0f6b 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -114,7 +114,7 @@ void Velocity::command(int narg, char **arg) initialization of defaults before calling velocity methods externaly ------------------------------------------------------------------------- */ -void Velocity::init_external(char *extgroup) +void Velocity::init_external(const char *extgroup) { igroup = group->find(extgroup); if (igroup == -1) error->all(FLERR,"Could not find velocity group ID"); diff --git a/src/velocity.h b/src/velocity.h index 251c366ced..c640433946 100644 --- a/src/velocity.h +++ b/src/velocity.h @@ -28,7 +28,7 @@ class Velocity : protected Pointers { public: Velocity(class LAMMPS *); void command(int, char **); - void init_external(char *); + void init_external(const char *); void options(int, char **); void create(double, int);