Just wanna ask a rather noob question here. If i want to make my own gun barrel, how to determine optimal barrel length and barrel twist given specific caliber. is there a calculation that i can use.

Please tell us what cartridge it will be chambered in, model of rifle, and what it'll be used for and what ranges so we can help you.

As the Bear said- for what round?. Formulae (plural, I think) are based on ratio of length to diameter of the bullet (indirectly, longer bullets weigh more, so weight gets in there, and heavier bullets are usually slower). LOT of difference between a 22-250, and a .54 cal muzzleloader-

Wait, I just checked your other posts. You have never owned a gun and only fired a few rounds! Seriously, don't take this the wrong way but starting with a 20mm round would be insane, unsafe and a disaster waiting to happen. Not to mention likely illegal as all hell as you said in another post firearms are highly regulated where you live. Start with a .22LR or pistol caliber. I fear if you try to make your own 20mm rifle barrel we will never hear the results from you. We might see on the news about some guy who blew himself up but won't hear first hand that it was you.

Making a barrel is a little more involved than drilling a hole in a round piece of bar stock man. It take years to learn how to deep hole drill and how to set up a lathe and rifling machine. Then you have to traighten the barrel before machining it... Lets just say there is a whole lot to producing a half way decent barrel. If you want on best to order it. The classic Greenhill equation is T' = 150 / L' where the twist and the bullet length are in calibers. Removing bullet diameter from twist and length gives the equation often found: T = 150 * D^2 / L The Greenhill equation includes no term for muzzle velocity, and several sources suggest replacing the 150 with 180 for muzzle velocities over 2800 fps. Increasing muzzle velocity increases bullet spin, and spin provides the stability. An article in the 11/2001 Single Shot Exchange cites an article by Les Bowman in the 1962 Gun Digest offering an equation which includes muzzle velocity (in fps): T = 3.5 * V^0.5 * D^2 / L At 2800 fps, this equation is equivalent to using 185 in the Greenhill equation, and at 1840 fps, this equation is the same as Greenhill's. Ken Howell wrote about twist rate in the 07/1999 issue of Varmint Hunter magazine. He mentioned Greenhill's work began with cannons in 1879. Two quotes Howell took from the Textbook of Small Arms (published in 1929 in Britain) are notable. "In actual practice Greenhill's figure of 150 can be increased safely to 200 and still control the bullet." The classic equation is for solid, lead alloy bullets of specific gravity (SG) 10.9, and "when the density of the bullet is less than that of lead or the density of the resisting medium is greater than that of air, the spin should be increased as the square root of the ratio of the densities." As SG decreases, the gyroscopic inertia of the bullet decreases in proportion, and one needs to increase the spin to compensate. Howell feels one can overstablize a bullet. Ideally, the bullet's axis will keep tangent to the flight path, but overstablized, the bullet will instead remain pointing in the direction of the barrel. He offered no way to quantify such overstabilization. C.E. Harris, writing in the 08/1983 issue of the American Rifleman, noted Greenhill's formula was developed before spitzer boattail bullets and high velocity cartridges. He used a more modern analysis of gyroscopic stability, in which a factor of 1.4 is minimum and 1.7 is usually good. He found that the numbers given by Greenhill's original formula ranged from 1.5 to 2.0 for military type boattail bullets and were about 2.0 for bullets with either a flat base or short boattails. The basic twist rate calculator above uses Bowman's equation modified with the SG correction quoted by Howell. For flat base bullets, the calculator should give a good estimate for the twist needed. The estimates should work for some boattail designs, but VLD and ULD style bullets may well need more twist. Note that conventional bullets made with thick copper jackets will need to use a lower SG, moving closer to the SG of copper as the jacket thickness increases. John Knight in England offers a free Win32 executable, WinGyro, which provides a much more sophisticated analysis than done in the calculator here. In comparing results from this calculator to those of WinGyro, it appears that Bowman's correction can be too optimistic regarding the effect that muzzle velocity has on stability. Using a velocity of 1840 fps here (reducing the calculations to that of Greenhill's equation) sometimes gives a better match to WinGyro's results. Another fine tool for estimating twist rates (and ballistic coefficients) is found on the JBM site. Gain Twist Gain twist is a recurring fad. The theory is that with little twist at bullet start, the bullet will engrave easier allowing one to use more powder. The twist then increases as the muzzle is approached in order to give the bullet sufficient stability for flight. One problem with gain twist is that the bullet must be deformed some as the engraving angle (of the rifling upon the bullet surface) changes. As for a potential increase in velocity, in the 6/1979 American Rifleman, W.C. Davis notes that the rotational energy of a bullet is a tiny fraction of the translational energy; for the .30-06, it's about 0.35%. Further, Harris, in the 7/1977 American Rifleman, mentions twist has less effect on pressure than either barrel wear or the dimensions of the chamber, throat, and rifling, and that "for practical purposes, the effect of a reasonable change in rifling twist upon pressure can be ignored." From this, I concluded twist will have little effect on the velocity potential of any cartridge, and for what little effect there is on chamber pressure, one can fully compensate by using a powder of slightly different speed.

Is there any weight saving measures that can be applied on the rifle barrel, like grooving for example.