molpopgen / fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations
http://fwdpp.readthedocs.io
GNU General Public License v3.0
27 stars 11 forks source link

minor bug in fitness_models.hpp #8

Closed alexnater closed 9 years ago

alexnater commented 9 years ago

fitness_models.hpp - Line 81: if( !g1->smutations.empty() && g2->smutations.empty() )

instead of: if( g1->smutations.empty() && g2->smutations.empty() )

molpopgen commented 9 years ago

That indeed looks like a bug. This was introduced in 0.2.5. I'll confirm, fix, and push changes later today.

Thanks!

molpopgen commented 9 years ago

OK, the issue is the following:

  1. The code in question wanted to ask: "If gamete 1 has mutations with fitness effects, and gamete 2 does not, then we can do something fast and get out of here."
  2. The code asked that question in a meaningless way that would never do the fast thing and get out of there.
  3. However, the rest of the function would correctly do the explicit fitness calculation.
  4. There for, this was a bug in terms of intention, but the resulting calculation was correct.

The relevant commits:

https://github.com/molpopgen/fwdpp/commit/0de88684f46031eb5a6de88e9315ca916742d4bc https://github.com/molpopgen/fwdpp/commit/51d06781239a61d43848b2bb03fc48d91e79ac6d https://github.com/molpopgen/fwdpp/commit/d15ce4d05458ec85c1712d5848985062ff3a20c3

These changes are upstream in dev, and will be merged to master, and tagged for 0.2.9 imminently.