private double [][][][] getResEntropyEmatricesPair(String matrixName, ParamSet sParams, int numRes, String strandDefault[][], MolParameters mp,
			String runName, double dist){
		
		String origPDB = (String)sParams.getValue("PDBNAME");
		
		//Check for the pairwise rot-to-rot file;
		String pairName = matrixName+"_pair.dat";
		
		double asasE[][][][] = readPairMatrixEntropy(pairName,numRes);
		if (asasE==null){ //compute the rot-to-template energy matrix
			
			//For each residue position i, get all residue positions that are within dist
			String asDistFile = matrixName+"_dist.dat";
			boolean as[][] = (boolean [][])readObject(asDistFile,false);
			if (as==null){
				as = new boolean[numRes][numRes];
				computeEntropyEmatrixMaster(numRes,runName+".log",asDistFile,sParams,false,false,false,null,
						null,null,true,dist,as,false, mp); //the distances are returned in as[][]
			}
			
			int numPairs = 0;
			asasE = new double[numRes][numRes][][];
			
			for (int i=0; i<numRes; i++){
					
				if (!strandDefault[mp.m.residue[i].strandNumber][mp.m.residue[i].strandResidueNumber].equalsIgnoreCase("PRO")){
					for (int j=i+1; j<numRes; j++){
						if (!strandDefault[mp.m.residue[j].strandNumber][mp.m.residue[j].strandResidueNumber].equalsIgnoreCase("PRO")){
							if (as[i][j]){
								asasE[i][j] = new double[1][];
								numPairs++;
							}
						}
					}
				}
			}
						
			computeEntropyEmatrixMaster(numRes,runName+".log",pairName,sParams,false,false,false,null,
					null,asasE,false,0.0f,null,false,mp);
			
			sParams.setValue("PDBNAME", origPDB);
			
			
			
			asasE = readPairMatrixEntropy(pairName,numRes);
		}		
		
		return asasE;
	}