@@ -269,11 +269,58 @@ def test_restraint_mdr(tmp_path, restraint_mdr):
269
269
assert "permanent distance restraints dictionary" in lines [- 1 ]
270
270
271
271
272
+ def test_triclinic ():
273
+ """
274
+ Test the triclinic box vectors can be updated correctly with OpenMM 8.2+.
275
+ """
276
+
277
+ # Load the triclinic alanine dipeptide system.
278
+ system = BSS .IO .readMolecules (
279
+ BSS .IO .expand (url , ["ala_triclinic.rst7" , "ala_triclinic.prm7" ])
280
+ )
281
+
282
+ # Create a short production protocol.
283
+ protocol = BSS .Protocol .Production (runtime = BSS .Types .Time (0.001 , "nanoseconds" ))
284
+
285
+ # Run the process, check that it finished without error, and returns a system.
286
+ run_process (system , protocol )
287
+
288
+
289
+ def test_triclinic_fep ():
290
+ """
291
+ Test the triclinic box vectors can be updated correctly with OpenMM 8.2+.
292
+ """
293
+
294
+ # Load the triclinic alanine dipeptide system.
295
+ system = BSS .IO .readPerturbableSystem (
296
+ * BSS .IO .expand (
297
+ url ,
298
+ [
299
+ "ethane_methanol_triclinic0.prm7" ,
300
+ "ethane_methanol_triclinic0.rst7" ,
301
+ "ethane_methanol_triclinic1.prm7" ,
302
+ "ethane_methanol_triclinic1.rst7" ,
303
+ ],
304
+ )
305
+ )
306
+
307
+ # Create a short production FEP protocol.
308
+ protocol = BSS .Protocol .FreeEnergy (runtime = 0.1 * BSS .Units .Time .picosecond )
309
+
310
+ # Run the process, check that it finished without error, and returns a system.
311
+ run_process (system , protocol )
312
+
313
+
272
314
def run_process (system , protocol , ** kwargs ):
273
315
"""Helper function to run various simulation protocols."""
274
316
317
+ # Use CUDA platform is CUDA_VISIBLE_DEVICES is set.
318
+ platform = "CUDA" if "CUDA_VISIBLE_DEVICES" in os .environ else "CPU"
319
+
275
320
# Initialise the SOMD process.
276
- process = BSS .Process .Somd (system , protocol , name = "test" , platform = "CPU" , ** kwargs )
321
+ process = BSS .Process .Somd (
322
+ system , protocol , name = "test" , platform = platform , ** kwargs
323
+ )
277
324
278
325
# Start the SOMD simulation.
279
326
process .start ()
0 commit comments