I’m a big fan of Jim Jozwiak’s nutrition tracking software NUT. But there was something I wanted to change. You can set a pre-determined amount of protein (in grams) for your diet, or you can let the program calculate an amount equal to 10% of your total calories for the day.

You can’t set a percentage of calories from protein; you can only accept the default 10%… unless you do some hacking.

How much protein is a good amount?

This is where the bro-science gets especially dogmatic.

In looking into this question, I found a helpful article about The Myth of 1g/lb: Optimal Protein Intake for Bodybuilders. The author quotes quite a few studies and concludes that:

…most research finds no more benefits after 0.64g/lb

Since fat tissue doesn’t need all that much protein, I figure this ratio should work fine with lean body mass as opposed to total mass. Since the studies mentioned were on bodybuilders, I figure their fat percentages were pretty low and had little impact on the amount of protein anyway.

I also calculate target calories for the day based on lean body mass, so this makes things easier for me.

Target protein (g/day) = 0.64g * (lean body mass in pounds)

Is there a consistent ratio between protein and calories?

The equation I’m using to calculate basal metabolic rate is something I got from the old weightrainer.net site, which is now gone from the internets, save from the copies at the wayback machine at Internet archive.

Metabolic Rate = (370 + (9.8 * LBM)) * ActivityFactor

LBM = lean body mass in pounds

Here the activity factor is one of the following:

  • Sedentary: 1.2
  • Light: 1.375
  • Moderate: 1.55
  • Very: 1.725
  • Extreme: 1.9

If you work out the ratio of protein calories to total calories, you get the following equation:

Here, AF stands for one of the Activity Factors listed above.

That 370 kcal on the bottom dashed my hopes of a consistent ratio. The lower LBM is, the bigger the impact of that added 370 kcal.

But as LBM increases, the significance of the added 370 kcal drops to nothing. So as LBM increases to infinity, the equation approaches:

Ah, much nicer!

Now we can see that the ratio of protein calories to total calories approaches about 0.26 / AF. So the maximum ratios would be:

  • Sedentary: 0.21
  • Light: 0.19
  • Medium: 0.17
  • Very: 0.15
  • Extreme: 0.13

The lower protein ratios for more active people reflect the fact that they would be taking in more calories in the form of fats and carbohydrates.

Since I have a desk job and do light-to-moderate exercise regularly, I’ll put myself in the ‘Light’ activity level and shoot for 20% protein (by calories). That’s twice the default setting in NUT.

Hacking NUT

OK, the first odd thing about nut is that most of the code is actually contained in the database itself. The tcl script has enough code to read the database, extract the rest of the code, and run with it.

Not sure what the benefit to this was, but oh well..

So I cracked open nut.sqlite in SqliteBrowser and looked for the two things I knew I had to change:

  1. Change the gui text from “10%” to “20%”.
  2. Change the code to calculate 20% instead of 10%

There was a database table called “tcl_code” that probably had both. Searching for “10% of”, I quickly found the GUI text and changed it. Easy peasy.

The next step wasn’t so easy…

How to calculate 10%… the weird way.

I kept looking through the code for 0.1 being multiplied by some variable to give us our 10%. And I never found it.

Tcl isn’t a language I’ve worked with before and that made things harder, but not impossible. Eventually, I figured out how NUT does this. (Hint: It’s not how I would have done it)

OK, so instead of multiplying by .1 to get 10%, NUT multiplies the total number of calories by 50/2,000. That’s 50 grams of protein for a diet of 2,000 Calories. 50 grams of protein at 4 kcal per gram gives us 200 kcal; or 10% of 2,000.

And under the “nutr_def” table, you’ll find the “dv_default” (daily value default) value for protein is set to 50.0.

20% of a 2,000 kcal diet is 400 kcal; which you’d get from 100 grams of protein. So I changed the “dv_default” value for protein from 50.0 to 100.0 and presto!

Now I can set the protein amount in NUT’s personal options to “DV 20% of Calories”, and it will automatically calculate the right amount of protein based on the total Calorie setting.

This way, as my weight changes, I can adjust just the Calorie level; not Calories and protein.

I’ve been using ‘Calorie’ with a capital ‘C’ to differentiate from ‘calorie’ with a lower-case ‘c’. I can’t resist being pedantic sometimes. Techinally, what you see listed on food labels is kilo-calories; a thousand calories. But for mysterious reasons, manufacturers drop the ‘kilo-‘. Chemists use the capital ‘C’ to distinguish between real calories and calories with the ‘kilo-‘ left off.

Update 2017-04-04

I’ve decided to bump my protein intake up to 25%. If I’m dieting and getting fewer calories than maintenance (I estimate a max 20% shortage), then I’ll need the extra 5% to get me back up to the total amount of protein required. (125% of 80% of required protein is 100% of required protein. 125% of 20% protein is 25% protein.)