Catalyzes the ATP-dependent biosynthesis of glutamine from glutamate and ammonia. ATP + L-glutamate + NH4(+) = ADP + H(+) + L-glutamine + phosphate Binds 2 Mg(2+) ions per subunit. Activity increases by approximately two-fold in the presence of GCBP. Interacts with GCBP (TTHA1554). Belongs to the glutamine synthetase family.