************************************************************
************************************************************
*        Features in PHREEQC++ Not in PHREEQC              *
*        Revisions and Bug Fixes                           *
*        PHREEQC++ is used only in IPhreeqc Modules        *
************************************************************
------------------------------------------------------------
Version 2.18.3: August 16, 2011
------------------------------------------------------------
	See PHREEQC release notes.
	
------------------------------------------------------------
Version 2.18.2: April  9, 2011
------------------------------------------------------------          --------
        --------
        svn 5471
        --------
        Added PHASE_FORMULA and LIST_S_S Basic functions.
        
        PHASE_FORMULA returns a string value with the 
        chemical formula for the phase as defined in 
        PHASES data. If 4 arguments are provide, a list 
        of the elements and stoichiometric coefficients for 
        elements are returned.
        
        USER_PRINT
        10 min$ = "Calcite"
        20 form$ = PHASE_FORMULA(min$)
	30 print min$, form$
	40 form$ = PHASE_FORMULA(min$, count, elts$, coefs)
	50 for i = 1 to count
	60 print "   ", PAD(elts$[i], 20), coefs[i]
	70 next i 
	
	This example produces the following output:
	
Calcite CaCO3 
	C                               1 
	Ca                              1 
	O                               3 

        LIST_S_S returns the sum of moles of all components
        in a specified solid solution. Lists of the components
        and the number of moles of each component are also
        returned. 

   
	SOLID_SOLUTIONS 1
	Calcite_s_s
           -comp Calcite 0.01
           -comp Smithsonite 0.001
           -comp Strontianite 0.02
	USER_PRINT
        10 name$ = "Calcite_s_s"
	20 total = LIST_S_S(name$, count, comp$, moles)
	30 print PAD(name$, 20), total
	40 for i = 1 to count
	50 print "   ", PAD(comp$[i], 20), moles[i], moles[i]/total
	60 next i

        This example produces the following output:
        
Calcite_s_s           3.0876e-002 
    Calcite               9.9316e-003  3.2166e-001 
    Smithsonite           9.6666e-004  3.1308e-002 
    Strontianite          1.9978e-002  6.4704e-001 
    
        --------
        svn 5455
        --------
        REACTION_MODIFY keyword was added to the modules. Previously,
        REACTION_MODIFY was not recognized as a keyword.
        
        --------
        svn 5453
        --------     
        Fixed bug with in READ_SOLUTION_RAW. A read error occurred
        when -isotopes was encountered.
        
        --------
        svn 5448
        -------- 
        Reading of default user number, but specified description
        was in error under some conditions.
 
        --------
        svn 5431
        --------  
        RUN_CELLS was rewritten to perform multiple calculations
        if multiple steps are defined in REACTION, REACTION_TEMPERATURE,
        or KINETICS. It now operates in the same way that a 
        series of USE and SAVES would operate. Previously, only
        one step of a series of reaction steps was taken. If a 
        time step is provided in RUN_CELLS for kinetic reactions and
        nmax is the maximum number of steps defined for REACTION,
        REACTION_TEMPERATURE, and KINETICS, the time step is divided 
        into nmax equal increments. It is equivalent to the following
        definition in kinetics: -step time_step in nmax steps.
        
        --------
        svn 5324
        --------   
        Modified solution method for solid solutions so that
        mole transfers were limited to the total amount
        available in the system.
        
------------------------------------------------------------
Version 2.18.0: April  9, 2011
------------------------------------------------------------  

        --------
        svn 5281
        -------- 
        If SOLUTION_MODIFY is used to change a total for an element,
        the activities for the master species of the element are
        automatically updated by the ratio of the new total to the 
        old total, unless activities are specifically set for the
        element with -activities. All valence states of redox elements
        are adjusted.

        --------
        svn 5270
        --------
	Added logic to update estimates of log activity when
	modifying totals in SOLUTION_MODIFY. The initial 
	guesses for activities are adjusted proportionally
	to the change in total moles of elements (as defined
	by SOLUTION_MODIFY; -totals). 

	This automatic adjustment is suggested rather than
	explicit definition of the initial guesses through
	SOLUTION_MODIFY; -activities. However, the -activities
	identifier may be used and will supercede the automatic
	adjustment.  

	The adjustment of the initial guesses for activities
	should reduce the number of iterations needed to solve 
	a given set of equations and, consequently, should
	lessen the total CPU time for a simulation.
	
        --------
        svn 4897
        --------
        Added capability to include files within the input
        file. Files included in include files are also 
        included. Files are included verbatim and need not
        contain complete keyword datablocks; however, the
        combination of included files must result in a
        legal PHREEQC input file. Files are included as
        simulations are proceeding, so it is possible to
        write a file at one point of a run that is included
        later in the same run. Included files can contain
        INCLUDE$ directives.
        
        SOLUTION
        INCLUDE$ file_name
        END
        
        where "file_name" contains:
        EQUILIBRIUM_PHASES
        	Calcite 0 10
        
        is the same as a single file with 
        SOLUTION
        EQUILIBRIUM_PHASES
        	Calcite 0 10
        END
        
        --------
        svn 4856
        --------
        Revised logic of searching pitzer parameters so that
        order of ions in a parameter definition does not 
        matter. 
        
        --------
        svn 4823
        --------
        Added -cells to DUMP and DELETE; cell option to COPY.
        Example:
        
        COPY cell 1 4
        COPY cell 1 5-10
        DUMP 
         	-cell 1 2-3  10
        DELETE
        	-cell 1-3 4 8-10
        
        COPY cell n range
        
        The cell option of the COPY keyword causes all reactants
        defined with identifying number n to be copied to a single 
        range of numbers. The range of numbers can be a single 
        number or a range of numbers given by an integer, a 
        hyphen, and an integer, with no intervening spaces.
        
        DUMP
        	-cell list
        
        The  -cell option writes _RAW formatted output to a 
        specified file(see below for more details) for each 
        reactant that is defined in the list.
        
        DUMP
        	-cell list
        The -cell deletes from memory all reactants that are 
        defined with identifying numbers in the list.
        
        The list of numbers for DUMP and DELETE are
        more flexible than for COPY. A list of ranges can be 
        given for DUMP and DELETE, where each element of 
        the list can be a single number or a range of numbers
        defined by an integer, a hyphen, and an ingeger, with 
        no intervening spaces. 
        
        --------
	svn 4816
	--------
	Added compile capability to use #include file_name
	in input and database files. PHREEQCPP process the 
	files at the start of the run, possibly following
	multiple layers of include files, to produce a stream 
	that is then used as input. Compile define is
	MERGE_INCLUDE_FILES; PHREEQC_CLASS also must be defined.
	
	Input file:
	SOLUTION 1 
	#INCLUDE t2		  	 
	#include t4
	END 
	
	File t2:
	REACTION
		NaCl
		1 mmol
	#include t3
	
	File t3:
	REACTION_TEMPERATURE
	10 20 30
	
	File t4:
	SAVE solution 1
	
	When compiled with the include file #defines, the above 
	set of files produces the following input for PHREEQC:
	
	SOLUTION 1 
	REACTION
		NaCl
		1 mmol
	REACTION_TEMPERATURE
	10 20 30	
	SAVE solution 1	
	END 

	--------
	svn 4800
	--------
	
	Added capability to dump REACTIONs, REACTION_TEMPERATUREs,
	and MIXes.
	
	DUMP
		-mix  1 4 6
		-reaction 1-5
		-reaction_temperature 1 3-9
		
	List of numbers may be formatted as described for DUMP.
	Data are written in a format suitable for an input file
	to PHREEQCPP.
	
	Example of dumped keywords:
	
	MIX        1 
	  1     0.33
	  2     0.33
	  3     0.34
	REACTION_RAW        1 
	  -units              Mol
	  -reactant_list      
	    Ba   1
	    Br   2
	  -element_list       
	  -steps              
	    0.01 
	  -equal_increments   1
	  -count_steps        2
	REACTION_TEMPERATURE_RAW        1 
	  -count_temps        3
	  -equal_increments   1
	  -temps              
    		25 45 
	
	--------
	
	Added -cells option to DUMP.
	
	DUMP
		-cells 1-19 20
		
	This -cells option will dump any reactant with numbers
	between 1 and 20, including SOLUTIONs, EXCHANGERs,
	GAS_PHASEs, KINETICS, SOLID_SOLUTIONs, SURFACEs, REACTIONs, 
	REACTION_TEMPERATUREs, and MIXes.
	
	
	--------
	svn 3730
	--------
	
	Added keyword RUN_CELLS. 
	
	RUN_CELLS 
		-cells 1 2
		       5-6
		       7
		-time_step   10000
		-start_time  100
		
	
	For each i listed in -cells
	it is the equivalent of the following:
	
	USE solution i
	USE equilibrium_phases i
	USE exchange i
	USE surface i
	USE solid_solution i
	USE gas_phase i
	USE kinetics i
	USE reaction i
	USE reaction_temperature i
	SAVE solution i
	SAVE equilibrium_phases i
	SAVE exchange i
	SAVE surface i
	SAVE solid_solution i
	SAVE gas_phase i
	
	If MIX i is defined, it is used in place of USE solution i.
	A MIX i or SOLUTION i must be defined to use RUN_CELLS; -cells i.
	All other entities are used only if they are defined. 
	
	-start_time and -time_step are needed if any kinetic reactions
	are calculated. -start_time is the time at the start of the 
	calculation, and -time_step is the length of time over which 
	to integrate the kinetic reactions. 
	
	--------
	svn 3727
	--------
	Added keywords to allow modification of each reactant.
	A reactant must have been defined previously, but then
	each data item of the reactant can be changed and new
	components added. Data items read are changed, all 
	other data items remain the same. Input format is the 
	same as the RAW formats produced by DUMP. 
	
	
	New keywords are as follows:
	
	SOLUTION_MODIFY
	EQUILIBRIUM_PHASES_MODIFY
	EXCHANGE_MODIFY
	SURFACE_MODIFY
	SOLID_SOLUTIONS_MODIFY
	GAS_PHASE_MODIFY
	KINETICS_MODIFY
	
	The example below is indented to indicate which 
	information is necessary to change a data item.
	Working back through the indention levels for
	and item, each heading of a lower order is 
	necessary to define the data item. In the example
	below, to change the number of moles of barite from
	10 to 5 in the equilibrium phase assemblage, it 
	is necessary to define EQUILIBRIUM_PHASES_MODIFY 1; 
	-component; -name Barite; -moles 5. 
	
	Items identified by an asterisk are most likely to
	consider for redefinition. Items with (*) are
	marked to indicate that care is needed to maintain
	charge balance relations. Unwanted redox and pH
	reactions may result from incorrect redefinition
	of these quantities. Items not marked are either
	initial estimates of variables calculated in the
	simulation, or are parameters thought not likely
	to be changed.
	
	The MODIFY data blocks change the data in the
	PHREEQC storage structures. They do not cause
	any initial composition calculations. Neither 
	do they generate default reactions to be simulated.
	USE statements are needed to specify explicitly
	the desired reactions.

	
SOLUTION_MODIFY       1                                
  -temp              25                                *
  -total_h           111.01243359981                   (*)
  -total_o           55.506216800086                   (*)
  -cb                -3.6579285790756e-010             (*)
  -totals                                               
    Cl   0.0010000000000003                            (*)
    H(0)   1.4155655514601e-025                        (*)
    Na   0.0010000000000003                            (*)
  -Isotopes
  -pH                7
  -pe                4
  -mu                0.0010001035690258
  -ah2o              0.99996599647757
  -mass_water        1
  -total_alkalinity  3.6579283856577e-010
  -activities
    Cl   -3.0155266404974
    E   -4
    H(0)   -25.15
    Na   -3.0153891985103
    O(0)   -42.080029535586
  -gammas
EQUILIBRIUM_PHASES_MODIFY       1                      
  -eltList       
    Ba   1
    O   4
    S   1
  -component                                           *
    -name                  Barite
      -si                    0                         *
      -moles                 10                        *
      -delta                 0
      -initial_moles         0                         
      -force_equality        0
      -dissolve_only         0
      -precipitate_only      0
EXCHANGE_MODIFY       1                                
  -pitzer_exchange_gammas 1
  -component
    -formula               X
      -totals
        Na   1.0000000058717                           (*)
        X   1.0000000058717                            (*)
      -charge_balance        0
      -moles                 0
      -la                    3.0000000302372
      -phase_proportion      0
      -formula_z             0
      -formula_totals
        X   1
SURFACE_MODIFY       1 .
  -type 2
  -dl_type 0
  -sites_units 0
  -only_counter_ions 0
  -thickness 1e-008
  -debye_lengths 0
  -DDL_viscosity 1
  -DDL_limit 0.8
  -transport 0
  -component
    -formula               Hfo_s
      -formula_z             0
      -moles                 0
      -la                    -0.11486188676541
      -charge_balance        3.7853465372651e-005
      -phase_proportion      0
      -Dw                    0
      -formula_totals
        Hfo_s   0.01                                    
      -totals
        H   0.01003785346547                           (*)
        Hfo_s   0.010000000000097                      (*)
        O   0.010000000000097                          (*)
  -charge_component 
    -name                  Hfo
      -specific_area         600
      -grams                 1
      -charge_balance        3.7853465372651e-005      (*)
      -mass_water            0
      -la_psi                0.55146269389617
      -la_psi1               0
      -la_psi2               0
      -capacitance0          1
      -capacitance1          5
      -diffuse_layer_totals
SOLID_SOLUTIONS_MODIFY       1 
  -solid_solution
    -name                  Calcite
      -a0                    0
      -a1                    0
      -ag0                   0
      -ag1                   0
      -miscibility           0
      -xb1                   0.0
      -xb2                   0.0
      -component             
        calcite   0.1                                  *
        siderite   0.001                               *
GAS_PHASE_MODIFY       1 
  -type               0
  -total_p            1
  -volume             1
  -component
    CO2(g)   1.4305508698401e-005                      *
KINETICS_MODIFY      1 
  -step_divide       1
  -rk                1
  -bad_step_max      500
  -use_cvode         0
  -cvode_steps       100
  -cvode_order       5
  -component
    -rate_name             Calcite
      -tol                   1e-008
      -m                     0.9999999999991           *
      -m0                    1
      -moles                 8.9805940461929e-013
      -namecoef
        CaCO3   1
      -d_params
        1 1 1 1                                        *
  -totals         
    C   8.9801193858101e-013
    Ca   8.9801193858101e-013
    O   2.694035815743e-012
  -steps                 	
	
	--------
	svn 3719
	--------
	Added DELETE keyword to delete any numbered reactant, as
	listed in the example below. A list of single numbers and 
	number ranges are used to define the reactants to delete
	from PHREEQC memory. Lists may continue on subsequent 
	lines. Deletion occurs as the last step of simulation
	calculations, after all other calculations (initial 
	compositions, reactions, transport, inverse modeling) and
	COPYing have occurred. 

		
	DELETE
		-solution 2 	3
		-equilibrium_phases	2-3
		-exchange		2
			3
		-surface
			2-3
		-solid_solution
			2 3
		-gas_phase	2-3
		-kinetics	3 2
		-mix		2 
		-mix		3
		-reaction       2-3
		-temperature    
			2
			3
	--------
	svn 3704
	--------
	Added DUMP keyword. Writes complete data for solution,
	equilibrium_phases, exchange, surface, solid solution,
	gas phase, and kinetics classes. The format of the
	output is suitable for data input to the C++ version
	of PHREEQC. This feature allows the chemical state 
	of a simulation	to be saved and read back in as 
	initial conditions for subsequent model runs.
	
	Examples:
	DUMP
		-all
		-file    myfile.dmp
	END	
	DUMP
		-file	 myfile.dmp
		-append  true
		-solution	1-2 3
		-equi		3 1-2
		-exch		1 2 3
		-surf		1
				2
				3
	
		-s_s		1
				2-3
		-gas		1
		-gas		2
		-gas		3
		-kin		1-3
	END	
		
	Explanation:
	The first DUMP datablock will write the compositions at 
	the end of the simulation (after all simulation calculations,
	TRANSPORTs, SAVEs, and COPYs are complete) for 
	every solution,	equilibrium_phases, exchange, surface, 
	solid solution, gas phase, and kinetics entities that have
	been defined or produced in the run. This write includes
	internally saved entities (usually assigned negative numbers).
	
	The second DUMP data appends the compositions of items
	numbered 1-3 to myfile.dmp, if they exist. The second example
	shows multiple ways to define the entities to be dumped to
	file.

	------
	Begin
	------
	PHREEQC++ has classes that are equivalent to the PHREEQC C 
	structures. Each class has a method to "dump_raw" the 
	entire set of class data. The lines generated by dump_raw
	can be read as keyword data blocks in an input file. The following
	keywords are available in PHREEQC++: SOLUTION_RAW, 
	EQUILIBRIUM_PHASES_RAW, EXCHANGE_RAW, SURFACE_RAW, 
	SOLID_SOLUTIONS_RAW, GAS_PHASE_RAW, and KINETICS_RAW. 
	PHAST uses these classes and data blocks to dump the chemical
	state of a simulation and read it back in as a starting
	point for subsequent simulations. 
	
	Examples of raw output are given below. Some of the fields
	are required and some are not. 
	
	SOLUTION_RAW       1 
	  -temp              25
	  -pH                7
	  -pe                4
	  -mu                0.0010001035690258
	  -ah2o              0.99996599647757
	  -total_h           111.01243359981
	  -total_o           55.506216800086
	  -cb                -3.6579285790756e-010
	  -mass_water        1
	  -total_alkalinity  3.6579283856577e-010
	  -totals
	    Cl   0.0010000000000003
	    H(0)   1.4155655514601e-025
	    Na   0.0010000000000003
	  -activities
	    Cl   -3.0155266404974
	    E   -4
	    H(0)   -25.15
	    Na   -3.0153891985103
	    O(0)   -42.080029535586
	  -gammas
	  -Isotopes
	EQUILIBRIUM_PHASES_RAW       1 
	  -eltList       
	    Ba   1
	    O   4
	    S   1
	  -component
	    -name                  Barite
	    -si                    0
	    -moles                 10
	    -delta                 0
	    -initial_moles         0
	    -force_equality        0
	    -dissolve_only         0
	    -precipitate_only         0
	EXCHANGE_RAW       1 Exchange assemblage after simulation 3.
	  -pitzer_exchange_gammas 1
	  -component
	    -formula               X
	    -moles                 0
	    -la                    3.0000000302372
	    -charge_balance        0
	    -phase_proportion              0
	    -formula_z                     0
	    -totals
	      Na   1.0000000058717
	      X   1.0000000058717
	    -formula_totals
	      X   1
	SURFACE_RAW       1 Surface assemblage after simulation 4.
	  -type 2
	  -dl_type 0
	  -sites_units 0
	  -only_counter_ions 0
	  -thickness 1e-008
	  -debye_lengths 0
	  -DDL_viscosity 1
	  -DDL_limit 0.8
	  -transport 0
	  -component
	    -formula               Hfo_s
	    -formula_z             0
	    -moles                 0
	    -la                    -0.11486188676541
	    -charge_balance        3.7853465372651e-005
	    -phase_proportion      0
	    -Dw                    0
	    -formula_totals
	      Hfo_s   0.01
	    -totals
	      H   0.01003785346547
	      Hfo_s   0.010000000000097
	      O   0.010000000000097
	  -charge_component 
	    -name                  Hfo
	    -specific_area         600
	    -grams                 1
	    -charge_balance        3.7853465372651e-005
	    -mass_water            0
	    -la_psi                0.55146269389617
	    -la_psi1               0
	    -la_psi2               0
	    -capacitance0          1
	    -capacitance1          5
	    -diffuse_layer_totals
	SOLID_SOLUTIONS_RAW       1 
	  -solid_solution
	    -name                  Calcite
	    -a0                    0
	    -a1                    0
	    -ag0                   0
	    -ag1                   0
	    -miscibility           0
	    -xb1                   -6.2774385622042e+066
	    -xb2                   -6.2774385622042e+066
	    -component             
	      calcite   0.1
	      siderite   0.001
	GAS_PHASE_RAW       1 
	  -type               0
	  -total_p            1
	  -volume             1
	  -component
	    CO2(g)   1.4305508698401e-005
	KINETICS_RAW       1 
	  -step_divide       1
	  -rk                3
	  -bad_step_max      500
	  -use_cvode         0
	  -cvode_steps       100
	  -cvode_order       5
	  -component
	    -rate_name             Calcite
	    -tol                   1e-008
	    -m                     1
	    -m0                    1
	    -moles                 0
	    -namecoef
	      CaCO3   1
	    -d_params
	      1 1 1 1 
	  -totals         
	  -steps         
	    



