def METHOD_NAME(system, solver, T, P):
    # Initial values of the carbonates and mass of water
    n0Calcite = 10.0
    n0Dolomite = 10.0
    water_kg = 1.0
    # Define initial equilibrium state corresponding to the seawater
    state_sw = ChemicalState(system)
    state_sw.temperature(T, "celsius")
    state_sw.pressure(P, "atm")
    state_sw.set("H2O", 1.0, "kg")
    state_sw.set("Ca+2", 412.3 * water_kg, "mg")
    state_sw.set("Mg+2", 1290 * water_kg, "mg")
    state_sw.set("Na+", 10768.0 * water_kg, "mg")
    state_sw.set("K+", 399.1 * water_kg, "mg")
    state_sw.set("Cl-", 19353.0 * water_kg, "mg")
    state_sw.set("HCO3-", 141.682 * water_kg, "mg")
    state_sw.set("SO4-2", 2712.0 * water_kg, "mg")
    # Calculate chemical state corresponding to the seawater
    res = solver.solve(state_sw)
    # Throw exception if the equilibrium couldn't be found
    assert res.succeeded(), "The equilibrium calculation did not succeed!"
    # Add carbonates
    state_sw.set("Dolomite", n0Dolomite, "mol")
    state_sw.set("Calcite", n0Calcite, "mol")
    # Equilibrate the seawater with carbonates
    solver.solve(state_sw)
    # Fetch values of the specified species
    nDolomite = float(state_sw.speciesAmount("Dolomite"))
    nCalcite  = float(state_sw.speciesAmount("Calcite"))
    nCa2      = float(state_sw.speciesAmount("Ca+2"))
    nMg2      = float(state_sw.speciesAmount("Mg+2"))
    nH        = float(state_sw.speciesAmount("H+"))
    nHCO3     = float(state_sw.speciesAmount("HCO3-"))
    return (nCalcite, nDolomite, nCa2, nMg2, nH, nHCO3)