Index: /issm/trunk/src/m/classes/public/ClusterParameters.m
===================================================================
--- /issm/trunk/src/m/classes/public/ClusterParameters.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/ClusterParameters.m	(revision 3119)
@@ -1,3 +1,3 @@
-function [cluster_codepath cluster_executionpath]=ClusterParameters(cluster_name,cluster_rc_location)
+function [cluster_codepath cluster_executionpath cluster_login]=ClusterParameters(cluster_name,cluster_rc_location)
 %CLUSTERPARAMETERS - from cluster_name, find out cluster parameters in cluster.rc file
 %
@@ -6,7 +6,7 @@
 %
 %   Usage:
-%      [cluster_codepath cluster_executionpath]=ClusterParameters(cluster_name,cluster_rc_location)
+%      [cluster_codepath cluster_executionpath cluster_login ]=ClusterParameters(cluster_name,cluster_rc_location)
 
-lines_per_cluster=3;
+lines_per_cluster=4;
 
 %open cluster.rc file
@@ -49,5 +49,5 @@
 	if length(line)>12,
 		if strcmp(line(1:12),'cluster_name'),
-			%ok, the next 2 lines deal with one cluster settings.
+			%ok, the next 3 lines deal with one cluster settings.
 			%check if this is the cluster we are looking for.
 			splittedstring=strsplit(line,'=');
@@ -77,4 +77,14 @@
 				cluster_executionpath=value;
 
+				%Get next line for cluster loging name
+				line=fgetl(fid);
+				splittedstring=strsplit(line,'=');
+				descriptor=splittedstring{1};
+				value=splittedstring{2};
+				if ~strcmp(descriptor,'cluster_login'),
+					error('cluster settings in cluster.rc don''t follow the correct syntax');
+				end
+				cluster_login=value;
+
 			else
 				%Wrong cluster name, skip next lines_per_cluster lines and continue;
Index: /issm/trunk/src/m/classes/public/loadmultipleresultsfromcluster.m
===================================================================
--- /issm/trunk/src/m/classes/public/loadmultipleresultsfromcluster.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/loadmultipleresultsfromcluster.m	(revision 3119)
@@ -11,5 +11,5 @@
 name=md_list{1}.name;
 cluster_rc_location=which('cluster.rc');
-[codepath,executionpath]=ClusterParameters(cluster,cluster_rc_location);
+[codepath,executionpath,login]=ClusterParameters(cluster,cluster_rc_location);
 
 %Remote tar: 
Index: /issm/trunk/src/m/classes/public/loadresultsfromcluster.m
===================================================================
--- /issm/trunk/src/m/classes/public/loadresultsfromcluster.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/loadresultsfromcluster.m	(revision 3119)
@@ -9,5 +9,5 @@
 
 %Figure out parameters for this particular cluster
-[codepath,executionpath]=ClusterParameters(md.cluster,cluster_rc_location);
+[codepath,executionpath,login]=ClusterParameters(md.cluster,cluster_rc_location);
 
 %What packages are we picking up from remote cluster
Index: /issm/trunk/src/m/classes/public/peek.m
===================================================================
--- /issm/trunk/src/m/classes/public/peek.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/peek.m	(revision 3119)
@@ -11,5 +11,5 @@
 
 %Figure out parameters for this particular cluster
-[codepath,executionpath]=ClusterParameters(md.cluster,cluster_rc_location);
+[codepath,executionpath,login]=ClusterParameters(md.cluster,cluster_rc_location);
 
 %peek at the queued job
Index: /issm/trunk/src/m/classes/public/queue/BuildQueueingScriptpfe.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/BuildQueueingScriptpfe.m	(revision 3119)
+++ /issm/trunk/src/m/classes/public/queue/BuildQueueingScriptpfe.m	(revision 3119)
@@ -0,0 +1,59 @@
+function BuildQueueingScriptpfe(md,executionpath,codepath)
+%BUILDQUEUEINGSCRIPTPFE - ...
+%
+%   Usage:
+%      BuildQueueingScriptpfe(md,executionpath,codepath)
+
+scriptname=[md.name '.queue'];
+
+
+%check queue names: 
+if strcmpi(md.cluster,'pfe'),
+	available_queues={'long'};
+	if  ~ismemberi(md.queue,available_queues),
+		error('BuildQueueingScriptcosmos error message: availables queues are long');
+	end 
+end
+
+%test parameters valid for all queues
+if strcmpi(md.queue(1:4),'long'),
+	if md.np>2024,
+		error('BuildQueueingScriptcosmos error message: long queue only allows 2024 cpus');
+	end
+	if md.time>720,
+		error('BuildQueueingScriptcosmos error message: long queue only allows 720 minutes');
+	end
+	if mod(md.np,8),
+		error('BuildQueueingScriptcosmos error message: np should be a multiple of 8');
+	end
+
+end
+
+fid=fopen(scriptname,'w');
+if fid==-1,
+	error(['BuildQueueingScriptpfeerror message: could not open ' scriptname ' file for ascii writing']);
+end
+
+
+fprintf(fid,'#PBS -S /bin/bash\n');
+fprintf(fid,'#PBS -N %s\n',md.name);
+fprintf(fid,'#PBS -l select=%i:ncpus=8:mpiprocs=8\n',md.np/8);
+fprintf(fid,'#PBS -l walltime=%i\n',md.time*60); %walltime is in seconds.
+fprintf(fid,'#PBS -W group_list=s1010\n');
+fprintf(fid,'#PBS -m e\n');
+fprintf(fid,'#PBS -o %s.outlog \n',md.name);
+fprintf(fid,'#PBS -e %s.errlog \n\n',md.name);
+
+fprintf(fid,'. /usr/share/modules/init/bash\n\n');
+
+fprintf(fid,'module load comp/intel/10.1.021_64\n');
+fprintf(fid,'module load mpi/mpt.1.23.nas\n');
+fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n');
+
+fprintf(fid,'export PATH="$PATH:."\n\n');
+
+fprintf(fid,'cd $PBS_O_WORKDIR\n\n');
+
+fprintf(fid,'mpiexec -verbose -np %i %s/%s.exe $PBS_O_WORKDIR %s.bin %s.outbin %s.lock',md.np,codepath,AnalysisTypeFromEnum(md.analysis_type),md.name,md.name,md.name);
+
+fclose(fid);
Index: /issm/trunk/src/m/classes/public/queue/LaunchMultipleQueueJobgemini.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchMultipleQueueJobgemini.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchMultipleQueueJobgemini.m	(revision 3119)
@@ -20,3 +20,3 @@
 
 disp('launching solution sequence on remote cluster');
-issmssh(cluster,['"cd ' executionpath ' && source ' name '.queue "']);
+issmssh(cluster,login,['"cd ' executionpath ' && source ' name '.queue "']);
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJob.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJob.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJob.m	(revision 3119)
@@ -1,3 +1,3 @@
-function md=LaunchQueueJob(md,executionpath,options)
+function md=LaunchQueueJob(md,executionpath,options,login)
 %LAUNCHQUEUEJOB - ...
 %
@@ -15,7 +15,7 @@
 if exist(function_name,'file'),
 	%Call this function:
-	eval(['md=' function_name '(md,executionpath,options);']);
+	eval(['md=' function_name '(md,executionpath,options,login);']);
 else
 	%Call the generic LaunchQueueJob:
-	md=LaunchQueueJobGeneric(md,executionpath,options);
+	md=LaunchQueueJobGeneric(md,executionpath,options,login);
 end
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJobGeneric.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJobGeneric.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJobGeneric.m	(revision 3119)
@@ -1,3 +1,3 @@
-function md=LaunchQueueJobGeneric(md,executionpath,options)
+function md=LaunchQueueJobGeneric(md,executionpath,options,login)
 %LAUNCHQUEUEJOBGENERIC - Generic routine to launch queueing job
 %
@@ -26,5 +26,5 @@
 	
 	disp('launching solution sequence on remote cluster');
-	issmssh(md.cluster,['cd ' executionpath ' && source ' md.name '.queue ']);
+	issmssh(md.cluster,login,['cd ' executionpath ' && source ' md.name '.queue ']);
 
 else
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJobcosmos.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJobcosmos.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJobcosmos.m	(revision 3119)
@@ -1,3 +1,3 @@
-function md=LaunchQueueJobcosmos(md,executionpath,options)
+function md=LaunchQueueJobcosmos(md,executionpath,options,login)
 %LAUNCHQUEUEJOBCOSMOS- Launch queue script for Cosmos cluster
 %
@@ -24,5 +24,5 @@
 
 	disp('launching solution sequence on remote cluster');
-	issmssh(md.cluster,['"cd ' executionpath ' && qsub -S/bin/sh ' md.name '.queue "']);
+	issmssh(md.cluster,login,['"cd ' executionpath ' && qsub -S/bin/sh ' md.name '.queue "']);
 else
 	disp('batch mode requested: not launching job interactively');
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgemini.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgemini.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgemini.m	(revision 3119)
@@ -1,3 +1,3 @@
-function md=LaunchQueueJobgemini(md,executionpath,options)
+function md=LaunchQueueJobgemini(md,executionpath,options,login)
 %LAUNCHQUEUEJOBGEMINI - Launch queueing script on Gemini cluster
 %
@@ -24,5 +24,5 @@
 	
 	disp('launching solution sequence on remote cluster');
-	issmssh(md.cluster,['"cd ' executionpath ' && qsub ' md.name '.queue "']);
+	issmssh(md.cluster,login,['"cd ' executionpath ' && qsub ' md.name '.queue "']);
 else
 	disp('batch mode requested: not launching job interactively');
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgreenplanet.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgreenplanet.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJobgreenplanet.m	(revision 3119)
@@ -1,3 +1,3 @@
-function md=LaunchQueueJobgreenplanet(md,executionpath,options)
+function md=LaunchQueueJobgreenplanet(md,executionpath,options,login)
 %LAUNCHQUEUEJOBGEMINI - ...
 %
Index: /issm/trunk/src/m/classes/public/queue/LaunchQueueJobpfe.m
===================================================================
--- /issm/trunk/src/m/classes/public/queue/LaunchQueueJobpfe.m	(revision 3119)
+++ /issm/trunk/src/m/classes/public/queue/LaunchQueueJobpfe.m	(revision 3119)
@@ -0,0 +1,32 @@
+function md=LaunchQueueJobpfe(md,executionpath,options,login)
+%LAUNCHQUEUEJOBPFE - Launch queueing script on Gemini cluster
+%
+%   Usage:
+%      LaunchQueueJobpfe(md,executionpath)
+
+%first, check we have the binary file and the queueing script
+if ~exist([ md.name '.bin'],'file'),
+	error('LaunchQueueJobpfe error message: Binary input file missing, cannot go forward');
+end
+
+if ~exist([ md.name '.queue'],'file'),
+	error('LaunchQueueJobpfe error message: queueing script issing, cannot go forward');
+end
+
+%jpload both files to cluster
+if ~strcmpi(options.batch,'yes'),
+	disp('uploading input file,  queueing script and variables script');
+	if md.qmu_analysis, 
+		system(['scp ' md.name '.bin' ' ' md.name '.queue '  md.name '.qmu.in ' login '@' md.cluster ':' executionpath]);
+	else
+		system(['scp ' md.name '.bin' ' ' md.name '.queue '  login '@' md.cluster ':' executionpath]);
+	end
+	
+	disp('launching solution sequence on remote cluster');
+	issmssh(md.cluster,login,['"cd ' executionpath ' && qsub ' md.name '.queue "']);
+else
+	disp('batch mode requested: not launching job interactively');
+
+	%new pfe cannot launch across cluster using ssh
+	disp(['launch solution sequence on remote cluster by logging into it and typing qsub < ' md.name '.queue']);
+end
Index: /issm/trunk/src/m/classes/public/solveparallel.m
===================================================================
--- /issm/trunk/src/m/classes/public/solveparallel.m	(revision 3118)
+++ /issm/trunk/src/m/classes/public/solveparallel.m	(revision 3119)
@@ -10,5 +10,5 @@
 
 %Figure out parameters for this particular cluster
-[codepath,executionpath]=ClusterParameters(md.cluster,cluster_rc_location);
+[codepath,executionpath,login]=ClusterParameters(md.cluster,cluster_rc_location);
 
 %Append name of directory if specified in options: 
@@ -27,5 +27,5 @@
 
 %Now, launch the queueing script
-md=LaunchQueueJob(md,executionpath,options);
+md=LaunchQueueJob(md,executionpath,options,login);
 
 %Do we return, or just wait for results?
