Catalyzes the phosphorylation of hydroxymethylpyrimidine phosphate (HMP-P) to HMP-PP, and also probably that of HMP to HMP-P. 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 Cofactor biosynthesis; thiamine diphosphate biosynthesis; 4-amino-2-methyl-5-diphosphomethylpyrimidine from 5-amino-1-(5-phospho-D-ribosyl)imidazole: step 2/3. Cofactor biosynthesis; thiamine diphosphate biosynthesis; 4-amino-2-methyl-5-diphosphomethylpyrimidine from 5-amino-1-(5-phospho-D-ribosyl)imidazole: step 3/3. By absence of thiamine. Present with 195 molecules/cell in log phase SD medium. In the N-terminal section; belongs to the ThiD family. In the C-terminal section; belongs to the thiaminase-2 family.