Merge branch 'master' into dks

This commit is contained in:
suter_a 2016-04-11 12:23:31 +02:00
commit 7dc9158a09
14 changed files with 490 additions and 3 deletions

View File

@ -1330,6 +1330,7 @@ AC_CONFIG_FILES([Makefile \
src/external/libSpinValve/classes/Makefile \
src/external/libPhotoMeissner/Makefile \
src/external/libPhotoMeissner/classes/Makefile \
src/external/libGbGLF/Makefile \
src/external/libBNMR/Makefile \
src/musredit_qt5/Makefile \
src/musredit/Makefile \

View File

@ -1538,7 +1538,7 @@ void PRunSingleHisto::EstimateN0()
if (paramNo > 10000) // i.e. fun or map
return;
// still missing: set this value in the parameters
// get the parameters
PMsrParamList *param = fMsrInfo->GetMsrParamList();
assert(param);
@ -1547,6 +1547,11 @@ void PRunSingleHisto::EstimateN0()
return;
}
// check if N0 is fixed. If this is the case, do NOT estimate N0
if (param->at(paramNo-1).fStep == 0.0) // N0 parameter fixed
return;
// check that 'backgr.fit' in the msr-file run block is indeed a parameter number.
// in case it is a function, nothing will be done.
Int_t paramNoBkg = fRunInfo->GetBkgFitParamNo();

View File

@ -301,6 +301,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
cerr << endl << ">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->fLineNo;
cerr << endl;
fValid = false;
return;
} else { // user function valid, hence expand the fUserParam vector to the proper size
fUserParam.resize(fParamNo.size());
}

View File

@ -3,7 +3,8 @@ if BUILD_ASLIBS
ASDIRS = Nonlocal \
MagProximity \
libSpinValve \
libPhotoMeissner
libPhotoMeissner \
libGbGLF
endif
if BUILD_CUBALIB

56
src/external/libGbGLF/Makefile.am vendored Normal file
View File

@ -0,0 +1,56 @@
## Process this file with automake to create Makefile.in
h_sources = \
PGbGLF.h
h_linkdef = \
PGbGLFLinkDef.h
dict_h_sources = \
PGbGLFDict.h
cpp_sources = \
PGbGLF.cpp
dict_cpp_sources = \
PGbGLFDict.cpp
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
AM_CPPFLAGS = -I$(top_srcdir)/src/include $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) -I$(ROOTINCDIR)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^
lib_LTLIBRARIES = libGbGLF.la
libGbGLF_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
libGbGLF_la_LIBADD = $(USERFCN_LIBS)
libGbGLF_la_LDFLAGS = -version-info $(PLUGIN_LIBRARY_VERSION) -release $(PLUGIN_RELEASE) $(AM_LDFLAGS)
## For the moment do not build pkgconfig files for musrfit plug-ins...
## pkgconfigdir = $(libdir)/pkgconfig
## pkgconfig_DATA = LFRelaxation.pc
## However, create some symbolic links to the shared library
## in order to unify the function call on different operating systems
if IS_DARWIN
install-exec-hook:
$(LN_S) -f $(libdir)/libGbGLF.dylib $(libdir)/libGbGLF.so
uninstall-hook:
rm -f $(libdir)/libGbGLF.so
endif
if IS_CYGWIN
install-exec-hook:
$(LN_S) -f $(bindir)/cygGbGLF-$(PLUGIN_MAJOR_VERSION)-$(PLUGIN_MINOR_VERSION)-$(PLUGIN_MAJOR_VERSION).dll $(libdir)/libGbGLF.so
uninstall-hook:
rm -f $(libdir)/libGbGLF.so
endif

125
src/external/libGbGLF/PGbGLF.cpp vendored Normal file
View File

@ -0,0 +1,125 @@
/***************************************************************************
PGbGLF.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cassert>
#include <iostream>
#include <cmath>
using namespace std;
#include "PMusr.h"
#include "PGbGLF.h"
#define TWO_PI 6.28318530717958647692528676656
ClassImp(PGbGLF)
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time
* \param par
*/
Double_t PGbGLF::operator()(Double_t t, const std::vector<Double_t> &par) const
{
// param: [0] Bext (G), [1] Delta0 (1/us), [2] Rb (1)
assert(par.size()==3);
if (t<0.0)
return 1.0;
Double_t dval = 0.0;
Double_t wExt = TWO_PI * GAMMA_BAR_MUON * par[0];
Double_t s0 = par[1];
Double_t s1 = s0*par[2]; // sigma0 * Rb
Double_t wExt2 = wExt*wExt;
Double_t s02 = s0*s0;
Double_t s12 = s1*s1;
Double_t t2 = t*t;
if (par[0] < 3.0) { // take ZF solution for Bext <= 3G. This is good enough
Double_t aa = 1.0 + s12*t2;
dval = 0.333333333333333333 + 0.666666666666667 / pow(aa, 1.5)*(1.0-s02*t2/aa)*exp(-0.5*s02*t2/aa);
} else {
// P_z^LF (GbG, 1st part)
Double_t aa = 1.0+t2*s12;
dval = 1.0 - 2.0*(s02+s12)/wExt2 + 2.0*(s02+s12*aa)/(wExt2*pow(aa,2.5))*cos(wExt*t)*exp(-0.5*s02*t2/aa);
// P_z^LF (GbG, 2nd part)
Double_t dt = t;
Int_t n=1;
Double_t sumT = dt * pz_GbG_2(t, par) * 0.5;
Double_t sumM = 0.0;
Double_t tt = 0.0;
do {
sumM = 0.0;
for (Int_t i=0; i<n-1; i++) {
tt = ((Double_t)i + 0.5) * dt;
sumM += pz_GbG_2(tt, par);
}
sumM *= dt;
sumT = (sumT + sumM)*0.5;
dt /= 2.0;
n *= 2;
} while ((fabs(sumT-sumM) > 1.0e-5) && (n < 8192));
dval += sumT;
}
return dval;
}
//--------------------------------------------------------------------------
// pz_GbG_2 (private)
//--------------------------------------------------------------------------
/**
* <p>Integrand of the non-analytic part
*
* \param t time
*/
Double_t PGbGLF::pz_GbG_2(Double_t t, const std::vector<Double_t> &par) const
{
Double_t wExt = TWO_PI * GAMMA_BAR_MUON * par[0];
Double_t s0 = par[1];
Double_t s1 = s0*par[2]; // sigma0 * Rb
Double_t s02 = s0*s0;
Double_t s12 = s1*s1;
Double_t t2 = t*t;
Double_t aa = 1.0+t2*s12;
return 2.0*(s02*s02+3.0*s12*s12*aa*aa+6.0*s02*s12*aa)/(pow(wExt,3.0)*pow(aa,4.5))*exp(-0.5*s02*t2/aa)*sin(wExt*t);
}

60
src/external/libGbGLF/PGbGLF.h vendored Normal file
View File

@ -0,0 +1,60 @@
/***************************************************************************
PGbGLF.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PGBGLF_H_
#define _PGBGLF_H_
#include <vector>
using namespace std;
#include "PUserFcnBase.h"
//--------------------------------------------------------------------------------------------
/**
* <p>Interface class for the user function.
*/
class PGbGLF : public PUserFcnBase
{
public:
PGbGLF() {}
virtual ~PGbGLF() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) {}
virtual Bool_t GlobalPartIsValid() const { return true; }
virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const;
private:
Double_t pz_GbG_2(Double_t t, const std::vector<Double_t> &par) const;
ClassDef(PGbGLF, 1)
};
#endif // _PGBGLF_H_

40
src/external/libGbGLF/PGbGLFLinkDef.h vendored Normal file
View File

@ -0,0 +1,40 @@
/***************************************************************************
PGbGLFLinkDef.h
Author: Andreas Suter
***************************************************************************/
/***************************************************************************
* Copyright (C) 2016 by Andreas Suter *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
// root dictionary stuff --------------------------------------------------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class PGbGLF+;
#endif //__CINT__
// root dictionary stuff --------------------------------------------------

BIN
src/external/libGbGLF/doc/GbG-LF.pdf vendored Normal file

Binary file not shown.

184
src/external/libGbGLF/doc/GbG-LF.tex vendored Normal file
View File

@ -0,0 +1,184 @@
\documentclass[twoside]{article}
\usepackage[english]{babel}
%\usepackage{a4}
\usepackage{amssymb,amsmath,bm}
\usepackage{graphicx,tabularx}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{float}
\usepackage{hyperref}
\usepackage{xspace}
\usepackage{rotating}
\usepackage{dcolumn}
\usepackage{geometry}
\usepackage{color}
\geometry{a4paper,left=20mm,right=20mm,top=20mm,bottom=20mm}
% \setlength{\topmargin}{10mm}
% \setlength{\topmargin}{-13mm}
% % \setlength{\oddsidemargin}{0.5cm}
% % \setlength{\evensidemargin}{0cm}
% \setlength{\oddsidemargin}{1cm}
% \setlength{\evensidemargin}{1cm}
% \setlength{\textwidth}{15cm}
\setlength{\textheight}{23.8cm}
\pagestyle{fancyplain}
\addtolength{\headwidth}{0.6cm}
\fancyhead{}%
\fancyhead[RE,LO]{\bf \textsc{GapIntegrals}}%
\fancyhead[LE,RO]{\thepage}
\cfoot{--- A.~Suter -- \today~ ---}
\rfoot{\includegraphics[width=2cm]{PSI-Logo_narrow.jpg}}
\DeclareMathAlphabet{\bi}{OML}{cmm}{b}{it}
\newcommand{\mean}[1]{\langle #1 \rangle}
\newcommand{\ie}{\emph{i.e.}\xspace}
\newcommand{\musrfithead}{MUSRFIT\xspace}
\newcommand{\musrfit}{\textsc{musrfit}\xspace}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
% Header info --------------------------------------------------
\thispagestyle{empty}
\noindent
\begin{tabular}{@{\hspace{-0.2cm}}l@{\hspace{6cm}}r}
\noindent\includegraphics[width=3.4cm]{PSI-Logo_narrow.jpg} &
{\Huge\sf Memorandum}
\end{tabular}
%
\vskip 1cm
%
\begin{tabular}{@{\hspace{-0.5cm}}ll@{\hspace{4cm}}ll}
Date: & \today & & \\[3ex]
From: & A. Suter & & \\
E-Mail: & \verb?andreas.suter@psi.ch? &&
\end{tabular}
%
\vskip 0.3cm
\noindent\hrulefill
\vskip 1cm
%
\section*{Homogenous Disorder Model: GbG in Longitudinal Fields}%
Noakes and Kalvius \cite{noakes1997} derived a phenomenological model for
homogenous disorder: Gaussian-broadened Gaussian disorder (see also
Ref.\,\cite{yaouanc2011}). In both mentioned references only the zero field
case and the weak transverse field case are discussed. Here I briefly summarize
the longitudinal field (LF) case under the assumption that the applied field doesn't
polarize the impurties, \ie the applied field is ``innocent''.
The Gauss-Kubo-Toyabe LF polarization function is
\begin{eqnarray}\label{eq:GKT_LF}
P_{Z,{\rm GKT}}^{\rm LF} &=& 1 - 2 \frac{\sigma^2}{\omega_{\rm ext}^2}\left[ 1 - \cos(\omega_{\rm ext} t)\,\exp\left(-1/2 (\sigma t)^2\right) \right] + \label{eq:GKT_LF_1}\\
& & + 2 \frac{\sigma^2}{\omega_{\rm ext}^3} \int_0^t \sin(\omega_{\rm ext} \tau)\,\exp\left(-1/2 (\omega_{\rm ext} \tau)^2\right) d\tau. \label{eq:GKT_LF_2}
\end{eqnarray}
\noindent The Gaussian disorder is assumed to have the funtional form
\begin{equation}\label{eq:GaussianDisorder}
\varrho = \frac{1}{\sqrt{2\pi}}\,\frac{1}{\sigma_1} \exp\left( -\frac{1}{2} \, \left[ \frac{\sigma - \sigma_0}{\sigma_1} \right]^2 \right).
\end{equation}
\noindent In Ref.\cite{yaouanc2011} a slightly different notation is used: $\sigma \to \Delta_{\rm G}$, $\sigma_0 \to \Delta_{0}$, and
$\sigma_1 \to \Delta_{\rm GbG}$.
\noindent The GbG LF polarizatio function is given by
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} = \int_0^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF} \right\}.
\end{equation}
\noindent Assuming that $\sigma_0 \gg \sigma_1$ this can be approximated by
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} \simeq \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF} \right\}.
\end{equation}
\noindent Integrating
\begin{equation*}
P_{Z,{\rm GbG}}^{\rm LF, (1)} = \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF, (1)} \right\},
\end{equation*}
\noindent where $P_{Z,{\rm GKT}}^{\rm LF, (1)}$ is given by Eq.(\ref{eq:GKT_LF_1}), leads to
\begin{equation}\label{eq:GbG_LF_1}
P_{Z,{\rm GbG}}^{\rm LF, (1)} = 1 - 2 \frac{\sigma_0^2+\sigma_1^2}{\omega_{\rm ext}^2} +
2 \frac{\sigma_0^2 + \sigma_1^2 (1 + \sigma_1^2 t^2)}{\omega_{\rm ext}^2 (1 + \sigma_1^2 t^2)^{5/2}}\, \cos(\omega_{\rm ext} t)\,
\exp\left[-\frac{1}{2} \frac{\sigma_0^2 t^2}{1+\sigma_1^2 t^2}\right],
\end{equation}
\noindent and Eq.(\ref{eq:GKT_LF_2}) leads to the non-analytic integral
\begin{eqnarray}
P_{Z,{\rm GbG}}^{\rm LF, (2)} &=& \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF, (2)} \right\} \nonumber \\
&=& \int_0^t d\tau \left\{ \frac{\sigma_0^4 + 3 \sigma_1^4 (1 + \sigma_1^2 \tau^2)^2 + 6 \sigma_0^2 \sigma_1^2 (1+\sigma_1^2 \tau^2)}{\omega_{\rm ext}^3 (1+\sigma_1^2 \tau^2)^{9/2}}
\sin(\omega_{\rm ext} \tau)\, \exp\left[-\frac{1}{2} \frac{\sigma_0^2 t^2}{1+\sigma_1^2 t^2}\right] \right\}. \label{eq:GbG_LF_2}
\end{eqnarray}
\noindent The full GbG LF polarization function is hence
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} = P_{Z,{\rm GbG}}^{\rm LF, (1)} + P_{Z,{\rm GbG}}^{\rm LF, (2)}
\end{equation}
\subsection*{The GbG LF Polarization Function as a User Function in \musrfithead}
Eqs.(\ref{eq:GbG_LF_1})\&(\ref{eq:GbG_LF_2}) are implemented in \musrfit as user function. The current implementation is far from being efficient but stable.
The typical call from within the msr-file would be
\begin{verbatim}
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 PlusOne 1 0 none
2 MinusOne -1 0 none
3 Alpha 0.78699 -0.00036 0.00036 0 none
4 Asy 0.06682 0.00027 none 0 0.33
5 Sig0 0.3046 -0.0087 0.0093 0 100
6 Rb 1.0000 0.0027 none 0 1
7 Field0 0 0 none
8 Field1 20.03 0 none
9 Field2 99.32 0 none
###############################################################
THEORY
asymmetry fun1
userFcn libGbGLF PGbGLF map2 5 fun2 (field sigma0 Rb)
###############################################################
FUNCTIONS
fun1 = map1 * par4
fun2 = par5 * par6
\end{verbatim}
\noindent where \texttt{PGbGLF} takes 3 arguments:
\begin{enumerate}
\item field in Gauss
\item $\sigma_0$ in ($1/\mu s$)
\item $R_b = \sigma_1 / \sigma_0$
\end{enumerate}
\noindent \textbf{Be aware that we explicitly assumed $\sigma_1 \ll \sigma_0$, \ie $R_b < 1$.}
\bibliographystyle{plain}
\begin{thebibliography}{1}
\bibitem{noakes1997} D.~R.~Noakes, G.~M.~Kalvius, Phys.~Rev.~B, \textbf{56}, 2352
(1997).
\bibitem{yaouanc2011} A.~Yaouanc, P.~Dalmas~de~R\'{e}otier, ``Muon Spin
Rotation, Relaxation, and Resonance'', Oxford University Press (2011).
\end{thebibliography}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -2186,6 +2186,9 @@ void PTextEdit::musrView()
cmd = str + " \"";
str = *fFilenames.find( currentEditor() );
int pos = str.lastIndexOf("/");
if (pos != -1)
str.remove(0, pos+1);
QString numStr;
numStr.setNum(fAdmin->getTimeout());
cmd += str + "\" --timeout " + numStr;
@ -2194,6 +2197,10 @@ void PTextEdit::musrView()
cmd += " &";
int status=system(cmd.toLatin1());
if (status != 0) {
cerr << "**WARNING** musrView: something went wrong ..." << endl;
}
}
//----------------------------------------------------------------------------------------------------

View File

@ -2184,6 +2184,9 @@ void PTextEdit::musrView()
cmd = str + " \"";
str = *fFilenames.find( currentEditor() );
int pos = str.lastIndexOf("/");
if (pos != -1)
str.remove(0, pos+1);
QString numStr;
numStr.setNum(fAdmin->getTimeout());
cmd += str + "\" --timeout " + numStr;
@ -2192,6 +2195,10 @@ void PTextEdit::musrView()
cmd += " &";
int status=system(cmd.toLatin1());
if (status != 0) {
cerr << "**WARNING** musrView: something went wrong ..." << endl;
}
}
//----------------------------------------------------------------------------------------------------

View File

@ -7,5 +7,5 @@ set(DependOnLibs gslcblas)
add_executable(GbG_LF GbG_LF.cpp)
target_link_libraries(GbG_LF gslcblas gsl)
target_link_libraries(GbG_LF gsl gslcblas)