Task: Fixed errors in computeCurrentPressure() (openmm/openmm#5114)

org: openmm
repo: openmm
pr_number: 5114
issue_title: Fixed errors in computeCurrentPressure()
issue_body: This fixes two problems in `computeCurrentPressure()`.  First, if the system contained any massless molecule it would return nan.  Second, the Python API was not adding units to the return values.

Fixes #5113.
resolved_issues: number: 5113
title: Issues with barostat pressure computation
body: I've been trying to use the `computeCurrentPressure()` feature of the barostats and have run into some unusual behavior.

First, in the Python API, `MonteCarloBarostat.computeCurrentPressure()` returns a plain float: should this be a `Quantity` with units of bar?  The anisotropic barostats' return values similarly don't include units.

Also, if even one individual particle is frozen, I am getting NaN, as in this example.
```python
import numpy
import openmm

system = openmm.System()
system.setDefaultPeriodicBoxVectors((16, 0, 0), (0, 16, 0), (0, 0, 16))

lj = openmm.NonbondedForce()
lj.setNonbondedMethod(openmm.NonbondedForce.CutoffPeriodic)

for i in range(1000):
    system.addParticle(10 if i else 0)
    lj.addParticle(0, 0, 0)

system.addForce(lj)

barostat = openmm.MonteCarloBarostat(10, 300)
system.addForce(barostat)

context = openmm.Context(system, openmm.LangevinMiddleIntegrator(300, 1, 0.01))
context.setPositions(numpy.random.uniform(0, 16, (1000, 3)))
context.setVelocitiesToTemperature(300)

print(barostat.computeCurrentPressure(context))
```
If all particles have non-zero masses, this works as expected.  Possibly the molecular velocity calculation should check for this case?  I can investigate further.

## IMPORTANT INSTRUCTIONS

1. If you edit a python file, you MUST run 'make PythonInstall' inside the build directory
2. If you edit a c++ file, you MUST run 'make -j4 && make install" inside the build directory

Reference solution:
fix_patch: diff --git a/platforms/common/src/kernels/monteCarloBarostat.cc b/platforms/common/src/kernels/monteCarloBarostat.cc
index 12c739d892..cc234af324 100644
--- a/platforms/common/src/kernels/monteCarloBarostat.cc
+++ b/platforms/common/src/kernels/monteCarloBarostat.cc
@@ -79,7 +79,7 @@ KERNEL void computeMolecularKineticEnergy(int numMolecules, GLOBAL mixed4* RESTR
             molVel += mass*trimTo3(v);
             molMass += mass;
         }
-        molVel *= RECIP((mixed) molMass);
+        molVel *= (molMass == 0 ? 0 : RECIP((mixed) molMass));
 #if COMPONENTS == 1
         ke[0] += 0.5f*molMass*dot(molVel, molVel);
 #else
diff --git a/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp b/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
index ba80d297ff..44383561c4 100644
--- a/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
+++ b/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
@@ -133,7 +133,8 @@ void ReferenceMonteCarloBarostat::computeMolecularKineticEnergy(const vector<Vec
             molVel += masses[atom]*velocities[atom];
             molMass += masses[atom];
         }
-        molVel /= molMass;
+        if (molMass != 0)
+            molVel /= molMass;
         if (components == 1)
             ke[0] += 0.5*molMass*molVel.dot(molVel);
         else {
diff --git a/wrappers/python/src/swig_doxygen/swigInputConfig.py b/wrappers/python/src/swig_doxygen/swigInputConfig.py
index 7bfd755d0b..0535db2825 100755
--- a/wrappers/python/src/swig_doxygen/swigInputConfig.py
+++ b/wrappers/python/src/swig_doxygen/swigInputConfig.py
@@ -493,6 +493,7 @@
 ("MonteCarloMembraneBarostat", "MonteCarloMembraneBarostat") : (None, ("unit.bar", "unit.bar*unit.nanometer", "unit.kelvin", None, None, None)),
 ("MonteCarloMembraneBarostat", "getXYMode") : (None, ()),
 ("MonteCarloMembraneBarostat", "getZMode") : (None, ()),
+("*", "computeCurrentPressure") : ("unit.bar", ()),
 ("CustomIntegrator", "CustomIntegrator") : (None, ("unit.picosecond",)),
 ("BrownianIntegrator", "BrownianIntegrator") : (None, ("unit.kelvin", "unit.picosecond**-1", "unit.picosecond")),
 ("LangevinIntegrator", "LangevinIntegrator") : (None, ("unit.kelvin", "unit.picosecond**-1", "unit.picosecond")),