Comments (2)
Thank you for your response.
In my case, the ERROR catch looks good!
from openff-interchange.
You've pretty much found the API points that I would recommend1; under the hood, ForceField.label_molecules
pretty much does the same stuff as creating an Interchange
object (namely filling out the the collection classes). This can be simple or tricky depending on the level of granularity you're after
- Rough pass: just see if the element(s) are in the force field at all
- Slightly more detailed pass: wrap your second code block into a function and error out in some particular cases`
- This doesn't work for all parameter handlers; for example, throwing an error if
len(matches['Bonds']) < topology.n_bonds
is probably good, but the same logic for improper torsions would not work. - The logic within Interchange is around here
- This doesn't work for all parameter handlers; for example, throwing an error if
- Depending on the application, it might be easiest to just go Grace Hopper style and ask for forgiveness instead of permission
try:
force_field.create_interchange(...)
# there are a few different exceptions that can be thrown here - this base class captures if bond/angle/torsion parameters are missing
except (UnassignedValenceParameterException, ...):
# deal with it here - log, re-raise exception, etc.
In the case of molecular iodine, it seems like the thrown error is pretty much getting what you're asking for. Are there other cases that are tricker to deal with?
Footnotes
from openff-interchange.
Related Issues (20)
- Allow electrostatics in single force + plugins HOT 4
- `_simple_topology_from_openmm` fails with `RecursionError` on large topologies HOT 16
- vdW energies not reported when vdW interactions defined by plugins HOT 1
- Improve error handling with missing parameters
- Boxes from OpenMM `System`s are `OpenFFQuantity[list[list[OpenMMQuantity]]]` HOT 13
- Check if masses in OpenMM are canonical or edited a la HMR HOT 2
- Support HMR in OpenMM export HOT 1
- Support HMR in GROMACS export HOT 4
- Better support bond constraints in LAMMPS export HOT 2
- NADP gives some inconsistent energies across engines. HOT 4
- [LAMMPS] Full unit-awareness when parsing LAMMPS outputs with drivers HOT 3
- Missing v-site exceptions HOT 4
- Wrong "scale_14" read from .json file HOT 5
- "dOH" written incorrectly in `[ settles ]` section HOT 2
- Pass cosmetic attrs through to `Potential` objects HOT 3
- Missing v-site exceptions with plugins HOT 5
- `Interchange.from_openmm` should raise an exception if the topology doesn't match the system HOT 3
- TrivalentLonePair parameter places vsite at incorrect geometry HOT 6
- ligand always out of box in ligand_in_water.ipynb HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openff-interchange.