Task: Fix disconnection of magnesium acetate in covalent form. (rdkit/rdkit#5998)

org: rdkit
repo: rdkit
pr_number: 5998
issue_title: Fix disconnection of magnesium acetate in covalent form.
issue_body: 
#### Reference Issue
Fixes #5997


#### What does this implement/fix? Explain your changes.
Skips valence of -1 in metal valence list when patching charges after disconnection.

#### Any other comments?


resolved_issues: number: 5997
title: Incorrect disconnection of CC(=O)O[Mg]OC(=O)C
body: **Describe the bug**
The metal disconnector gives CC(=O)[O-].CC(=O)[O-].[MgH2] when disconnecting CC(=O)O[Mg]OC(=O)C

**To Reproduce**
```
from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize

mol = Chem.MolFromSmiles("CC(=O)O[Mg]OC(=O)C")
md = rdMolStandardize.MetalDisconnector()
nm = md.Disconnect(mol)
print(Chem.MolToSmiles(nm))
```
**Expected behaviour**
I expected to get CC(=O)[O-].CC(=O)[O-].[Mg+2]

**Configuration (please complete the following information):**
 - RDKit version: 2022.09.4
 - OS: macOS Monterey 12.6.2 M1 chip
 - Python version (if relevant): 3.10.8
 - Are you using conda? mamba
 - If you are using conda, which channel did you install the rdkit from? conda-forge
 - If you are not using conda: how did you install the RDKit?  I also see this when I build from the master branch.

**Additional context**
 I think it is because the allowed valence of -1 (any valence) was recently added to Mg's valence list to accommodate Grignard
reagents expressed in the form [CH3-]->[Mg+2]<-[Cl-].
The Ba analogue of the original input structure gives an analogous erroneous disconnected structure and also has -1 in its valence list.
I will work on a fix.



Reference solution:
fix_patch: diff --git a/Code/GraphMol/MolStandardize/Metal.cpp b/Code/GraphMol/MolStandardize/Metal.cpp
index d3e2e7ee96b..974ef4f3220 100644
--- a/Code/GraphMol/MolStandardize/Metal.cpp
+++ b/Code/GraphMol/MolStandardize/Metal.cpp
@@ -21,10 +21,10 @@ using namespace std;
 using namespace RDKit;
 namespace RDKit {
 class RWMol;
+
 class ROMol;
 
 namespace MolStandardize {
-
 MetalDisconnector::MetalDisconnector()
     : metal_nof(
           SmartsToMol("[Li,Na,K,Rb,Cs,Fr,Be,Mg,Ca,Sr,Ba,Ra,Sc,Ti,V,Cr,Mn,Fe,Co,"
@@ -181,6 +181,13 @@ void MetalDisconnector::disconnect(RWMol &mol) {
     auto currentFc = a->getFormalCharge();
     const auto &valens =
         PeriodicTable::getTable()->getValenceList(a->getAtomicNum());
+    // valens should have at least -1 in it, as the atom data is currently
+    // configured, so max_element should never return valens.end().
+    auto max_valence = *std::max_element(valens.begin(), valens.end());
+    // Don't go over the maximum real valence.
+    if (max_valence != -1 && currentFc >= max_valence) {
+      continue;
+    }
     int fcAfterCut = it->second;
     if (currentFc > 0) {
       // if the original formal charge on the metal was positive, we trust it
@@ -189,6 +196,11 @@ void MetalDisconnector::disconnect(RWMol &mol) {
     }
     if (!valens.empty() && valens.front() != -1) {
       for (auto v = valens.begin(); v != valens.end(); ++v) {
+        // Some metals (e.g. Mg and Ba) have -1 as a final catchall, which
+        // is unhelpful for this.
+        if (*v == -1) {
+          continue;
+        }
         if (fcAfterCut > *v) {
           auto next = v + 1;
           if (next != valens.end() && fcAfterCut >= *v) {
@@ -211,6 +223,5 @@ void MetalDisconnector::disconnect(RWMol &mol) {
     a->updatePropertyCache();
   }
 }
-
 }  // namespace MolStandardize
 }  // namespace RDKit