Task: Fixed bug in computing pressure (openmm/openmm#4980)

org: openmm
repo: openmm
pr_number: 4980
issue_title: Fixed bug in computing pressure
issue_body: This fixes a bug that caused `computeCurrentPressure()` to return an incorrect value.  The tests were passing only because they happened to set all particle masses to 1.  See https://github.com/openmm/openmm/discussions/4926#discussioncomment-13503249.
resolved_issues: title: Fixed bug in computing pressure
body: The `computeCurrentPressure()` function was returning incorrect pressure values due to an error in how molecular velocities were calculated. This issue was not detected by existing tests because they used a simplified setup where all particle masses were set to 1, masking the problem. 

The expected behavior is that the pressure calculation should correctly account for the masses of particles in the system, ensuring accurate results regardless of the mass distribution. This is critical for simulations involving systems with varying particle masses, where accurate pressure computation is essential for reliable results.

## 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 2d6493fe52..12c739d892 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) numAtoms);
+        molVel *= 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 3d3e536221..ba80d297ff 100644
--- a/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
+++ b/platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
@@ -133,7 +133,7 @@ void ReferenceMonteCarloBarostat::computeMolecularKineticEnergy(const vector<Vec
             molVel += masses[atom]*velocities[atom];
             molMass += masses[atom];
         }
-        molVel /= molecule.size();
+        molVel /= molMass;
         if (components == 1)
             ke[0] += 0.5*molMass*molVel.dot(molVel);
         else {