Skip to content

Commit

Permalink
ENH: Initial implementation of charge assignment logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Sep 19, 2024
1 parent 292faec commit 0320282
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions openff/interchange/smirnoff/_nonbonded.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import functools
import logging
import warnings
from collections.abc import Iterable
from typing import Any, Literal, Optional, Union
Expand Down Expand Up @@ -41,6 +42,8 @@
from openff.interchange.smirnoff._base import SMIRNOFFCollection
from openff.interchange.warnings import ForceFieldModificationWarning

logger = logging.getLogger(__name__)

ElectrostaticsHandlerType = Union[
ElectrostaticsHandler,
ToolkitAM1BCCHandler,
Expand Down Expand Up @@ -501,6 +504,10 @@ def _library_charge_to_potentials(
matches[topology_key] = potential_key
potentials[potential_key] = potential

logger.info(
f"Charge section LibraryCharges applied {charge.m} to atom index {atom_index}",
)

return matches, potentials

@classmethod
Expand Down Expand Up @@ -678,6 +685,11 @@ def _find_charge_model_matches(

matches[SingleAtomChargeTopologyKey(this_atom_index=atom_index)] = potential_key

logger.info(
f"Charge section {handler_name}, method {partial_charge_method}, applied {partial_charge.m} "
f"to atom {atom_index}",
)

return partial_charge_method, matches, potentials

@classmethod
Expand Down Expand Up @@ -815,6 +827,11 @@ def _assign_charges_from_molecules(
matches[topology_key] = potential_key
potentials[potential_key] = potential

logger.info(
f"Atom with topology index {index_in_topology} getting prespecified charge {partial_charge} "
f"from a molecule with mapped smiles {mapped_smiles}",
)

return True, matches, potentials

def store_matches(
Expand Down

0 comments on commit 0320282

Please sign in to comment.