--- GDE/MrBAYES/mrbayes_3.2.1/model.c.orig 2016-05-02 19:19:07.000000000 +0800 +++ GDE/MrBAYES/mrbayes_3.2.1/model.c 2026-05-22 05:50:37.000000000 +0800 @@ -155,9 +155,9 @@ /* parser flags and variables */ -int fromI, toJ, foundDash, foundComma, foundEqual, foundBeta, - foundAaSetting, foundExp, modelIsFixed, linkNum, foundLeftPar, - tempNumStates, isNegative; +int modelFromI, modelToJ, modelFoundDash, foundComma, modelFoundEqual, foundBeta, + foundAaSetting, modelFoundExp, modelIsFixed, linkNum, foundLeftPar, + tempNumStates, modelIsNegative; MrBFlt tempStateFreqs[200], tempAaModelPrs[10]; char colonPr[100], clockPr[30]; @@ -1094,7 +1094,7 @@ int ChangeNumChains (int from, int to) { - int i, i1, j, k, m, st, nRuns, fromIndex, toIndex, run, chn, *tempIntVals, nCppEventParams, *toEvents, *fromEvents; + int i, i1, j, k, m, st, nRuns, modelFromIndex, toIndex, run, chn, *tempIntVals, nCppEventParams, *toEvents, *fromEvents; MCMCMove **tempMoves, *fromMove, *toMove; Tree **tempTrees; MrBFlt *tempVals, **toRateMult, **toPosition, **fromRateMult, **fromPosition, *stdStateFreqsOld; @@ -1157,26 +1157,26 @@ { if (chn < to) { - fromIndex = (run*from + chn)*2*paramValsRowSize; + modelFromIndex = (run*from + chn)*2*paramValsRowSize; toIndex = (run*to + chn)*2*paramValsRowSize; for (i=0; i<2*paramValsRowSize; i++) - paramValues[toIndex++] = tempVals[fromIndex++]; - fromIndex = (run*from + chn)*2*intValsRowSize; + paramValues[toIndex++] = tempVals[modelFromIndex++]; + modelFromIndex = (run*from + chn)*2*intValsRowSize; toIndex = (run*to + chn)*2*intValsRowSize; for (i=0; i<2*intValsRowSize; i++) - intValues[toIndex++] = tempIntVals[fromIndex++]; + intValues[toIndex++] = tempIntVals[modelFromIndex++]; for (i=i1=0; iparamType == P_CPPEVENTS) { - fromIndex = 2*(run*from + chn); + modelFromIndex = 2*(run*from + chn); toIndex = 2*(run*to + chn); - fromEvents = cppEventParams[i1].nEvents[fromIndex]; + fromEvents = cppEventParams[i1].nEvents[modelFromIndex]; toEvents = p->nEvents[toIndex]; - fromPosition = cppEventParams[i1].position[fromIndex]; + fromPosition = cppEventParams[i1].position[modelFromIndex]; toPosition = p->position[toIndex]; - fromRateMult = cppEventParams[i1].rateMult[fromIndex]; + fromRateMult = cppEventParams[i1].rateMult[modelFromIndex]; toRateMult = p->rateMult[toIndex]; for (j=0; j<2*numLocalTaxa; j++) { @@ -1230,12 +1230,12 @@ if (chn >= to) continue; /*Here we move only one tree per chain/state?! Should not we move numTrees??*/ - fromIndex = 2*(run*from + chn) * numTrees; + modelFromIndex = 2*(run*from + chn) * numTrees; toIndex = 2*(run*to + chn) * numTrees; for(k=0;k<2*numTrees;k++) { - mcmcTree[toIndex+k] = tempTrees[fromIndex+k]; - tempTrees[fromIndex+k] = NULL; + mcmcTree[toIndex+k] = tempTrees[modelFromIndex+k]; + tempTrees[modelFromIndex+k] = NULL; } } } @@ -1328,11 +1328,11 @@ if (chn >= to) break; - fromIndex = 2*(run*from + chn)*stdStateFreqsRowSize; + modelFromIndex = 2*(run*from + chn)*stdStateFreqsRowSize; toIndex = 2*(run*to + chn)*stdStateFreqsRowSize; for(k=0;k<2*stdStateFreqsRowSize;k++) { - stdStateFreqs[toIndex+k]=stdStateFreqsOld[fromIndex+k]; + stdStateFreqs[toIndex+k]=stdStateFreqsOld[modelFromIndex+k]; } } /* set new chains */ @@ -1360,12 +1360,12 @@ { if (chn < to) { - fromIndex = run*from + chn; + modelFromIndex = run*from + chn; toIndex = run*to + chn; - toMove->relProposalProb[toIndex] = fromMove->relProposalProb[fromIndex]; + toMove->relProposalProb[toIndex] = fromMove->relProposalProb[modelFromIndex]; for (j=0; jmoveType->numTuningParams; j++) { - toMove->tuningParam[toIndex][j] = fromMove->tuningParam[fromIndex][j]; + toMove->tuningParam[toIndex][j] = fromMove->tuningParam[modelFromIndex][j]; } } } @@ -2849,14 +2849,14 @@ /* initialize tempLinkUnlinkVec to no */ for (i=0; i theValueMax) @@ -4034,7 +4034,7 @@ } expecting = Expecting (PARAMETER) | Expecting(SEMICOLON); } - else /* if (foundEqual == NO) */ + else /* if (modelFoundEqual == NO) */ { sscanf (tkn, "%d", &tempInt); if (foundComma == NO) @@ -4091,7 +4091,7 @@ } else if (expecting == Expecting(EQUALSIGN)) { - foundEqual = YES; + modelFoundEqual = YES; expecting = Expecting(NUMBER); } else @@ -4201,14 +4201,14 @@ { for (i=0; i 1.0 || tempD < -1.0) { @@ -5580,11 +5580,11 @@ } } } - foundDash = NO; + modelFoundDash = NO; } else if (expecting == Expecting(DASH)) { - foundDash = YES; + modelFoundDash = YES; expecting = Expecting(NUMBER); } else if (expecting == Expecting(COMMA)) @@ -5631,7 +5631,7 @@ expecting = Expecting(LEFTPAR); for (i=0; i 1.0 || tempD < -1.0) { @@ -5695,11 +5695,11 @@ } } } - foundDash = NO; + modelFoundDash = NO; } else if (expecting == Expecting(DASH)) { - foundDash = YES; + modelFoundDash = YES; expecting = Expecting(NUMBER); } else if (expecting == Expecting(COMMA)) @@ -6299,12 +6299,12 @@ { if (expecting == Expecting(EQUALSIGN)) { - foundEqual = YES; + modelFoundEqual = YES; expecting = Expecting(ALPHA); } else if (expecting == Expecting(ALPHA)) { - if (foundEqual == YES) + if (modelFoundEqual == YES) { if (IsArgValid(tkn, tempStr) == NO_ERROR) { @@ -6335,7 +6335,7 @@ expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); else expecting = Expecting(LEFTPAR); - foundEqual = NO; + modelFoundEqual = NO; } else { @@ -6345,7 +6345,7 @@ if (activeParts[i] == YES || nApplied == 0) break; - if (foundDash == YES) /* we must be collecting constraint numbers */ + if (modelFoundDash == YES) /* we must be collecting constraint numbers */ { MrBayesPrint ("%s Expecting a number\n", spacer); return (ERROR); @@ -6370,7 +6370,7 @@ MrBayesPrint ("%s Could not set fixed topology from user tree '%s'\n", spacer, tkn); return (ERROR); } - fromI = index + 1; /* fromI is used to hold the index of the user tree, 1-based */ + modelFromI = index + 1; /* modelFromI is used to hold the index of the user tree, 1-based */ expecting = Expecting(RIGHTPAR); } } @@ -6379,8 +6379,8 @@ { for (i=0; iname); + MrBayesPrint ("%s Setting Brlenspr to Fixed(%s)\n", spacer, userTree[modelFromI-1]->name); else - MrBayesPrint ("%s Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[fromI-1]->name, i+1); + MrBayesPrint ("%s Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[modelFromI-1]->name, i+1); } else { if (nApplied == 0 && numCurrentDivisions == 1) - MrBayesPrint ("%s Setting Brlenspr to Fixed(%s)\n", spacer, userTree[fromI-1]->name); + MrBayesPrint ("%s Setting Brlenspr to Fixed(%s)\n", spacer, userTree[modelFromI-1]->name); else - MrBayesPrint ("%s Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[fromI-1]->name, i+1); + MrBayesPrint ("%s Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[modelFromI-1]->name, i+1); } } } @@ -7186,7 +7186,7 @@ { if (expecting == Expecting(EQUALSIGN)) { - foundDash = NO; + modelFoundDash = NO; expecting = Expecting(ALPHA); } else if (expecting == Expecting(ALPHA)) @@ -7216,15 +7216,15 @@ } else if (expecting == Expecting(DASH)) { - foundDash = YES; + modelFoundDash = YES; expecting = Expecting(NUMBER); } else if (expecting == Expecting(NUMBER)) { sscanf (tkn, "%lf", &tempD); - if (foundDash == YES) + if (modelFoundDash == YES) { - foundDash = NO; + modelFoundDash = NO; tempD *= -1.0; } nApplied = NumActiveParts (); @@ -7879,11 +7879,11 @@ if (expecting == Expecting(EQUALSIGN)) { expecting = Expecting(ALPHA); - isNegative = NO; + modelIsNegative = NO; } else if (expecting == Expecting(ALPHA)) { - isNegative = NO; + modelIsNegative = NO; if (IsArgValid(tkn, tempStr) == NO_ERROR) { nApplied = NumActiveParts (); @@ -7909,7 +7909,7 @@ else if (expecting == Expecting(DASH)) { expecting = Expecting(NUMBER); - isNegative = YES; + modelIsNegative = YES; } else if (expecting == Expecting(NUMBER)) { @@ -7921,7 +7921,7 @@ if (!strcmp(modelParams[i].growthPr,"Uniform")) { sscanf (tkn, "%lf", &tempD); - if (isNegative == YES) + if (modelIsNegative == YES) tempD *= -1.0; modelParams[i].growthUni[numVars[i]++] = tempD; if (numVars[i] == 1) @@ -7943,7 +7943,7 @@ else if (!strcmp(modelParams[i].growthPr,"Normal")) { sscanf (tkn, "%lf", &tempD); - if (isNegative == YES) + if (modelIsNegative == YES) tempD *= -1.0; modelParams[i].growthNorm[numVars[i]++] = tempD; if (numVars[i] == 1) @@ -7975,7 +7975,7 @@ else if (!strcmp(modelParams[i].growthPr,"Fixed")) { sscanf (tkn, "%lf", &tempD); - if (isNegative == YES) + if (modelIsNegative == YES) tempD *= -1.0; modelParams[i].growthFix = tempD; if (nApplied == 0 && numCurrentDivisions == 1) @@ -7986,7 +7986,7 @@ } } } - isNegative = NO; + modelIsNegative = NO; } else if (expecting == Expecting(COMMA)) { @@ -8005,8 +8005,8 @@ if (expecting == Expecting(EQUALSIGN)) { expecting = Expecting(ALPHA); - foundAaSetting = foundExp = modelIsFixed = foundDash = NO; - fromI = 0; + foundAaSetting = modelFoundExp = modelIsFixed = modelFoundDash = NO; + modelFromI = 0; for (i=0; i<10; i++) tempAaModelPrs[i] = 0.0; } @@ -8109,7 +8109,7 @@ { if (IsSame ("Exponential", tkn) == SAME || IsSame ("Exponential", tkn) == CONSISTENT_WITH) { - foundExp = YES; + modelFoundExp = YES; expecting = Expecting(LEFTPAR); } else @@ -8124,24 +8124,24 @@ else if (expecting == Expecting(NUMBER)) { sscanf (tkn, "%lf", &tempD); - if (fromI >= 10) + if (modelFromI >= 10) { MrBayesPrint ("%s Too many arguments in Aamodelpr\n", spacer); return (ERROR); } if (modelIsFixed == NO) { - if (foundExp == YES) + if (modelFoundExp == YES) { - if (foundDash == YES) - tempAaModelPrs[fromI++] = -tempD; + if (modelFoundDash == YES) + tempAaModelPrs[modelFromI++] = -tempD; else - tempAaModelPrs[fromI++] = tempD; + tempAaModelPrs[modelFromI++] = tempD; expecting = Expecting(RIGHTPAR); } else { - if (foundDash == YES) + if (modelFoundDash == YES) { MrBayesPrint ("%s Unexpected \"-\" in Aamodelpr\n", spacer); return (ERROR); @@ -8149,13 +8149,13 @@ else { if (tempD <= 0.000000000001) - tempAaModelPrs[fromI++] = -1000000000; + tempAaModelPrs[modelFromI++] = -1000000000; else - tempAaModelPrs[fromI++] = (MrBFlt) log(tempD); + tempAaModelPrs[modelFromI++] = (MrBFlt) log(tempD); } expecting = Expecting(COMMA) | Expecting(RIGHTPAR); } - foundDash = NO; + modelFoundDash = NO; } else { @@ -8169,7 +8169,7 @@ expecting = Expecting(ALPHA); else { - if (foundExp == YES) + if (modelFoundExp == YES) expecting = Expecting(NUMBER) | Expecting(DASH); else expecting = Expecting(NUMBER) | Expecting(ALPHA); @@ -8181,14 +8181,14 @@ expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); else { - if (foundExp == YES) + if (modelFoundExp == YES) { - foundExp = NO; + modelFoundExp = NO; expecting = Expecting(COMMA) | Expecting(RIGHTPAR); } else { - if (fromI < 10) + if (modelFromI < 10) { MrBayesPrint ("%s Too few arguments in Aamodelpr\n", spacer); return (ERROR); @@ -8216,9 +8216,9 @@ } else if (expecting == Expecting(DASH)) { - if (foundExp == YES) + if (modelFoundExp == YES) { - foundDash = YES; + modelFoundDash = YES; expecting = Expecting(NUMBER); } else @@ -8625,14 +8625,14 @@ { for (i=0; imin; theValueMax = param->max; @@ -9411,13 +9411,13 @@ sscanf (tkn, "%d", &tempInt); else sscanf (tkn, "%lf", &tempFloat); - if (foundDash == YES) + if (modelFoundDash == YES) { if (useIntValues == NO) tempFloat = -tempFloat; else tempInt = -tempInt; - foundDash = NO; + modelFoundDash = NO; } if (useIntValues == NO && (tempFloat < theValueMin || tempFloat > theValueMax)) { @@ -9463,7 +9463,7 @@ } expecting = Expecting (COMMA) | Expecting(RIGHTPAR); } - else /* if (foundEqual == NO) */ + else /* if (modelFoundEqual == NO) */ { sscanf (tkn, "%d", &tempInt); if (foundComma == NO) @@ -9491,12 +9491,12 @@ } else if (expecting == Expecting(COMMA)) { - if (foundEqual == YES) + if (modelFoundEqual == YES) { /* we expect another parameter value */ expecting = Expecting(NUMBER); } - else /* if (foundEqual == NO) */ + else /* if (modelFoundEqual == NO) */ { /* we will be reading in chain index, if present */ foundComma = YES; @@ -9508,12 +9508,12 @@ } else if (expecting == Expecting(RIGHTPAR)) { - if (foundEqual == NO) + if (modelFoundEqual == NO) { /* this is the end of the run and chain specification */ expecting = Expecting(EQUALSIGN); } - else /* if (foundEqual == YES) */ + else /* if (modelFoundEqual == YES) */ { /* this is the end of the parameter values */ if (nValuesRead != numExpectedValues) @@ -9549,7 +9549,7 @@ } else if (expecting == Expecting(EQUALSIGN)) { - foundEqual = YES; + modelFoundEqual = YES; foundName = YES; /* we now know that the name is complete; try to find the parameter with this name (case insensitive) */ @@ -19878,28 +19878,50 @@ mt->Autotune = &AutotuneMultiplier; mt->targetRate = 0.25; - /*************************** Begin Code added by Jeremy Brown *************************/ - - /* Move_TreeLen */ - mt = &moveTypes[i++]; - mt->name = "Whole treelength hit with multiplier"; - mt->shortName = "TLMultiplier"; - mt->tuningName[0] = "Multiplier tuning parameter"; - mt->shortTuningName[0] = "lambda"; - mt->applicableTo[0] = BRLENS_UNI; - mt->applicableTo[1] = BRLENS_EXP; - mt->nApplicable = 2; - mt->moveFxn = &Move_TreeLen; - mt->relProposalProb = 2.0; - mt->numTuningParams = 1; - mt->tuningParam[0] = 2.0 * log (2.0); /* lambda */ - mt->minimum[0] = 0.00001; - mt->maximum[0] = 10000000.0; - mt->parsimonyBased = NO; - mt->level = STANDARD_USER; - mt->Autotune = &AutotuneMultiplier; - mt->targetRate = 0.25; - + /*************************** Begin Code added by Jeremy Brown *************************/ + + + + /* Move_TreeLen */ + + mt = &moveTypes[i++]; + + mt->name = "Whole treelength hit with multiplier"; + + mt->shortName = "TLMultiplier"; + + mt->tuningName[0] = "Multiplier tuning parameter"; + + mt->shortTuningName[0] = "lambda"; + + mt->applicableTo[0] = BRLENS_UNI; + + mt->applicableTo[1] = BRLENS_EXP; + + mt->nApplicable = 2; + + mt->moveFxn = &Move_TreeLen; + + mt->relProposalProb = 2.0; + + mt->numTuningParams = 1; + + mt->tuningParam[0] = 2.0 * log (2.0); /* lambda */ + + mt->minimum[0] = 0.00001; + + mt->maximum[0] = 10000000.0; + + mt->parsimonyBased = NO; + + mt->level = STANDARD_USER; + + mt->Autotune = &AutotuneMultiplier; + + mt->targetRate = 0.25; + + + /*************************** End Code added by Jeremy Brown *************************/ /* Move_UnrootedSlider */