is an option for MoleculeModify that specifies whether molecule valences should be automatically adjusted after modification.


ValenceErrorHandling
is an option for MoleculeModify that specifies whether molecule valences should be automatically adjusted after modification.
Details

- When ValenceErrorHandling is True, hydrogens will be added or subtracted in order to fix valence errors.
Examples
Basic Examples (3)
Create cyclohexane from hexane by adding a bond between the terminal carbon atoms:
Two hydrogen atoms were removed when the bond was created:
Use ValenceErrorHandlingFalse to disable this:

Adding a positive charge to oxygen will remove its hydrogen by default:
Turning off error handling will give a divalent oxygen anion:

Deleting a bond will by default add hydrogens to fill valences:
With automatic valence handling disabled, the atoms participating in the deleted bond have their "UnpairedElectronCount" incremented:
See Also
Related Guides
History
Text
Wolfram Research (2019), ValenceErrorHandling, Wolfram Language function, https://reference.wolfram.com/language/ref/ValenceErrorHandling.html.
CMS
Wolfram Language. 2019. "ValenceErrorHandling." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ValenceErrorHandling.html.
APA
Wolfram Language. (2019). ValenceErrorHandling. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ValenceErrorHandling.html
BibTeX
@misc{reference.wolfram_2025_valenceerrorhandling, author="Wolfram Research", title="{ValenceErrorHandling}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/ValenceErrorHandling.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_valenceerrorhandling, organization={Wolfram Research}, title={ValenceErrorHandling}, year={2019}, url={https://reference.wolfram.com/language/ref/ValenceErrorHandling.html}, note=[Accessed: 11-August-2025]}