import java.io.*;
public class gibbsSpecies
{
	int indicator=-1;
	Gas1 g1;
	double P0=1.0;//bar
	double T=298.2;
	double P=1;
	double mu0=0;
	Atom[] atomList;
	String Formula;
	public gibbsSpecies(String SpeciesName,String SpeciesPhase){		
		if(SpeciesPhase.equals("gas") || SpeciesPhase.equals("(g)") || SpeciesPhase.equals("g") ){					
				Gas1 g=new Gas1();				
				String[] b=g.readAllGasNames();		
				for(int i=0;i<b.length;i++){
					if(SpeciesName.equals(b[i])){						
						indicator=2;	
						g1=new Gas1(SpeciesName);
						atomList=g1.atomList;
						Formula=g1.gasName.toUpperCase();
					}
				}
		}
		else if(SpeciesPhase.equals("liquid") || SpeciesPhase.equals("(l)") || SpeciesPhase.equals("l") ){
			System.out.println("For the moment Liquid phase properties are not in use");
		}
		else if(SpeciesPhase.equals("solid") || SpeciesPhase.equals("(s)") || SpeciesPhase.equals("s") ){
			System.out.println("For the moment Solid phase properties are not in use");
		}
		else if(SpeciesPhase.equals("aqueous") || SpeciesPhase.equals("(aq)") || SpeciesPhase.equals("aq") ){
			System.out.println("For the moment Aqueous phase properties are not in use");
		}
		else System.out.println("finished");
		
	}
	public void setP0(double iP){
		P0=iP;
	}
	
	public double mu(double iT,double iP,double n,double nt){
		double mu=0;
		if(indicator==1 || indicator==2){			
			double value=0;						
			double lnP=Math.log(iP);
			value=Math.abs(n)<1e-15? 0 :Math.log(n/nt);
			mu=(g1.gt(iT)+8.3145*iT*value+8.3145*iT*lnP);
		}
		return mu;
			
	}
	public void getmu0(double iT,double iP){ 
		mu0=g1.gt(iT);
	}
	public double ht(double iT){
		return g1.ht(iT);	
	}
}