How to override default charge assignment?
See original GitHub issueI am currently attempting to parameterize the PF6- anion with the Sage force field:
from openff.toolkit.typing.engines.smirnoff import ForceField
from openff.toolkit.topology import Molecule, Topology
pf6_minus = "F[P-](F)(F)(F)(F)F"
forcefield = ForceField("openff_unconstrained-2.0.0.offxml")
ethanol = Molecule.from_smiles(pf6_minus)
topology = Topology.from_molecules(molecules=[ethanol])
system = forcefield.create_openmm_system(topology)
but I am getting an UnassignedMoleculeChargeException
.
Warning: Unable to load toolkit 'OpenEye Toolkit'. The Open Force Field Toolkit does not require the OpenEye Toolkits, and can use RDKit/AmberTools instead. However, if you have a valid license for the OpenEye Toolkits, consider installing them for faster performance and additional file format support: https://docs.eyesopen.com/toolkits/python/quickstart-python/linuxosx.html OpenEye offers free Toolkit licenses for academics: https://www.eyesopen.com/academic-licensing
[13:59:24] UFFTYPER: Warning: hybridization set to SP3 for atom 1
[13:59:24] UFFTYPER: Unrecognized charge state for atom: 1
/Users/orioncohen/miniconda3/envs/openmm/lib/python3.9/site-packages/openff/toolkit/typing/engines/smirnoff/parameters.py:4155: Warning: No registered toolkits can provide the capability "assign_partial_charges" for args "()" and kwargs "{'molecule': Molecule with name '' and SMILES '[F][P-]([F])([F])([F])([F])[F]', 'partial_charge_method': 'am1bcc', 'use_conformers': None, 'strict_n_conformers': False, 'normalize_partial_charges': True, '_cls': <class 'openff.toolkit.topology.molecule.FrozenMolecule'>}"
Available toolkits are: [ToolkitWrapper around The RDKit version 2021.03.5, ToolkitWrapper around AmberTools version 21.0, ToolkitWrapper around Built-in Toolkit version None]
ToolkitWrapper around The RDKit version 2021.03.5 <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : partial_charge_method 'am1bcc' is not available from RDKitToolkitWrapper. Available charge methods are ['mmff94']
ToolkitWrapper around AmberTools version 21.0 <class 'TypeError'> : 'NoneType' object is not iterable
ToolkitWrapper around Built-in Toolkit version None <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : Partial charge method "am1bcc"" is not supported by the Built-in toolkit. Available charge methods are ['zeros', 'formal_charge']
warnings.warn(str(e), Warning)
Traceback (most recent call last):
File "/Users/orioncohen/projects/lowT/openmm/setup/testing_pf6.py", line 9, in <module>
system = forcefield.create_openmm_system(topology)
File "/Users/orioncohen/miniconda3/envs/openmm/lib/python3.9/site-packages/openff/toolkit/typing/engines/smirnoff/forcefield.py", line 1348, in create_openmm_system
parameter_handler.postprocess_system(system, topology, **kwargs)
File "/Users/orioncohen/miniconda3/envs/openmm/lib/python3.9/site-packages/openff/toolkit/typing/engines/smirnoff/parameters.py", line 3944, in postprocess_system
raise UnassignedMoleculeChargeException(msg)
openff.toolkit.typing.engines.smirnoff.parameters.UnassignedMoleculeChargeException: The following molecules did not have charges assigned by any ParameterHandler in the ForceField:
[F][P-]([F])([F])([F])([F])[F]
I have RESP fit charges for PF6-. Can I make ForceField
use those parameters so it doesn’t throw an error?
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
How To Override Default Expense Account in iProcurement
Expectations are that No Charge Account should default and User need to enter manually and process the Purchase Requisition.
Read more >How To Override BSV For Expense Purchasing
If you are dealing with an expense item, the charge account could default from your sub-inventory or organization or item expense account If...
Read more >Charge Account not defaulting in PO distributions
Click on Assignment. Click on Purchase Order Information. 2.The Expense Charge Account Rules can be setup to enableoverride of one ormore ...
Read more >Quick Reference Guide: Assign Costing Allocations
To Override Default Accounts on either an earning or the position: 5a. Use the Prompt Icon to select the FAS Account for the...
Read more >R12 : Purchasing : How account generator defaults Accounts
While you cannot edit the accrual, budget, or variance accounts that the Account Generator constructs, you can override or specify the charge ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Update, I believe that I found the error. In my attempt to support arbitrary permutations of atom ordering, I made some accidental arbitrary permutations.
Iterating through Forces does follow the same Atom ordering as Topology and System.
Thank you for the help everyone and apologies for the mistake!
The quick-and-dirty approach is to assign your charges to the
Moleucle
object via itspartial_charges
setter and then instructForceField.create_openmm_system
to use those parameters. Be aware this might be deprecated in the future since it muddies the water of what a force field is intended to do (#806).A more programmatic approach is to modify the force field itself to include your pre-specified charges. This method (
LibraryChargeType.from_molecule
) creates a parameter whose SMIRKS pattern is unique to your molecule and also contains those charges.Either approach should produce the same result:
Interchange should be able to process these objects as well:
but there may be some bugs; please carefully validate anything that Interchange exports if you use it in research work.