SamplerState.apply_to_context() erroneously applies box-vectors *after* positions are set
A major bug is present in [the code for `SamplerState.apply_to_context()`](https://github.com/choderalab/openmmtools/blob/master/openmmtools/states.py#L1701-L1721):
```python
        context.setPositions(self._positions)
        if self._velocities is not None and not ignore_velocities:
            context.setVelocities(self._velocities)
        if self.box_vectors is not None:
            context.setPeriodicBoxVectors(*self.box_vectors)
```
On Reference, this doesn't cause problems, but on OpenCL, the [`setPositions`](OpenCLUpdateStateDataKernel) method causes a call to [`reorderAtoms()](https://github.com/pandegroup/openmm/blob/7cdd6d16348b051e97f162580f908ace13be0e25/platforms/opencl/src/OpenCLKernels.cpp#L267-L269) which [uses the periodic box vectors](https://github.com/pandegroup/openmm/blob/33e2c3cd52af27ae13df06e4769bf168cae882d5/platforms/cuda/src/CudaContext.cpp#L1256-L1289). CUDA is presumably the same as OpenCL.
diff --git a/openmmtools/states.py b/openmmtools/states.py
index b5498f4..c185e12 100644
--- a/openmmtools/states.py
+++ b/openmmtools/states.py
@@ -1714,11 +1714,12 @@ class SamplerState(object):
             Context only to compute energies.
 
         """
+        # NOTE: Box vectors MUST be updated before positions are set.
+        if self.box_vectors is not None:
+            context.setPeriodicBoxVectors(*self.box_vectors)
         context.setPositions(self._positions)
         if self._velocities is not None and not ignore_velocities:
             context.setVelocities(self._velocities)
-        if self.box_vectors is not None:
-            context.setPeriodicBoxVectors(*self.box_vectors)
 
     def has_nan(self):
         """Check that energies and positions are finite.
['openmmtools/states.py']