Index: /issm/trunk-jpl/src/c/main/issm_dakota.cpp
===================================================================
--- /issm/trunk-jpl/src/c/main/issm_dakota.cpp	(revision 19652)
+++ /issm/trunk-jpl/src/c/main/issm_dakota.cpp	(revision 19653)
@@ -21,28 +21,27 @@
 	bool parallel=true;
 	char* dakota_input_file=NULL;
+	char* dakota_output_file = NULL;
 
 	/*Define MPI_DEBUG in dakota_global_defs.cpp to cause a hold here*/
 	Dakota::mpi_debug_hold();
-	
+
 	/*Initialize MPI: */
 	ISSM_MPI_Init(&argc, &argv); // initialize MPI
-
+	
 	/*Recover file name for dakota input file:*/
 	dakota_input_file=xNew<char>((strlen(argv[2])+strlen(argv[3])+strlen(".qmu.in")+1));
-	sprintf(dakota_input_file,"%s%s%s",argv[2],argv[3],".qmu.in");
+	sprintf(dakota_input_file,"%s/%s%s",argv[2],argv[3],".qmu.in");
+	
+	dakota_output_file=xNew<char>((strlen(argv[2])+strlen(argv[3])+strlen(".qmu.out")+1));
+	sprintf(dakota_output_file,"%s/%s%s",argv[2],argv[3],".qmu.out");
 
-	Cout << "dakota_input_file: " << dakota_input_file << "\n";
-	
 	/* Parse input and construct Dakota LibraryEnvironment, performing input data checks*/
 	Dakota::ProgramOptions opts;
 	opts.input_file(dakota_input_file);
+	opts.output_file(dakota_output_file);
 
-	
 	/* Defaults constructs the MPIManager, which assumes COMM_WORLD*/
 	Dakota::LibraryEnvironment env(opts);
 
-	if (env.mpi_manager().world_rank() == 0)
-		Cout << "Library mode 1: run_dakota_parse()\n";
-	
 	/* get the list of all models matching the specified model, interface, driver:*/
 	Dakota::ModelList filt_models = env.filtered_model_list("single", "direct", "matlab");
@@ -73,5 +72,5 @@
 		// don't increment ref count since no other envelope shares this letter
 		model_interface.assign_rep(new
-				SIM::IssmParallelDirectApplicInterface(problem_db, analysis_comm,NULL), false);
+				SIM::IssmParallelDirectApplicInterface(problem_db, analysis_comm, argc, argv), false);
 	}
 	problem_db.set_db_model_nodes(model_index);            // restore
@@ -79,7 +78,4 @@
 	/* Execute the environment:*/
 	env.execute();
-
-	/*Finalize MPI:*/
-	ISSM_MPI_Finalize();
 
 	/*Return unix success: */
