In Marx's Capital, when describing the amount of food the average person is able to eat, he uses not calories but "grains of nitrogen" and "grains of carbon."
During the cotton famine of 1862, Dr. Smith was charged by the Privy Council with an inquiry into the conditions of nourishment of the distressed operatives in Lancashire and Cheshire. His observations during many preceding years had led him to the conclusion that “to avert starvation diseases,” the daily food of an average woman ought to contain at least 3,900 grains of carbon with 180 grains of nitrogen; the daily food of an average man, at least 4,300 grains of carbon with 200 grains of nitrogen; for women, about the same quantity of nutritive elements as are contained in 2 lbs. of good wheaten bread, for men 1/9 more; for the weekly average of adult men and women, at least 28,600 grains of carbon and 1,330 grains of nitrogen.
-Capital, Vol 1, Chapter 25, Section 5
I assume this is because nutritional science has come a long way since 1867, but what exactly do those terms refer to? It seems to be some measurement of wheat based on context but I'm not sure how.
A "grain" is a conventional unit of weight equal to about 0.065 grams. In this context, I believe Dr. Smith is being quoted as describing the chemical content of a day's nutrition worth of bread. 3900 grains is just over half a pound, and 180 grains is a little less than half an ounce, which sounds about right for the elemental carbon and nitrogen content of a 2 lb loaf of bread. The remainder would be mostly oxygen and hydrogen.
In this context, the two elements are likely being used as proxies for what modern nutritionists understand as the macronutrients Carbohydrates (made mostly of carbon, hydrogen, and oxygen) and Protein (which also contains nitrogen). The chemical composition of these macronutrients had been described in general terms by the chemist Justus von Liebeg in the 1840s, and the general macronutrient categories had been identified even earlier (by William Prout in 1827), so Dr. Smith probably would have understood the elemental composition of the food was a proxy for its macronutrient profile.
It seems to be some measurement of wheat based on context but I'm not sure how.
The unit of weight "grain" is indeed based on cereal grains (although barley rather than wheat). This doesn't have anything to do with the topic of food and nutrition - barley grains were for a long time an important customary and legal "standard" for units of measurement in Britain. I say "standard" because it isn't what we would describe as a standard today - even if the "standard" specifies that the grains are dry and come from the middle of the ear, there is still a lot of variation between individual grains.
The use of barley as a standard for units of measurement in Britain goes back to Anglo-Saxon England, if not earlier. The evolution of standards of measurement in Britain is unfortunately obscure until the late Medieval period, due to poor documentation, so there's a lot we don't know. Generally, for weight, barley was the original standard, with ounces defined in terms of a number of grains of barley. Wheat was adopted as a later standard, usually on the basis of 4 wheat grains = 3 barley grains, and ounces then re-defined in terms of wheat rather than barley. Note also that, even after the unification of England, there were multiple regional standards and therefore different ounces in use in different places (and sometimes in the same place, for measuring different things, which is still the case today with avoirdupois and troy ounces and pounds simultaneously in use).
Eventually, actual grains were replaced by physical standard masses, and finally standards in the modern sense were in place. Following the loss of the original grain-standards when the Palace of Westminster (used as the House of Parliament) burned in 1834, the (avoirdupois) pound became the new standard, with the grain defined as 1/7000 of a pound.
Grains are smaller than required for most everyday purposes by most people, but were widely used by those who regularly needed to measure small weights, such as jewellers and apothocaries/pharmacists (who used them until metrification, with some minor residual use still remaining). Grains are still conventionally used for the measurement of gunpowder, and for weighing arrows.
(The inch was long defined as the length of three barley grains laid end-to-end, or 4 side-by-side; this was still used as a legal definition as late as a statute of 1685.)
Further reading:
Ronald Edward Zupko, British Weights & Measures: A History from Antiquity to the Seventeenth Century, University of Wisconsin Press, 1977.
Zupko's Revolution in Measurement: Western European Weights and Measures Since the Age of Science, American Philosophical Society, 1990 covers pre-modern standards in the introductory chapters.