Condenses 4-methyl-5-(beta-hydroxyethyl)thiazole monophosphate (THZ-P) and 2-methyl-4-amino-5-hydroxymethyl pyrimidine pyrophosphate (HMP-PP) to form thiamine monophosphate (TMP). Catalyzes the phosphorylation of hydroxymethylpyrimidine phosphate (HMP-P) to HMP-PP, and of HMP to HMP-P. 2-[(2R,5Z)-2-carboxy-4-methylthiazol-5(2H)-ylidene]ethyl phosphate + 4-amino-2-methyl-5-(diphosphooxymethyl)pyrimidine + 2 H(+) = CO2 + diphosphate + thiamine phosphate 2-(2-carboxy-4-methylthiazol-5-yl)ethyl phosphate + 4-amino-2-methyl-5-(diphosphooxymethyl)pyrimidine + 2 H(+) = CO2 + diphosphate + thiamine phosphate 4-amino-2-methyl-5-(diphosphooxymethyl)pyrimidine + 4-methyl-5-(2-phosphooxyethyl)-thiazole + H(+) = diphosphate + thiamine phosphate 4-amino-5-hydroxymethyl-2-methylpyrimidine + ATP = 4-amino-2-methyl-5-(phosphooxymethyl)pyrimidine + ADP + H(+) 4-amino-2-methyl-5-(phosphooxymethyl)pyrimidine + ATP = 4-amino-2-methyl-5-(diphosphooxymethyl)pyrimidine + ADP Binds 1 Mg(2+) ion per subunit. Cofactor biosynthesis; thiamine diphosphate biosynthesis; 4-amino-2-methyl-5-diphosphomethylpyrimidine from 5-amino-1-(5-phospho-D-ribosyl)imidazole: step 3/3. Cofactor biosynthesis; thiamine diphosphate biosynthesis; thiamine phosphate from 4-amino-2-methyl-5-diphosphomethylpyrimidine and 4-methyl-5-(2-phosphoethyl)-thiazole: step 1/1. There is also a ThiE protein in this bacteria (AC Q8FP55). In the N-terminal section; belongs to the thiamine-phosphate synthase family. In the central section; belongs to the ThiD family. In the C-terminal section; belongs to the thiaminase-2 family.