This reaction converts RO(-) and ROH + acyl halide to ester, but not RO(-) and anhydride:
<?xml version="1.0" ?>
<MDocument>
<MChemicalStruct>
<reaction>
<propertyList>
<property dictRef="NAME" title="NAME">
<scalar><![CDATA[ROH or RO(-) + acyl halide]]></scalar>
</property>
<property dictRef="EXCLUDE" title="EXCLUDE">
<scalar><![CDATA[totalCharge(reactant(1)) < 0]]></scalar>
</property>
<property dictRef="STANDARDIZATION" title="STANDARDIZATION">
<scalar><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!-- Standardizer configuration file -->
<!-- This configuration file is created with ChemAxon Config Builder -->
<StandardizerConfiguration Version ="0.1">
<Actions>
<Transformation ID="O- to OH" Structure="[#8-]>>O[H]" Type="string" Groups="reactant1"/>
</Actions>
</StandardizerConfiguration>
]]></scalar>
</property>
</propertyList>
<reactantList>
<molecule molID="m1">
<atomArray
atomID="a1 a2"
elementType="O H"
mrvMap="1 0"
x2="-10.705597877502443 -9.165597877502442"
y2="1.8034518957138062 1.8034518957138062"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
</bondArray>
</molecule>
<molecule molID="m2">
<atomArray
atomID="a1 a2 a3 a4"
elementType="O C H Cl"
mrvMap="0 3 2 4"
mrvQueryProps="0 0 L,H,C,N,O: L,Cl,Br:"
x2="-6.062668323516846 -6.062668323516846 -7.396347445344881 -4.72898920168881"
y2="1.6499665975570679 0.10996659755706784 -0.6600334024429327 -0.6600334024429321"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="2" />
<bond atomRefs2="a2 a4" order="1" />
<bond atomRefs2="a2 a3" order="1" />
</bondArray>
</molecule>
</reactantList>
<productList>
<molecule molID="m3">
<atomArray
atomID="a1 a2 a3 a4"
elementType="O C H O"
mrvMap="0 3 2 1"
mrvQueryProps="0 0 L,H,C,N,O: 0"
x2="6.739703648885091 6.739703648885091 5.406024527057055 8.073382770713128"
y2="2.049901749293009 0.5099017492930091 -0.26009825070699133 -0.2600982507069899"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="2" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a4" order="1" />
</bondArray>
</molecule>
</productList>
</reaction>
</MChemicalStruct>
</MDocument>
This reaction converts RO(-) and ROH + acyl halide and RO(-) + anhydride to ester, but the - charge remains on the product O when the starting material is RO(-):
<?xml version="1.0" ?>
<MDocument>
<MChemicalStruct>
<reaction x1="-2.1815262500662564" y1="0.6140698344107605" x2="2.8829552215934973" y2="0.5549347887956778">
<propertyList>
<property dictRef="NAME" title="NAME">
<scalar><![CDATA[ROH or RO(-) + acyl halide, RO(-) + anhydride]]></scalar>
</property>
<property dictRef="REACTIVITY" title="REACTIVITY">
<scalar><![CDATA[
(match(ratom(1), "[OX2:1][H]", 1)
&& !match(ratom(4), "[O:1]", 1))
|| (match(ratom(1), "[OX1-:1]", 1)
&& (!match(ratom(4), "[O:1]", 1)
|| match(ratom(4), "O=C[O:1]C=O", 1)))
]]></scalar>
</property>
<property dictRef="EXCLUDE" title="EXCLUDE">
<scalar><![CDATA[totalCharge(reactant(1)) < 0]]></scalar>
</property>
</propertyList>
<reactantList>
<molecule molID="m1">
<atomArray
atomID="a1"
elementType="O"
mrvMap="1"
x2="-9.844574928283691"
y2="2.546010971069336"
/>
<bondArray>
</bondArray>
</molecule>
<molecule molID="m2">
<atomArray
atomID="a1 a2 a3 a4"
elementType="O C H O"
mrvMap="0 3 2 4"
mrvQueryProps="0 0 L,H,C,N,O: L,O,Cl,Br:"
x2="-6.062668323516846 -6.062668323516846 -7.396347445344881 -4.72898920168881"
y2="1.6499665975570679 0.10996659755706784 -0.6600334024429327 -0.6600334024429321"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="2" />
<bond atomRefs2="a2 a4" order="1" />
<bond atomRefs2="a2 a3" order="1" />
</bondArray>
</molecule>
</reactantList>
<productList>
<molecule molID="m3">
<atomArray
atomID="a1 a2 a3 a4"
elementType="O C H O"
mrvMap="0 3 2 1"
mrvQueryProps="0 0 L,H,C,N,O: 0"
x2="6.739703648885091 6.739703648885091 5.406024527057055 8.073382770713128"
y2="2.049901749293009 0.5099017492930091 -0.26009825070699133 -0.2600982507069899"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="2" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a4" order="1" />
</bondArray>
</molecule>
</productList>
</reaction>
</MChemicalStruct>
</MDocument>
First reaction definition gives,
CO.CC(Cl)=O>>COC(C)=O
CO.CC(=O)OC(C)=O>>
C[O-].CC(Cl)=O>>COC(C)=O
C[O-].CC(=O)OC(C)=O>>
Second reaction definition gives,
CO.CC(Cl)=O>>COC(C)=O
CO.CC(=O)OC(C)=O>>
C[O-].CC(Cl)=O>>C[O-]C(C)=O
C[O-].CC(=O)OC(C)=O>>C[O-]C(C)=O
Desired results:
CO.CC(Cl)=O>>COC(C)=O
CO.CC(=O)OC(C)=O>>
C[O-].CC(Cl)=O>>COC(C)=O
C[O-].CC(=O)OC(C)=O>>COC(C)=O