diff --git a/news/issue-162.rst b/news/issue-162.rst new file mode 100644 index 0000000..844ce46 --- /dev/null +++ b/news/issue-162.rst @@ -0,0 +1,28 @@ +**Added:** + +* + +**Changed:** + +* In line with Interchange v0.5+, the box is no longer being scaled by 1.1 + when defining the ``number_of_solvent_molecules``. In those cases, the + resulting box density will be much higher. + To roughly reproduce previous behavior, we recommend reducing the + ``target_density`` to 0.715 * unit.grams / unit.mL when + defining ``number_of_solvent_molecules``. + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/pontibus/tests/protocols/relative/test_protocol.py b/src/pontibus/tests/protocols/relative/test_protocol.py index 9552441..ac357ac 100644 --- a/src/pontibus/tests/protocols/relative/test_protocol.py +++ b/src/pontibus/tests/protocols/relative/test_protocol.py @@ -586,6 +586,7 @@ def test_dry_run_complex_setnwaters( solv_settings.solvation_settings = PackmolSolvationSettings( number_of_solvent_molecules=15000, solvent_padding=None, + target_density=0.715 * unit.grams / unit.mL, ) protocol = HybridTopProtocol(settings=solv_settings) diff --git a/src/pontibus/tests/utils/test_system_creation.py b/src/pontibus/tests/utils/test_system_creation.py index 7a93312..e125044 100644 --- a/src/pontibus/tests/utils/test_system_creation.py +++ b/src/pontibus/tests/utils/test_system_creation.py @@ -577,6 +577,7 @@ def test_nonwater_solvent_short(smc_components_benzene_named, smiles): solvent_padding=None, number_of_solvent_molecules=100, assign_solvent_charges=True, + target_density=0.715 * unit.grams / unit.mL, ), smc_components=smc_components_benzene_named, protein_component=None, @@ -1007,6 +1008,7 @@ def test_nonwater_solvent_long(solvent_smiles, solute_smiles): solvent_padding=None, number_of_solvent_molecules=1000, assign_solvent_charges=True, + target_density=0.715 * unit.grams / unit.mL, ), smc_components={ligand_smc: ligand_offmol}, protein_component=None, @@ -1852,7 +1854,9 @@ def interchange_system(self, water_off, request): ], ), solvation_settings=PackmolSolvationSettings( - number_of_solvent_molecules=500, solvent_padding=None + number_of_solvent_molecules=500, + solvent_padding=None, + target_density=0.715 * unit.grams / unit.mL, ), smc_components=smc_components, protein_component=protein_component, @@ -1962,7 +1966,9 @@ def interchange_system(self, water_off, request, eg5_ligands, eg5_cofactor): ], ), solvation_settings=InterchangeOpenMMSolvationSettings( - number_of_solvent_molecules=100, solvent_padding=None + number_of_solvent_molecules=100, + solvent_padding=None, + target_density=0.715 * unit.grams / unit.mL, ), smc_components=smc_components, protein_component=protein_component, diff --git a/src/pontibus/utils/settings.py b/src/pontibus/utils/settings.py index 91bf8e2..6b23113 100644 --- a/src/pontibus/utils/settings.py +++ b/src/pontibus/utils/settings.py @@ -142,11 +142,12 @@ class BasePontibusSolvationSettings(BaseSolvationSettings): target_density: GramsPerMolQuantity | None = 0.95 * unit.grams / unit.mL # noqa: F821 """ Target mass density for the solvated system in units compatible with g / mL. - Generally a ``target_density`` value of 0.95 * unit.grams / unit.mL is - sufficient, although you may have to aim for a lower value should you find - it difficult to pack your system. + A ``target_density`` value of 0.95 * unit.grams / unit.mL works in many cases, + but may lead to an overly dense system. This is especially true when + defining ``number_of_solvent_molecules``, in this case a value of + 0.715 * unit.grams / unit.mL is recommended. - Default: 0.95 * unit.grams / unit.mL. + Default: 0.715 * unit.grams / unit.mL. Notes ----- diff --git a/src/pontibus/utils/system_solvation.py b/src/pontibus/utils/system_solvation.py index a5a8fa0..62e07ae 100644 --- a/src/pontibus/utils/system_solvation.py +++ b/src/pontibus/utils/system_solvation.py @@ -106,7 +106,7 @@ def _box_density_from_mols( """ Approximate box size with known number and type of molecules. - Generate an approximate box size based on the number and molecular + Generate an approximate box size based on the number and molecular weight of the molecules present, and a target density for the final solvated mixture. @@ -145,7 +145,7 @@ def _box_density_from_mols( total_mass = molecules_total_mass + solute_total_mass volume = total_mass / target_density - return _scale_box(box_shape, volume) + return _scale_box(box_shape, volume, box_scaleup_factor=1.0) def _neutralize_and_pack_box(