void ProcessMolfiles() {
	string fullfile = FOutputFilepath()+"MolfileInput.txt";
	ifstream Input;
	if (!OpenInput(Input,fullfile)) {
		return;	
	}
	ofstream Output;
	string outfile = FOutputFilepath()+"MolfileOutput.txt";
	if (OpenOutput(Output,outfile)) {
		Data* NewData = new Data(0);
		Output << "id\tmolfile\tgroups\tcharge\tformula\tstringcode\tmass\tdeltaG\tdeltaGerr" << endl;
		GetStringsFileline(Input,"\t",false);
		while(!Input.eof()) {
			vector<string>* strings = GetStringsFileline(Input,"\t",false);
			if (strings->size() >= 2) {
				Species* NewSpecies = new Species("", NewData, false);
				NewSpecies->ReadFromMol(FOutputFilepath()+"molfiles/"+(*strings)[1]);
				NewSpecies->PerformAllCalculations(true,true,true,true,true);
				string cues = NewSpecies->CreateStructuralCueList();
				findandreplace(cues,"\t","|");
				Output << (*strings)[0] << "\t" << (*strings)[1] << "\t" << cues << "\t" << NewSpecies->FCharge() << "\t" << NewSpecies->FFormula() << "\t";
				Output << NewSpecies->FCode() << "\t" << NewSpecies->FMW() << "\t" << NewSpecies->FEstDeltaG() << "\t" << NewSpecies->FEstDeltaGUncertainty() << endl;
				delete NewSpecies;
			}
			delete strings;
		}
		Output.close();
	}
	Input.close();
}
void CreateStringCode(string InputFilename, string OutputFilename) {
	Data* NewData = new Data(0);
	string TempFilename;
	Species* NewSpecies = new Species(TempFilename,NewData);
	
	if (InputFilename.length() > 3 && InputFilename.substr(InputFilename.length()-3,3).compare("mol") == 0) {
		NewSpecies->ReadFromMol(InputFilename);
	} else if (InputFilename.length() > 3 && InputFilename.substr(InputFilename.length()-3,3).compare("dat") == 0) {
		NewSpecies->ReadFromDat(InputFilename);
	} else {
		NewSpecies->ReadFromSmiles(InputFilename);
	}

	NewSpecies->MakeNeutral();
	NewSpecies->PerformAllCalculations(false,true,true,false,false);

	ofstream Output;
	if (!OpenOutput(Output,OutputFilename)) {
		return;
	}

	Output << NewSpecies->FCode();

	Output.close();
	delete NewData;
}
void ProcessMolfileDirectory(string Directory,string OutputDirectory) {
	vector<string> DirectoryList = GetDirectoryFileList(Directory);

	Data* NewData = new Data(0);
	for (int i=0; i < int(DirectoryList.size()); i++) {
		cout << DirectoryList[i] << endl;
		Species* NewSpecies = new Species("", NewData, false);
		if (DirectoryList[i].length() > 0) {
			NewSpecies->ReadFromMol(Directory+DirectoryList[i]);
			NewSpecies->LabelAtoms();
			string FileRoot = RemovePath(RemoveExtension(DirectoryList[i]));
			ofstream Output;
			if (OpenOutput(Output,OutputDirectory+FileRoot+".txt")) {
				Output << "Atom index;Group;GroupIndex" << endl;
				for (int j=0; j < NewSpecies->FNumAtoms(); j++) {
					Output << j << ";" << NewSpecies->GetAtom(j)->FGroupString() << ";" << NewSpecies->GetAtom(j)->FGroupIndex() << endl;
				}
				Output.close();
			}
		}
		delete NewSpecies;
	}
}