Magnesium is very important for heart function. The tricky part is to get enough without reaching bowel intolerance. There is a product called CALM which is a powder you mix with water at night which is straight Magnesium Citrate. It is very commonly found in health food stores.
Also, these other items have a scientific base for improving A-fib. Taurine, Coenzyme-Q-10 or Ubiquinol, L-Carnitine, Fish Oil (choose one that is high in EPA/DHA. No less than 1,000mg in total EPA/DHA each day), D-Ribose, Hawthorn Berry, and Vitamin D at 3,000 iu per day. See the blog list previously posted of Potassium rich foods. Potassium is extremely important for heart function but you can’t get enough in over the counter health store items.
What causes A-Fib? Who knows, but it could possibly be that one or more of these nutrient items were not in your diet over a period of time to allow it to happen.