diff --git a/doc/src/dihedral_hybrid.rst b/doc/src/dihedral_hybrid.rst index add0d4d282..998a752275 100644 --- a/doc/src/dihedral_hybrid.rst +++ b/doc/src/dihedral_hybrid.rst @@ -57,7 +57,7 @@ If *class2* is one of the dihedral hybrid styles, the same rule holds for specifying additional AngleTorsion (and EndBondTorsion, etc) coefficients either via the input script or in the data file. I.e. *class2* must be added to each line after the dihedral type. For -lines in the AngleTorsion (or EndBondTorsion, etc) section of the data +lines in the AngleTorsion (or EndBondTorsion, etc) Coeffs section of the data file for dihedral types that are not *class2*, you must use an dihedral style of *skip* as a placeholder, e.g. diff --git a/doc/src/improper_hybrid.rst b/doc/src/improper_hybrid.rst index cc26e14ce5..7c070d2e9c 100644 --- a/doc/src/improper_hybrid.rst +++ b/doc/src/improper_hybrid.rst @@ -40,13 +40,38 @@ potential with coefficients 120.0, 30 for :math:`K`, :math:`\chi_0`. Improper type 2 would be computed with a *cvff* potential with coefficients 20.0, -1, 2 for K, d, and n, respectively. -If the improper *class2* potential is one of the hybrid styles, it -requires additional AngleAngle coefficients be specified in the data -file. These lines must also have an additional "class2" argument -added after the improper type. For improper types which are assigned -to other hybrid styles, use the style name (e.g. "harmonic") -appropriate to that style. The AngleAngle coeffs for that improper -type will then be ignored. +If improper coefficients are specified in the data file read via the +:doc:`read_data ` command, then the same rule applies. +E.g. "harmonic" or "cvff", must be added after the improper type, for +each line in the "Improper Coeffs" section, e.g. + +.. parsed-literal:: + + Improper Coeffs + + 1 harmonic 120.0 30 + 2 cvff 20.0 -1 2 + ... + +If *class2* is one of the improper hybrid styles, the same rule holds +for specifying additional AngleAngle coefficients either via the input +script or in the data file. I.e. *class2* must be added to each line +after the improper type. For +lines in the AngleAngle Coeffs section of the data +file for dihedral types that are not *class2*, you must use an +improper style of *skip* as a placeholder, e.g. + +.. parsed-literal:: + + AngleAngle Coeffs + + 1 skip + 2 class2 0.0 0.0 0.0 115.06 130.01 115.06 + ... + +Note that it is not necessary to use the improper style *skip* in the +input script, since AngleAngle coefficients +need not be specified at all for improper types that are not *class2*. An improper style of *none* can be specified as the second argument to the improper_coeff command, if you desire to turn off certain improper diff --git a/src/pair.h b/src/pair.h index c4a5d3678c..0c082fa1c5 100644 --- a/src/pair.h +++ b/src/pair.h @@ -30,6 +30,7 @@ class Pair : protected Pointers { friend class FixOMP; friend class FixQEq; friend class PairHybrid; + friend class PairHybridScaled; friend class ThrOMP; friend class Info; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 8f97451347..550f5c6873 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -569,7 +569,7 @@ void PairHybrid::init_style() // same style must not be used multiple times for (istyle = 0; istyle < nstyles; istyle++) { - bool is_gpu = (((PairHybrid *)styles[istyle])->suffix_flag & Suffix::GPU); + bool is_gpu = styles[istyle]->suffix_flag & Suffix::GPU; if (multiple[istyle] && is_gpu) error->all(FLERR,"GPU package styles must not be used multiple times"); } diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 90d1747075..367afe7809 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -340,8 +340,7 @@ void PairHybridScaled::settings(int narg, char **arg) special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; - if ((((PairHybridScaled *)styles[nstyles])->suffix_flag - & (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0) + if ((styles[nstyles]->suffix_flag & (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0) error->all(FLERR,"Pair style hybrid/scaled does not support " "accelerator styles"); diff --git a/src/variable.cpp b/src/variable.cpp index 953d0ddf85..2ef1957a09 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -5122,7 +5122,7 @@ int VarReader::read_scalar(char *str) if (n == 1) continue; // skip if blank line break; } - memmove(str,ptr,n); // move trimmed string back + if (n > 0) memmove(str,ptr,n); // move trimmed string back } MPI_Bcast(&n,1,MPI_INT,0,world); if (n == 0) return 1;