Content-type: text/html Manpage of nut


Section: (1)
Updated: 2014.01.01
Index Return to Main Contents


nut - analyze meals with the USDA Nutrient Database  


nut [dbname]
Nut [FLTK OPTION]... [dbname]  


NUT allows you to record what you eat and analyze your meals for nutrient composition. The database included is the USDA Nutrient Database for Standard Reference, Release 26.

This database of food composition tables contains values for calories, protein, carbohydrates, fiber, total fat, etc., and includes all the nutrient data in the USDA database, including the Omega-6 and Omega-3 polyunsaturated fatty acids. Nutrient levels are expressed as a percentage of the DV or Daily Value, the familiar standard of food labeling in the United States. The essential fatty acids, Omega-6 and Omega-3, are not currently mentioned in these standards, and a reference value has been supplied.

You may search this list of foods and view nutrient values for different serving sizes; you may also rank foods in order of level of a particular nutrient. You may change the daily calorie level to correspond to your personal metabolism, and the levels for fat, carbohydrates, fiber, and protein are automatically adjusted. You may customize the ratios of carbohydrates to protein to fat to suit your personal regimen. You may add your own recipes to the database, by creating them from the foods in the database. You can also add foods from the information on commercial food labels. The program is completely menu-driven and there are no commands to learn.

NUT can be called with an optional argument to specify a database subdirectory. For example, if a user tracks meals for other family members, each person can have his own database, and each database is entirely separate. The database subdirectory name (if there is one) is displayed on all screens.

The functions included are:

Record Meals: Foods are found in the database, a number of servings, weight, or calories is entered, and thus a meal is recorded showing the amount of each food eaten. The meal date can be entered in full "yyyymmdd" format or as a positive or negative offset from today, such as "-3" or "+1". All numbers expressing food quantities are entered as decimal numbers, but the number of servings can also be entered as a common fraction such as 3/4. An analysis screen can be brought up by typing a dot. Individual foods are deleted from the meal list by entering the food number shown, but you can also modify the quantity by typing the food number and a new quantity, for example "2 100g", i.e. change food #2 to 100 grams.

Automatic Portion Control: A major feature of NUT is to be able to associate a meal food with an automatically-adjusted quantity to enable easy portion control. For instance, if you want food #4 on the menu to always be adjusted so that the entire meal exactly meets the Daily Value for protein, type "4 p"; if food #7 is a carb food, type "7 c" to adjust non-fiber carb; or if food #1 is a fat food, type "1 f" to automatically adjust the total fat of the meal. An alternate way to specify the previous three commands in a single command is "pcf 4 7 1". Then, as you edit other food quantities or add or subtract foods, the automatic portion control produces an entire meal that exactly fits your plan. There can only be one protein food, one carb food, and one fat food designated per meal. An inappropriate designation such as designating table salt as a fat food will usually result in a quantity of zero. Negative quantities in designated foods indicate too much protein, carb, or fat in non-designated foods. To remove a portion control designation, type the food number and the designation you want to remove; for instance, if food #5 is designated as a fat food, type "5 f" to remove the designation, or else type a new pcf command that does not include food #5 as a fat food. There is also an extension to the feature to balance a meal for Thiamin "t", Pantothenic Acid "n", Vitamin E "e", and Calcium "z", but these commands have to be issued individually and not as part of a "pcf" command. These additional commands "t", "n", "e", and "z" are only valuable when meals habitually lack the specified nutrient and it makes sense to try to get some of the nutrient at every meal to avoid a large cumulative deficiency.

For the program analysis to come out right you must record all the meals the program is set for. For instance, if set for three meals, and you eat more than three, combine them into three; if you eat less than three, record some mimimal item such as an ounce of water for each missing meal. (See below under "Delete Meals and Set Meals Per Day" for the means to set the program to between 1 and 19 meals per day instead of the default 3.)

Analyze Meals and Food Suggestions: An analysis of meals in the database is presented in terms of the percentage of each nutrient, where 100% signifies a rate of 100% of the DV (Daily Value) per day. The program will analyze any subset of the latest meals recorded, considering each meal to be an appropriate fraction of a day. By pressing "s" on the analysis screen, nutrients for which the DV have not been achieved are listed, and some random foods are chosen from the database which contain the additional nutrients. By pressing "e" all values are reset to the absolute values in the analysis to provide an easy method to compare periods (this feature is not in the graphical interface). By pressing "o" all DV defaults are restored replacing comparison mode. By pressing "d" the display alternates between DV percentages, absolute values of the DV nutrients, and a series of screens of all additional nutrients in the database. There is a "p" option that moves the screens back the other way. When you leave the analysis screen (or the "View Foods" screen) with a particular set of nutrients showing, that set of nutrients will be used in the other functions in the program, including printing menus, ranking foods, and drawing graphs.

If the value "(nd)" shows up on a screen, it signifies the database has no data for that particular nutrient for the foods viewed.

If the analysis screen is brought up during "Record Meals", it analyzes backwards from the meal being viewed, which might not be the last meal; however, the "Analyze Meals" screen from main menu option 2 always analyzes from the last meal in the database.

The "Record Meals" and "Analyze Meals" analyses each separately remember how many meals were last analyzed, so that a user could, for example, always look at a single meal on the "Record Meals" analysis, and always look at a couple of weeks of meals on "Analyze Meals", but not have to specify how many meals each time.

Shortcut to food rankings and graphs: From the analysis screen you can type the name of a nutrient as shown, such as Calcium with the capital "C", and if NUT can find the nutrient, it will provide the food ranking and graph functions for that nutrient directly without having to go back to the Main Menu and navigate the hierarchy. You only have to type enough of the beginning of the nutrient name so that NUT can uniquely identify the nutrient.

Delete Meals and Set Meals Per Day: Some or all of the collected meals may be removed from the database; or an automatic feature may be selected which keeps the meal database from getting unnecessarily huge, deleting the oldest meals in excess of a number of meals set by the user. When all meals are deleted, an option may be set to change the program's default from 3 meals a day to 1 to 19 meals a day.

View Foods: Foods can be viewed using the same interface as for "Record Meals," specifying whatever serving size the user wishes to see analyzed for nutrient content, and if necessary typing a "d" or "p" to change the display to a different set of nutrients. You can type just the beginning of a food name or a part of a food name, and a numbered menu of all possible completions continues to be shown until a unique food is chosen.

If the value "(nd)" shows up on a screen, it signifies the database has no data for that particular nutrient for the foods viewed.

Add Foods and Modify Serving Sizes: This item has three selections, "Add a Recipe," "Add a Labeled Food," and "Modify Serving Sizes."

To add a recipe, foods are selected in exactly the same way as adding a meal, a number of servings or weight is entered for each food, and the recipe is recorded. Then the software divides the recipe into the number of servings desired, and provides an opportunity to adjust the weight of the servings to allow for water gained or lost in preparation.

NUT allows you to add a labeled food with an ordered list of ingredients and a nutrition statement (this feature is not in the graphical interface). The new food will have additional nutrients that were not on the nutrition statement, but that the database says are in the food. First, the labeled food is named. Next the program requests that the food's listed ingredients be found in the order of greatest to least. Do not worry about ingredients you cannot find. No amount or weight is set for any ingredient--the ingredient is simply selected. Selected ingredients may be grouped with parentheses where an ingredient number is followed by either "(", ")", or "!" to begin a group, end a group, or remove a group indicator. To delete an ingredient, simply type its number; to move an ingredient, type its number, an "m", and the destination--such as "5m2". When the ingredient list is complete, the nutrient lists are presented so the nutritional information can be copied into the program. Whenever you quit a nutrient screen, an opportunity is presented to select a different set of nutrients. The "DV" percentages for this part of the program are the USA standard 2000-calorie Daily Values, and not any customized options--but users can always set the label's nutrient information in grams. Only Daily Value nutrients greater than zero are considered as constraints when NUT constructs an approximate recipe in order to fill in nutrient values that were not expressed on the food label. Occasionally the "recipe" that NUT estimates for a packaged food will only show a "trace" of every ingredient, and this is NUT's way of saying that according to the food database, there is no way to match the ingredients with the constraints of the nutrition statement. After the recipe is displayed there is an additional opportunity to edit the nutrient values. Perhaps the food was so heavily fortified with vitamins that the user waited until after NUT constructed a recipe to specify the additional vitamin amounts. Whatever the rationale for additional editing, the user has total control over the nutritional information no matter what NUT's approximate recipe suggested. The new food record is saved in the database in the same manner as a recipe.

To modify the serving size of an existing food, the food is selected and the serving sizes on file are displayed so one can be selected. Alternately, the user may simply type in his own serving size consisting of number of grams, the serving unit (such as cups or tablespoons), and the serving quantity.

View Nutrients and Rank Foods: The nutrients are reviewed and one of the nutrients is selected to list all the foods rich in that nutrient. The food database can be queried in this manner for nutrients per 100 grams, per 100 grams dry weight, per 100 grams within a USDA-defined food group, per 100 calories, per serving, per serving minimizing some other nutrient, and per recorded meals (average intake per day). The set of nutrients operated on are the last set viewed or analyzed.

The "Rank Foods per Recorded Meals" option is useful for discovering which foods contribute the most to your intake of a particular nutrient. When you use "Record Meals" to view a meal earlier than your last meal, this "per recorded meals" option looks back from that same meal, to show which foods you were eating during that earlier period. Likewise, the program remembers how many meals were last analyzed, and only searches that subset of meals to find which foods to list.

Note that processed foods which contain hydrogenated vegetable oil or significant "trans-" fats may not contain as much of the essential fatty acids as the program shows because the USDA database does not yet completely distinguish between essential fatty acids and the "trans-" fats, which cannot serve for essential fatty acids in the body.

Set Personal Options and Log Weight: These screens set options for nutrient levels to use when analyzing meals. Some of the carbohydrate and protein settings are mutually exclusive and affect the fat percentages as carbs, protein, and fat of course must total 100%; however, calories per gram vary from food to food, so the percentage of calories from carbs, protein, and fat will vary even if grams of each remain constant, so consider these settings approximations.

The options for polyunsatured fat and the "Omega-6/3 Balance" target select reference values (there are no "Daily Values" for these) based on Dr. William Lands' empirical equation for the percentages of Omega-6 and Omega-3 fatty acids in tissue phospholipids based on diet. The program recomputes all fatty acid values automatically whenever the analysis changes.

"Weight Log Regression" does not tell you what you weigh; what it does is apply linear regression to a series of daily weight and body fat percentage entries to smooth out the random noise and tell you which direction your weight is trending, how fast it is going there, and how much of the change is lean or fat. To make a daily entry, type the weight and body fat percentage at the prompt, like this: "150.2 17.9". If you did not measure the body fat percentage, just type the weight. This algorithm is free of units, so it will work with weights in pounds or kilos or even stone (but not stone plus pounds). The daily entry is automatically timestamped, so it should be entered into the program immediately after measurement and the program will not accept more than one entry per day. If you want to erase the weight log and start over, just type a "!", or you may directly edit the file "WLOG.txt" in the ".nutdb" directory. Clearing the weight log leaves the very last entry in order to quickly start a new cycle of logging. The daily lean and fat mass totals can be seen explicitly by looking at the "WLOG.aux" file in the ".nutdb" directory.

The "Calorie Auto-Set" feature utilizes "Weight Log Regression" in a special way to automatically optimize the calorie level to improve body composition. Since the user is inputting daily weight and body fat percentage measurements and eating according to the calorie level shown, NUT can determine if fat mass is going down and lean mass is going up at that particular calorie level. If so, NUT does nothing. If fat mass is going up, NUT lowers the calories by 20. If both fat mass and lean mass are going down, NUT raises the calories by 20. If NUT makes calorie adjustments and is able to correct the direction of the regression lines and thus achieve true progress, NUT then automatically clears the weight log to start the cycle again, and initializes the new weight log with the terminus of the previous regression. Therefore, each regression cycle between clearings should reflect lean mass going up and and fat mass going down. Cycles alternate between the previously described cycle which preferentially prevents fat mass gain and an inverse cycle which preferentially prevents lean mass loss: In this alternate cycle, if lean mass is going down, NUT raises the calories by 20, but if both lean and fat mass are going up, NUT lowers the calories by 20. The automatic clearing of the weight log signals success for a cycle, but there may be periods of progress when no calorie adjustments are necessary.

Plot Daily and Monthly Trends: The list of nutrients is presented and one nutrient is chosen for its level to be graphed facing a plot of protein, carbohydrate, and fat calories. The user enters the number of the nutrient plus a letter, either "d" or "m" to specify "daily" or "monthly" i.e., "22m". It is only necessary to enter the "d" or "m" once in order to set the mode. Monthly graphs cover the entire period of the meal database; daily graphs cover 36 days back from the last meal viewed or analyzed. The graphs of Daily Values for fat are special and show the constituent fat types symbolically where . = non-fatty acid constituents, s = saturated, m = monounsaturated, 6 = unspecified Omega-6, 3 = unspecified Omega-3, L = linoleic acid, A = arachidonic acid, n = linolenic acid, e = EPA, and d = DHA. In a similar vein, the "Total Carb" graph shows non-fiber carb as "." and fiber as ":".

Record 'The Usual'--Customary Meals: When NUT asks what you are having, you can answer "the usual." Specifically, this function allows you to record a customary meal, and give it a name. Later, when recording a regular meal, all these foods can be added to the meal quickly by typing "theusualname", where "name" is the name you gave to the customary meal. Foods added this way can be individually deleted from the meal, and other foods added, because this function does not make the individual foods lose their identity as in "Add a Recipe."

Print Menus from Meal Database: Makes a printable file (called "menus.txt" in the current directory) which lists foods and quantities recorded for each meal, and a nutrient analysis that is the sum of nutrients for each meal, not the rate of nutrient intake as on the "Analyze Meals" screen. In common with other functions in the program, it looks back from the last meal recorded or analyzed, only prints the number of meals last analyzed, and prints that set of nutrients last displayed on an analysis or "View Foods" screen.  


sr26.nut        Joined text version of USDA Nutrient Database
FOOD_DES.txt    USDA-format food records for user recipes and edits
NUT_DATA.txt    USDA-format nutrient records for user recipes and edits
WEIGHT.txt      USDA-format weight records for user recipes and edits
WEIGHT.lib      Joined serving sizes from USDA Nutrient Database
food.db         Food database
meal.db         Meal database
theusual.db     Customary Meals database
OPTIONS.txt     Personal Options records
WLOG.txt        Weight Log records
WLOG.{date}     Cleared Weight Log named with date of clearing
WLOG.aux        Copy of Weight Log with fat and lean weights calculated
fontsize        Controls changes in resizing of graphical interface
version         NUT software version number
menus.txt       ASCII print file of meal database


Jim Jozwiak (,


Copyright (C) 1996-2014 by Jim Jozwiak.




This document was created by man2html, using the manual pages.
Time: 02:03:00 GMT, December 12, 2013