-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't auto-set charge/spin in Q-Chem calculator (#908)
## Overview Previously, the Q-Chem calculator (and by extension, the Q-Chem recipes) tried to automatically set the spin multiplicity if the user did not provide it. This was done using the function `quacc.utils.atoms.get_charge_and_spin` (can also be called as `quacc.utils.get_charge_and_spin` as a result of this PR). In this PR, I am proposing that we move this logic out of the Q-Chem calculator. In other words, the following change would be required if using quacc in a high-throughput context: ```python from ase.build import molecule from quacc.recipes.qchem.core import relax_job atoms = molecule("CH3") output = relax_job(atoms) ``` would instead become ```python from ase.build import molecule from quacc.recipes.qchem.core import relax_job from quacc.utils import check_charge_and_spin atoms = molecule("CH3") charge, spin_multiplicity = check_charge_and_spin(atoms) output = relax_job(atoms, charge, spin_multiplicity) ``` ## Motivation As was noted in prior discussions, it is clear that the approach proposed here is more verbose and slightly more laborious than the original implementation. There is no denying that. However, I believe that there are strong pros for this PR. 1. In general, my philosophy is that charge and spin are so crucial that they are parameters that I want the user to really think about. Automation is great, but this is one area where I think it is important the user stops to think about what they're doing rather than blindly assuming quacc will take care of it for them. I also prefer to take the "road of least surprise." 2. For transition metal complexes, the prior approach becomes a bit messy since it will auto-set the spin multiplicity to the lowest possible value and "just run" but of course, many (in fact, most) transition metal complexes are not actually low spin. This is in line with the above point where I'd prefer the user to be explicit about what they want to model. 3. The `check_charge_and_spin` function is extremely useful! And thankfully, it is simple to use. As noted in the above codeblock, removing `check_charge_and_spin` from inside the Q-Chem calculator does not remove the ability to use the function. One can still use it in their script as they see fit, even in a high-throughput context. It does require an additional line, but I think this is okay. --------- Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
- Loading branch information
1 parent
047b2e6
commit ecc24a3
Showing
21 changed files
with
332 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.