Theory of protein secondary structure and algorithm of its prediction