From 62e96095c43c937465b5f561ba8906b59da2d7d5 Mon Sep 17 00:00:00 2001 From: Jake Anderson Date: Tue, 5 Sep 2023 16:57:35 -0700 Subject: [PATCH] Use gasteiger instead of am1bcc for large mols --- openmmforcefields/generators/template_generators.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openmmforcefields/generators/template_generators.py b/openmmforcefields/generators/template_generators.py index cd20244..12b19dc 100644 --- a/openmmforcefields/generators/template_generators.py +++ b/openmmforcefields/generators/template_generators.py @@ -607,11 +607,16 @@ def generate_residue_template(self, molecule, residue_atoms=None): if self._molecule_has_user_charges(molecule): _logger.debug(f'Using user-provided charges because partial charges are nonzero...') else: - _logger.debug(f'Computing AM1-BCC charges...') + _logger.debug(f'Computing partial charges...') # NOTE: generate_conformers seems to be required for some molecules # https://github.com/openforcefield/openff-toolkit/issues/492 molecule.generate_conformers(n_conformers=10) - molecule.assign_partial_charges(partial_charge_method='am1bcc') + if len(molecule.atoms) >= 150: + _logger.info(f'Molecule has >= 150 atoms ({len(molecule.atoms)}), using Gasteiger...') + partial_charge_method = 'gasteiger' + else: + partial_charge_method = 'am1bcc' + molecule.assign_partial_charges(partial_charge_method=partial_charge_method) # Geneate a single conformation _logger.debug(f'Generating a conformer...')