The geochemistry of acid mine drainage