From 10644138e7e9ef5fbbb9e41f63fc39a2b8c2b451 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 17 May 2024 11:07:25 +0100 Subject: [PATCH] Pass property map as kwarg and make sure box is reduced. [closes #291] [closes openbiosim/sire#197] --- nodes/playground/prepareFEP.ipynb | 15 +++++++++++---- nodes/playground/prepareFEP.py | 9 ++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/nodes/playground/prepareFEP.ipynb b/nodes/playground/prepareFEP.ipynb index a9929c669..688439b4c 100644 --- a/nodes/playground/prepareFEP.ipynb +++ b/nodes/playground/prepareFEP.ipynb @@ -317,7 +317,10 @@ ")\n", "# Create a composite system\n", "system1.removeMolecules(lig1)\n", - "system1.addMolecules(merged)" + "system1.addMolecules(merged)\n", + "# Make sure the box vectors are in reduced form.\n", + "system1.reduceBoxVectors()\n", + "system1.rotateBoxVectors()" ] }, { @@ -336,7 +339,11 @@ " \"merged_at_lam0.pdb\",\n", " merged,\n", " \"PDB\",\n", - " {\"coordinates\": \"coordinates0\", \"bond\": \"bond0\", \"element\": \"element0\"},\n", + " property_map={\n", + " \"coordinates\": \"coordinates0\",\n", + " \"bond\": \"bond0\",\n", + " \"element\": \"element0\",\n", + " },\n", ")\n", "if is_somd2:\n", " BSS.Stream.save(system1, root)\n", @@ -426,9 +433,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.12.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/nodes/playground/prepareFEP.py b/nodes/playground/prepareFEP.py index 5561f7158..39d57e45d 100644 --- a/nodes/playground/prepareFEP.py +++ b/nodes/playground/prepareFEP.py @@ -258,6 +258,9 @@ def loadMapping(mapping_file): # Create a composite system system1.removeMolecules(lig1) system1.addMolecules(merged) +# Make sure the box vectors are in reduced form. +system1.reduceBoxVectors() +system1.rotateBoxVectors() # In[ ]: @@ -273,7 +276,11 @@ def loadMapping(mapping_file): "merged_at_lam0.pdb", merged, "PDB", - {"coordinates": "coordinates0", "bond": "bond0", "element": "element0"}, + property_map={ + "coordinates": "coordinates0", + "bond": "bond0", + "element": "element0", + }, ) if is_somd2: BSS.Stream.save(system1, root)