+ map<string, ofstream*> filehandles;
+ map<string, ofstream*>::iterator it3;
+
+ //set fileroot
+ map<string, string> variables;
+ variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(listfile));
+ variables["[distance]"] = thisList->getLabel();
+
+ //fill filehandles with neccessary ofstreams
+ ofstream* temp;
+ vector<string> gGroups;
+ if (groupfile != "") { gGroups = groupMap->getNamesOfGroups(); }
+ else { gGroups = ct.getNamesOfGroups(); }
+
+ for (int i=0; i<gGroups.size(); i++) {
+ temp = new ofstream;
+ filehandles[gGroups[i]] = temp;
+
+ variables["[group]"] = gGroups[i];
+ string filename = getOutputFileName("list",variables);
+ m->openOutputFile(filename, *temp);
+ outputNames.push_back(filename); outputTypes["list"].push_back(filename);
+ }
+