-
Notifications
You must be signed in to change notification settings - Fork 24
Fix TS multiplicity from YAML input #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alongd
wants to merge
1
commit into
main
Choose a base branch
from
ts_mult
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2188,6 +2188,29 @@ def test_determine_multiplicity(self): | |
| ch_ts = ARCSpecies(label='C--H-TS', xyz='C 0 0 0\nH 1 2 5', is_ts=True) | ||
| self.assertEqual(ch_ts.multiplicity, 2) | ||
|
|
||
| ts_1_xyz = """H -2.99394700 1.00970200 0.09451400 | ||
| O -4.10192200 0.13578500 -0.05953100 | ||
| H -4.43761000 -0.35213100 0.70859500 | ||
| C -2.22272000 0.16048700 -0.01004900 | ||
| O -1.59892700 -0.79618100 0.08758500""" | ||
| ts_1_spc = ARCSpecies(label='TS1', is_ts=True, xyz=ts_1_xyz) | ||
| self.assertEqual(ts_1_spc.multiplicity, 1) | ||
|
|
||
| ts_1_spc_from_dict = ARCSpecies(species_dict={'label': 'TS1', 'is_ts': True, 'xyz': ts_1_xyz}) | ||
| self.assertEqual(ts_1_spc_from_dict.multiplicity, 1) | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a known TS with a multiplicity of 2 (actual radical) to make sure the XYZ doesn't flatten it to 1? |
||
| # Test a known doublet TS from a Gaussian output file (NH3 + H = NH2 + H2). | ||
| # Verify that xyz-based electron counting (11 electrons → mult 2) wins over mol.multiplicity. | ||
| ts_doublet_path = os.path.join(ARC_TESTING_PATH, 'freq', 'TS_NH3+H=NH2+H2.out') | ||
| ts_doublet = ARCSpecies(label='TS_NH3+H', is_ts=True, xyz=ts_doublet_path) | ||
| self.assertIsNotNone(ts_doublet.mol) | ||
| self.assertEqual(ts_doublet.multiplicity, 2) | ||
| # Simulate a mol that incorrectly perceives multiplicity as 1, and verify xyz detection still gives 2. | ||
| ts_doublet.multiplicity = None | ||
| ts_doublet.mol.multiplicity = 1 | ||
| ts_doublet.determine_multiplicity_from_xyz() | ||
| self.assertEqual(ts_doublet.multiplicity, 2) | ||
|
|
||
| def test_cluster_tsgs(self): | ||
| """Test the cluster_tsgs() method.""" | ||
| xyz_1 = """N 0.9177905887 0.5194617797 0.0000000000 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding a log line here- so it will be easier to debug if there's a multiplicity issue that still arises.
Something like:
logger.debug(f"TS species {self.label}: using xyz-based multiplicity {self.multiplicity} (ignored mol.multiplicity)") would make debugging much easier down the road, especially since a wrong multiplicity here causes Gaussian to reject the job entirely.