Fixing bug in read_resume#1
Open
GaboBellido wants to merge 1 commit into
Open
Conversation
Line 1098 and 1102, fscanf followed by fgets does not properly account for newline character, results in erroneous read of number of sites (ns_tmp). Adding newline character results in accurate reading.
GaboBellido
added a commit
to GaboBellido/MATILDA.FT
that referenced
this pull request
Mar 11, 2026
…threshold Three bugs fixed: 1. d_MS_pair corruption: the previous code set MS_pair[j]=1 for all co-molecular particles then copied the modified array back to d_MS_pair. On the next CalcSTensors() call every head particle computed its u-vector toward particle rar-ensemble#1 instead of its actual bonded partner, producing garbage S tensors and NaN eigenvalues (Eigen assertion failure). Fix: use a local std::vector<int> dist_marker so this->MS_pair and d_MS_pair are never modified; restore d_MS_pair from this->MS_pair after the mapping kernel. 2. d_S_field not zeroed: d_mapDistributedFieldSTensors uses atomicAdd, so calling it without zeroing d_S_field first accumulated contributions from the preceding CalcSTensors() call. Fix: zero d_S_field with d_zero_float_vector before the mapping kernel. 3. Head-particle threshold: the condition was MS_pair[i] > 1, missing heads whose bonded partner has index 0 or 1. Fix: change to >= 0 (non-LC particles have MS_pair == -1). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Line 1098 and 1102, fscanf followed by fgets does not properly account for newline character, results in erroneous read of number of sites (ns_tmp). Adding newline character results in accurate reading.