It appears that Taking Proton Pump Inhibitors (one type of stomach acid medicine) and Diuretics ("water pills") can result in low magnesium levels in the blood.
So, if you are taking both, maybe have a word with your doctor? I do not feel comfortable suggesting what to do.
Kidney Int. 2013 Apr;83(4):553-6. doi: 10.1038/ki.2012.462.
Proton pump inhibitors and hypomagnesemia: a rare but serious complication.
Section of Nephrology, Department of Medicine, Yale University School of Medicine, New Haven, Connecticut, USA.
Proton pump inhibitors (PPIs) promote hypomagnesemia through loss of active Mg(2+) absorption via transient receptor potential melastatin-6 and -7 (TRPM6/7). Danziger et al. confirm the association of PPIs with hypomagnesemia in patients hospitalized at a tertiary medical center. They found that patients taking PPIs, compared with those receiving histamine-2 antagonists or no acid-suppressive medications, had a decline in serum Mg(2+) after adjusting for several clinical and laboratory factors. The effect was seen only in those concomitantly receiving diuretics.
[PubMed - in process]
Wiki says Proton Pump Inhibitors includes:
Omeprazole (brand names: Gasec, Losec, Prilosec, Zegerid, ocid, Lomac, Omepral, Omez,)
Lansoprazole (brand names: Prevacid, Zoton, Monolitum, Inhibitol, Levant, Lupizole)
Dexlansoprazole (brand name: Kapidex, Dexilant)
Esomeprazole (brand names: Nexium, Esotrex, esso)
Pantoprazole (brand names: Protonix, Somac, Pantoloc, Pantozol, Zurcal, Zentro, Pan, Controloc, Tecta)
Rabeprazole (brand names: AcipHex, Pariet, Erraz, Zechin, Rabecid, Nzole-D, Rabeloc, Razo. Dorafem: combination with domperidone).
Ilaprazole (brand names: Noltec, Yili'an, Ilapro, Lupilla, Adiza)
Picture is of crystals of metallic magnesium.