Skip to content

Fixing bug in read_resume#1

Open
GaboBellido wants to merge 1 commit into
rar-ensemble:mainfrom
GaboBellido:patch-1
Open

Fixing bug in read_resume#1
GaboBellido wants to merge 1 commit into
rar-ensemble:mainfrom
GaboBellido:patch-1

Conversation

@GaboBellido

Copy link
Copy Markdown

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.

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>
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.

1 participant