Skip to content

Add convenience method to Molecule to return whether user has provided partial charges #488

@jchodera

Description

@jchodera

Is your feature request related to a problem? Please describe.
Currently, there's no reliable way to determine whether a user has set partial charges for a Molecule object. We can check if the charges are all zero, but that doesn't necessarily mean the user hasn't set them all to zero. If we had a simple API for determining whether user-specified charges are present, we could simplify choices about whether or not to use charges from user-provided molecules.

Describe the solution you'd like
We will have to carefully think through the implications, but one simple approach could be

  • Molecule charge fields are None if not defined (e.g. because the molecule was programmatically constructed or read from an SDF file that lacks charges)
  • Molecule.partial_charges is not None would be a simple idiom for determining whether charges are present

Describe alternatives you've considered
Currently, the only way to tell if user-specified charges may be present is to check if all charges are zero---something that is not guaranteed to produce the desired result and for which we do not even have a convenience function.

Additional context
I'm trying to determine how we should indicate that user-provided charges should be used in openmm-forcefields: openmm/openmmforcefields#88

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions