Ejemplo n.º 1
0
bool observeOneFullSweep(
	IoInputType& io,
	const GeometryType& geometry,
	const ModelType& model,
	const PsimagLite::String& obsOptions,
	bool hasTimeEvolution)
{
	bool verbose = false;
	typedef typename SparseMatrixType::value_type FieldType;
	typedef Observer<FieldType,VectorWithOffsetType,ModelType,IoInputType> 
		ObserverType;
	typedef ObservableLibrary<ObserverType,TargettingType> ObservableLibraryType;
	SizeType n  = geometry.numberOfSites();
	//PsimagLite::String sSweeps = "sweeps=";
	//PsimagLite::String::SizeTypeype begin = obsOptions.find(sSweeps);
	//if (begin != PsimagLite::String::npos) {
	//	PsimagLite::String sTmp = obsOptions.substr(begin+sSweeps.length(),PsimagLite::String::npos);
		//std::cout<<"sTmp="<<sTmp<<"\n";
	//	n = atoi(sTmp.c_str());
	//}
	ObservableLibraryType observerLib(io,n,hasTimeEvolution,model,verbose);
	
	bool ot = false;
	if (obsOptions.find("ot")!=PsimagLite::String::npos || obsOptions.find("time")!=PsimagLite::String::npos) ot = true;
	if (hasTimeEvolution && ot) {
		observerLib.measureTime("superDensity");
		observerLib.measureTime("nupNdown");
		observerLib.measureTime("nup+ndown");
		if (obsOptions.find("sz")!=PsimagLite::String::npos) observerLib.measureTime("sz");
	}

	if (hasTimeEvolution) observerLib.setBrackets("time","time");

	const PsimagLite::String& modelName = model.params().model;
	SizeType rows = n; // could be n/2 if there's enough symmetry

	// Immm supports only onepoint:
	if (modelName=="Immm" && obsOptions!="onepoint") {
		PsimagLite::String str(__FILE__);
		str += " "  + ttos(__LINE__) + "\n";
		str += "Model Immm only supports onepoint\n";
		throw PsimagLite::RuntimeError(str.c_str());
	}

	SizeType numberOfDofs = dofsFromModelName(model);

	if (!hasTimeEvolution && obsOptions.find("onepoint")!=PsimagLite::String::npos) {
		observerLib.measureTheOnePoints(numberOfDofs);
	}

	if (modelName.find("Heisenberg")==PsimagLite::String::npos) {
		if (obsOptions.find("cc")!=PsimagLite::String::npos) {
			observerLib.measure("cc",rows,n);
		}

		if (obsOptions.find("nn")!=PsimagLite::String::npos) {
			observerLib.measure("nn",rows,n);
		}
	}
	if (obsOptions.find("szsz")!=PsimagLite::String::npos) {
		observerLib.measure("szsz",rows,n);
	}

	if (modelName.find("FeAsBasedSc")!=PsimagLite::String::npos ||
	    modelName.find("FeAsBasedScExtended")!=PsimagLite::String::npos ||
	    modelName.find("HubbardOneBand")!=PsimagLite::String::npos) {
		bool dd4 = (obsOptions.find("dd4")!=PsimagLite::String::npos);

		if (obsOptions.find("dd")!=PsimagLite::String::npos && !dd4) { // &&
			//geometry.label(0).find("ladder")!=PsimagLite::String::npos) {
			observerLib.measure("dd",rows,n);
		}

		// FOUR-POINT DELTA-DELTA^DAGGER:
		if (dd4 && geometry.label(0).find("ladder")!=PsimagLite::String::npos) {
			observerLib.measure("dd4",rows,n);
		} // if dd4
	}

	if (modelName.find("HubbardOneBand")!=PsimagLite::String::npos &&
	    obsOptions.find("multi")!=PsimagLite::String::npos) {
		observerLib.measure("multi",rows,n);
	}

	if (obsOptions.find("s+s-")!=PsimagLite::String::npos) {
		observerLib.measure("s+s-",rows,n);
	}

	if (obsOptions.find("ss")!=PsimagLite::String::npos) {
		observerLib.measure("ss",rows,n);
	}

	return observerLib.endOfData();
}
Ejemplo n.º 2
0
bool observeOneFullSweep(IoInputType& io,
                         const ModelType& model,
                         const PsimagLite::String& list,
                         bool hasTimeEvolution,
                         SizeType orbitals)
{
	typedef typename ModelType::GeometryType GeometryType;
	typedef Observer<VectorWithOffsetType,ModelType,IoInputType> ObserverType;
	typedef ObservableLibrary<ObserverType> ObservableLibraryType;

	const GeometryType& geometry = model.geometry();
	bool verbose = false;
	SizeType n  = geometry.numberOfSites();
	SizeType rows = n; // could be n/2 if there's enough symmetry
	SizeType cols = n;
	SizeType nf = n - 2;
	SizeType trail = 0;

	PsimagLite::Vector<PsimagLite::String>::Type vecOptions;
	PsimagLite::tokenizer(list,vecOptions,",");
	bool hasTrail = false;

	for (SizeType i = 0; i < vecOptions.size(); ++i) {
		PsimagLite::String item = vecOptions[i];

		PsimagLite::String label = "%nf=";
		std::size_t labelIndex = item.find(label);
		if (labelIndex == 0) {
			nf = atoi(item.substr(label.length()).c_str());
			rows = nf;
			cols = nf;
			std::cerr<<"observe: Found "<<label<<" = "<<nf;
			std::cerr<<" (rows and cols also set to it)\n";
		}

		label = "%trail=";
		labelIndex = item.find(label);
		if (labelIndex == 0) {
			trail = atoi(item.substr(label.length()).c_str());
			std::cerr<<"observe: Found "<<label<<" = "<<trail<<"\n";
			hasTrail = true;
		}

		label = "%rows=";
		labelIndex = item.find(label);
		if (labelIndex == 0) {
			std::cerr<<"observe: Found %rows= with index "<<labelIndex<<"\n";
			rows = atoi(item.substr(label.length()).c_str());
		}

		label = "%cols=";
		labelIndex = item.find(label);
		if (labelIndex == 0) {
			std::cerr<<"observe: Found %cols= with index "<<labelIndex<<"\n";
			cols = atoi(item.substr(label.length()).c_str());
		}
	}

	if (!hasTrail)
		trail = n - 2 - nf;

	ObservableLibraryType observerLib(io,
	                                  n,
	                                  hasTimeEvolution,
	                                  model,
	                                  nf,
	                                  trail,
	                                  verbose);

	for (SizeType i = 0; i < vecOptions.size(); ++i) {
		PsimagLite::String item = vecOptions[i];

		if (item.find("%") == 0) continue;

		if (item.length() > 0 && item[0] != '<')
			observerLib.measureTriage(item,rows,cols,orbitals,hasTimeEvolution);
		else
			observerLib.interpret(item,rows,cols);
	}

	return observerLib.endOfData();
}