How would I make a basic protein folding algorithm?
It is far, far more difficult that a naive approach suggests
The reason why simulating protein folding is extremely hard is the combinatorial complexity of the options you have to explore to get the &quot;right&quot; answer. This exhausts your computers memory or computing capacity far faster than it will for simple molecules.
It is possible to see why this is so from very simple considerations. The backbone of a protein consists of peptide bonds (which can rotate fairly freely) plus two rotating bonds in each amino acid. even ignoring the amino acid side chains (which often have multiple rotatable bonds) even a dipeptide has 5 bonds where you have to explore the possible rotations to find the optimal configuration of the extremely simple molecule. Since proteins consist of between 50 and 2000 amino acids that leaves a gargantuan number of options to consider, even if we can ignore all the other things that matter.
And those other things do matter. A simple example is that the configuration at a specific bond in the backbone may depend on the spatial orientation of other bonds dozens of bonds away so every choice at one site depends on all the other choices on all the other bonds. Optimising one bond at a time just doesn't work. On top of that is the complexity of including the side chains. That makes the problem harger by another gargantuan degree even if you don't consider the specific possible interactions of those side chains with each other (which are know to be important in many real proteins in stabilising specific spatial structures.
On top of those complexities, real proteins fold themselves in the environment of the inside of cells where interactions with water matter. So you have to consider those interactions as well. And, on top of that, the machinery that makes proteins consists of other pieces of molecular machinery designed to force specific shapes to emerge (heat shock proteins or chaperones are known to do this job).
One way to simplify the task so its difficulty is apparent is to realise that a simple protein chain has an extraordinary number of possible ways to fold only one of which is the &quot;right&quot; way in a living system. The problem is not finding a possible structure, but the right structure. Given the almost-impossible-to-count number of options, it is beyond the capacity of computation to find the right one by any known search algorithm.
This is why large teams of professionals have failed over decades to find a good general approach even when using vast amounts of specific biological knowledge from known structures. It is simply not a problem that can be tackled by amateurs.