Skip to content

Commit

Permalink
BUGFIX : no handling of partial Z including ED values
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-raden committed Apr 30, 2024
1 parent 047bb29 commit 3c98c3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* IntaRNA/SeedHandler :
* addSeeds()
* BUGFIX : if internal seed base pairs were not found seed was still added
* IntaRNA/PredictorMfeEns :
* updateZ()
* BUGFIX : no handling of partial Z including ED values (so far not used)

################################################################################
### version 3.4.0
Expand Down
20 changes: 13 additions & 7 deletions src/IntaRNA/PredictorMfeEns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,39 @@ updateZ( const size_t i1, const size_t j1
// check if something to be done
if (Z_equal(partZ,0) || Z_isINF(Zall))
return;
// update overall partition function
// handle whether or not partZ includes ED values or not
Z_type partZ_widthED = 0, partZ_noED = 0;
if (isHybridZ) {
#if INTARNA_IN_DEBUG_MODE
if ( (std::numeric_limits<Z_type>::max() - (partZ*energy.getBoltzmannWeight(energy.getE(i1,j1,i2,j2, E_type(0))))) <= Zall) {
LOG(WARNING) <<"PredictorMfeEns::updateZ() : partition function overflow! Recompile with larger partition function data type!";
}
#endif
// add ED penalties etc.
Zall += partZ*energy.getBoltzmannWeight(energy.getE(i1,j1,i2,j2, E_type(0)));
partZ_noED = partZ;
partZ_widthED = partZ*energy.getBoltzmannWeight(energy.getE(i1,j1,i2,j2, E_type(0)));
} else {
#if INTARNA_IN_DEBUG_MODE
if ( (std::numeric_limits<Z_type>::max() - partZ) <= Zall) {
LOG(WARNING) <<"PredictorMfeEns::updateZ() : partition function overflow! Recompile with larger partition function data type!";
}
#endif
// just increase
Zall += partZ;
// remove ED
partZ_noED = partZ / energy.getBoltzmannWeight(energy.getE(i1,j1,i2,j2, E_type(0)));;
partZ_widthED = partZ;
}

// store partial Z
// increase overall partition function
Zall += partZ_withED;

// store partial Z (without ED)
Interaction::Boundary key(i1,j1,i2,j2);
auto keyEntry = Z_partition.find(key);
if ( Z_partition.find(key) == Z_partition.end() ) {
Z_partition[key] = partZ;
Z_partition[key] = partZ_noED;
} else {
// update entry
keyEntry->second += partZ;
keyEntry->second += partZ_noED;
}

}
Expand Down

0 comments on commit 3c98c3c

Please sign in to comment.