Skip to content

Commit

Permalink
Fix LDDT becoming NaN for residues with very large distances #419
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Feb 6, 2025
1 parent 9c31b42 commit 87fd24b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/commons/LDDT.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,20 @@ class LDDTCalculator {
scoreLength = 0;
}
LDDTScoreResult(float *reduce_score, int alignLength) {
scoreLength = alignLength;
if(perCaLddtScore) {
delete[] perCaLddtScore;
}
perCaLddtScore = new float[scoreLength];
perCaLddtScore = new float[alignLength];
float sum = 0.0;
for(int i = 0; i < scoreLength; i++) {
sum += reduce_score[i];
perCaLddtScore[i] = reduce_score[i];
scoreLength = alignLength;
for(int i = 0; i < alignLength; i++) {
if (std::isnan(reduce_score[i])) {
scoreLength = scoreLength - 1;
perCaLddtScore[i] = 0;
} else {
sum += reduce_score[i];
perCaLddtScore[i] = reduce_score[i];
}
}
avgLddtScore = (double)(sum/(float)scoreLength);
}
Expand Down

0 comments on commit 87fd24b

Please sign in to comment.