Skip to content

Initial SPA1 Implementation for 1D Model#7

Merged
adamjharrison merged 14 commits intomainfrom
spa1
Mar 20, 2026
Merged

Initial SPA1 Implementation for 1D Model#7
adamjharrison merged 14 commits intomainfrom
spa1

Conversation

@adamjharrison
Copy link
Copy Markdown
Collaborator

@adamjharrison adamjharrison commented Jan 28, 2026

Initial implementation of SPA1 interstate and intrastate terms for 1D Model (G. Granucci, M. Persico, G. Spighi, J. Chem. Phys., 2012, 137, 22A501)

Implementation verified by comparing the first order SPA1 term calculated by the code to wolfram alpha values for scenarios where gaussians are overlapping in both regions of changing and constant SOC.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 78.94737% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.54%. Comparing base (5be543f) to head (cffc7c0).

Files with missing lines Patch % Lines
src/modules/OverlapModule.f90 77.77% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #7      +/-   ##
==========================================
+ Coverage   54.26%   54.54%   +0.27%     
==========================================
  Files          42       42              
  Lines        5998     6041      +43     
  Branches      800      808       +8     
==========================================
+ Hits         3255     3295      +40     
- Misses       2395     2398       +3     
  Partials      348      348              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielhollas
Copy link
Copy Markdown
Member

danielhollas commented Jan 28, 2026

Huh, interesting, the AIMSWISS test is failing on the debug build with the following stack trace.
https://github.com/ispg-group/openfms/actions/runs/21448470092/job/61770647666?pr=7

At line 181 of file SelectionModule.f90
Fortran runtime error: Index '6' of dimension 1 of array 'blockpop' above upper bound of 3

Error termination. Backtrace:
#0  0x7fea74823e59 in ???
#1  0x7fea74824a71 in ???
#2  0x7fea74825082 in ???
#3  0x55fcb49103a5 in perform_stochastic_selection
	at /home/runner/work/openfms/openfms/src/modules/SelectionModule.f90:181
#4  0x55fcb4945aa9 in __selectionmodule_MOD_fms_stochasticcollapse
	at /home/runner/work/openfms/openfms/src/modules/SelectionModule.f90:111
#5  0x55fcb4a38a73 in fms_dynamics_
	at /home/runner/work/openfms/openfms/src/dynamics.f90:81
#6  0x55fcb4766c63 in openfms
	at /home/runner/work/openfms/openfms/src/openfms.F90:137
#7  0x55fcb4766d07 in main
	at /home/runner/work/openfms/openfms/src/openfms.F90:12

@adamjharrison when you get a chance, can you look at the code and understand how it could be influenced by your changes?

EDIT: Don't sweat about it too much, it's likely it's an pre-existing bug that's somehow exposed here?

@adamjharrison adamjharrison marked this pull request as ready for review February 6, 2026 14:27
Copy link
Copy Markdown
Member

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamjharrison thanks, this looks great!

I mostly have questions about naming, maybe that's something we can discuss in person next week.

I haven't verified all the various formulas, as I trust you did a good job there. But it would be great if you could update the PR description with a detailed explanation of how you tested everything.

It might be great actually to write some unit tests for this, we can discuss how to do it next week.

Comment thread src/modules/OverlapModule.f90 Outdated
Comment thread src/modules/GlobalModule.f90 Outdated
Comment thread src/modules/OverlapModule.f90 Outdated
Comment thread src/modules/OverlapModule.f90 Outdated
Comment thread src/modules/OverlapModule.f90 Outdated
@adamjharrison
Copy link
Copy Markdown
Collaborator Author

Implementation verified by comparing the first order SPA1 term calculated by the code to wolfram alpha values for scenarios where gaussians are overlapping in both regions of changing and constant SOC.

Copy link
Copy Markdown
Member

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thanks! Just a couple of small comments regarding the test.

Comment thread tests/GAIMS-SPA1/Control.dat Outdated
@@ -0,0 +1,49 @@
&control
! Input for some model
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please expand this comment? Just explain what this test is testing. :-)

Comment thread tests/GAIMS-SPA1/Control.dat Outdated
NumTriplets=1
zAllText=.true. ! Output all text-based files
NumInitBasis=1
SPA1_SOC_model=.true. !First order saddle point approximation for 1D model System
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a crucial config, can you move it to the top of the file?

Comment thread tests/GAIMS-SPA1/.DS_Store Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this file. Also let's add .DS_Store in .gitignore so this issue doesn't happen again.
(in any case, great to see that local development works on MacOS :-) )

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect I've removed it and added .DS_Store to the .gitignore file

Copy link
Copy Markdown
Member

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Comment thread .gitignore Outdated
@adamjharrison adamjharrison merged commit bd06101 into main Mar 20, 2026
10 checks passed
@adamjharrison adamjharrison deleted the spa1 branch March 20, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants