Skip to content

Commit

Permalink
fixed bug in FA comparing function
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-kopczynski committed Dec 4, 2022
1 parent d309672 commit e92f331
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/domain/LipidMolecularSpecies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ void LipidMolecularSpecies::sort_fatty_acyl_chains(){
if (info->level > MOLECULAR_SPECIES || fa_list.size() < 2) return;
sort(fa_list.begin(), fa_list.end(), [] (FattyAcid *fa1, FattyAcid *fa2) {
// treat empty fatty acids individually
if (fa1->num_carbon == 0) return false;
if (fa2->num_carbon == 0) return true;
if (fa1 == 0 || fa1->num_carbon == 0) return false;
if (fa2 == 0 || fa2->num_carbon == 0) return true;

if (fa1->lipid_FA_bond_type != fa2->lipid_FA_bond_type) return fa1->lipid_FA_bond_type < fa2->lipid_FA_bond_type;
if (fa1->num_carbon != fa2->num_carbon) return fa1->num_carbon < fa2->num_carbon;
int db1 = fa1->get_double_bonds();
int db2 = fa2->get_double_bonds();
int db1 = fa1->double_bonds->get_num();
int db2 = fa2->double_bonds->get_num();
if (db1 != db2) return db1 < db2;
ElementTable *e1 = fa1->get_elements();
ElementTable *e2 = fa2->get_elements();
Expand Down

0 comments on commit e92f331

Please sign in to comment.