Added checks for non-supported parameters for pimdb/langevin, and updated the documentation accordingly.

This commit is contained in:
Ofir Blumer
2024-12-30 12:41:42 +02:00
parent 53c91e67a1
commit b86832e72f
2 changed files with 35 additions and 14 deletions

View File

@ -30,10 +30,8 @@ Syntax
* keywords for style *pimdb/langevin*
.. parsed-literal::
*keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj*
*method* value = *pimd*
*keywords* = *integrator* or *fmass* or *temp* or *thermostat* or *tau* or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj*
*integrator* value = *obabo* or *baoab*
*fmmode* value = *physical* or *normal*
*fmass* value = scaling factor on mass
*temp* value = temperature (temperature unit)
temperature = target temperature of the thermostat
@ -41,7 +39,6 @@ Syntax
style value = *PILE_L*
seed = random number generator seed
*tau* value = thermostat damping parameter (time unit)
*scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat
*iso* or *aniso* values = pressure (pressure unit)
pressure = scalar external pressure of the barostat
*barostat* value = *BZP* or *MTTK*
@ -60,7 +57,7 @@ Examples
.. code-block:: LAMMPS
fix 1 all pimdb/nvt method pimd fmass 1.0 sp 1.0 temp 2.0 nhc 4
fix 1 all pimdb/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 iso 1.0 barostat BZP taup 1.0
fix 1 all pimdb/langevin integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0
Description
"""""""""""
@ -78,8 +75,13 @@ detailed syntax description and additional, general capabilities of the commands
.. note::
Currently, fix *pimdb/langevin* only supports the "pimd" method, and fix *pimdb/nvt*
only supports the "pimd" and "nmpimd" methods.
Currently, and fix *pimdb/nvt* only supports the "pimd" and "nmpimd" methods.
Fix *pimdb/langevin* only supports the "pimd" method, and the keyword *method* should not be used.
Trying to explicitly set a different method than "pimd" would raise an error.
Similarly, the keywords *ensemble* and *fmmode* should not be used, and would raise an error if set to values
other than *nvt* and *normal*, respectively.
Trying to use the *scale* keywords, that is not supported for "pimd" method, would also raise an error.
Finally, trying to use any of the barostat-related keywords supported for *pimd/langevin* would raise errors.
The isomorphism between the partition function of :math:`N` bosonic quantum particles and that of a system of classical ring polymers
at inverse temperature :math:`\beta`

View File

@ -41,7 +41,9 @@
using namespace LAMMPS_NS;
using namespace FixConst;
enum{PIMD,NMPIMD,CMD};
enum { PIMD };
enum { NVE, NVT, NPH, NPT };
enum { PHYSICAL, NORMAL };
/* ---------------------------------------------------------------------- */
@ -49,15 +51,32 @@ FixPIMDBLangevin::FixPIMDBLangevin(LAMMPS *lmp, int narg, char **arg) :
FixPIMDLangevin(lmp, narg, arg),
bosonic_exchange(lmp, atom->nlocal, np, universe->me, false, true)
{
if (method != PIMD) {
error->universe_all(FLERR, "Method not supported in fix pimdb/langevin; only method PIMD");
}
for (int i = 3; i < narg - 1; i += 2) {
if ((strcmp(arg[i], "method") == 0) && (strcmp(arg[i+1], "pimd") != 0)) {
error->universe_all(FLERR, "Method not supported in fix pimdb/langevin; only method PIMD");
}
else if (strcmp(arg[i], "scale") == 0) {
error->universe_all(FLERR, "The scale parameter of the PILE_L thermostat is not supported for pimdb, and should be removed.");
}
else if ((strcmp(arg[i], "iso") == 0) || (strcmp(arg[i], "aniso") == 0) || (strcmp(arg[i], "barostat") == 0) || (strcmp(arg[i], "taup") == 0)) {
error->universe_all(FLERR, "Barostat parameters are not available for pimdb.");
}
}
size_vector = 6;
if (fmmode != PHYSICAL) {
error->universe_all(FLERR, "The only available fmmode for pimdb is physical, please remove the fmmode keyword.");
}
if (ensemble != NVT) {
error->universe_all(FLERR, "The only available ensemble for pimdb is nvt, please remove the ensemble keyword.");
}
nbosons = atom->nlocal;
method = PIMD;
memory->create(f_tag_order, nbosons, 3, "FixPIMDBLangevin:f_tag_order");
size_vector = 6;
nbosons = atom->nlocal;
memory->create(f_tag_order, nbosons, 3, "FixPIMDBLangevin:f_tag_order");
}
/* ---------------------------------------------------------------------- */