From d906eda847aa76949863c90fcdf9c6c6e623676c Mon Sep 17 00:00:00 2001 From: Ryan Kingsbury Date: Mon, 18 Jul 2022 17:46:15 -0700 Subject: [PATCH] utils: fix units of nonbondedCutoff calc --- pymatgen/io/openmm/generators.py | 2 +- pymatgen/io/openmm/utils.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pymatgen/io/openmm/generators.py b/pymatgen/io/openmm/generators.py index a934b1b..5dbceb0 100644 --- a/pymatgen/io/openmm/generators.py +++ b/pymatgen/io/openmm/generators.py @@ -181,7 +181,7 @@ def get_input_set( # type: ignore Args: smiles: keys are smiles and values are number of that molecule to pack density: the density of the system. density OR box must be given as an argument. - box: list of [xlo, ylo, zlo, xhi, yhi, zhi]. density OR box must be given as an argument. + box: list of [xlo, ylo, zlo, xhi, yhi, zhi] with coordinates given in Angstroms. Density OR box must be given as an argument. Returns: an OpenMM.InputSet diff --git a/pymatgen/io/openmm/utils.py b/pymatgen/io/openmm/utils.py index b612371..65c52c4 100644 --- a/pymatgen/io/openmm/utils.py +++ b/pymatgen/io/openmm/utils.py @@ -576,7 +576,9 @@ def parameterize_system( forcefield_omm.registerTemplateGenerator(template.generator) box_size = min(box[3] - box[0], box[4] - box[1], box[5] - box[2]) - nonbondedCutoff = min(10, box_size // 2) + # NOTE: cutoff is in nm, not Angstrom! + # box_size is calculated in Angstrom. Convert to nm here + nonbondedCutoff = min(1, box_size // 20) # TODO: Make insensitive to input units periodic_box_vectors = np.array( [