If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 76a3db4d authored by Tobias WEBER's avatar Tobias WEBER
parent 79725b00
*.o
*.moc
*.pyc
.~lock*
*~
.directory
*.kate-swp
ui/*.h
bin/*
!bin/.dir
externals/*
!externals/.dir
obj/*
!obj/.dir
plugins/*
!plugins/.dir
3rdparty/*
!3rdparty/.dir
perf.data
perf.data.old
gmon.out
Debug/*
Release/*
build/*
takin.app/*
.DS_*
.clang/*
.codelite/*
.settings/*
takin.txt
takin.mk
montereso.txt
montereso.mk
monteconvo.txt
monteconvo.mk
scanviewer.txt
scanviewer.mk
CMakeFiles/*
CMakeCache.txt
cmake_install.cmake
FindQwt.cmake
Makefile
tlibs-master.tar.bz2
tlibs/*
tlibs
takin-data-master.tar.bz2
takin-data/*
takin-data
tango-icon-theme*.tar.gz
tmp
tmp/*
res/data/*
res/doc/**
res/icons/*
!res/icons/brillouin.svg
!res/icons/ellipses.svg
!res/icons/goto.svg
!res/icons/q.svg
!res/icons/takin.svg
!res/.dir
!res/icons/.dir
!res/data/.dir
!res/doc/.dir
*.svg
*.xml
*.gz
*.htm
*.html
!doc/index_help.html
!doc/toc.html
!doc/takin.html
!doc/build.html
!doc/setup.html
!doc/basics.html
!doc/reso.html
!doc/convo.html
!doc/fit.html
!doc/reso-sqw.html
!doc/reso-sqw-native.html
!doc/reso-sqw-py.html
!doc/reso-sqw-jl.html
doc/devel/**
!doc/devel/.dir
!doc/.dir
takin.log
*.qch
*.qhc
Faddeeva.*
directory for 3rd party libraries
This diff is collapsed.
This diff is collapsed.
find_path(Clipper_INCLUDE_DIRS
NAMES clipper.h
PATH_SUFFIXES clipper
HINTS /usr/include/clipper /usr/local/include/clipper /opt/local/include/clipper
DOC "Clipper include directories"
)
find_library(Clipper_LIBRARIES
NAMES libclipper-core.so
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
DOC "Clipper library"
)
if(Clipper_LIBRARIES)
set(Clipper_FOUND 1)
message("Clipper include directories: ${Clipper_INCLUDE_DIRS}")
message("Clipper library: ${Clipper_LIBRARIES}")
else()
set(Clipper_FOUND 0)
set(Clipper_INCLUDE_DIRS "")
set(Clipper_LIBRARIES "")
message("Error: Clipper could not be found!")
endif()
find_library(Rt_LIBRARIES
NAMES librt.so
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
DOC "RT library"
)
if(Rt_LIBRARIES)
set(Rt_FOUND 1)
message("RT library: ${Rt_LIBRARIES}")
else()
set(Rt_FOUND 0)
message("Error: librt could not be found!")
endif()
find_library(Mp_LIBRARIES
NAMES libgomp.so libgomp.so.1
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
DOC "MP library"
)
if(Mp_LIBRARIES)
set(Mp_FOUND 1)
message("MP library: ${Mp_LIBRARIES}")
else()
set(Mp_FOUND 0)
message("Error: libgomp could not be found!")
endif()
Preparations before compilation
-------------------------------
Install (developer versions of) all required libraries either from your
system's package manager or directly from the given URLs:
* Boost: http://www.boost.org
* Qt 4: http://www.qt.io
* Qwt 6: http://qwt.sourceforge.net
* Clipper: http://www.ysbl.york.ac.uk/~cowtan/clipper/
* Minuit 2: http://seal.web.cern.ch/seal/snapshot/work-packages/mathlibs/minuit/release/download.html
For example, on *buntu systems, use the following commands:
* sudo su
* apt-get install cmake clang build-essential libboost-all-dev libclipper-dev libqt4-dev qt4-dev-tools libqwt-dev python-dev libfreetype6-dev wget
* wget http://www.cern.ch/mathlibs/sw/5_34_14/Minuit2/Minuit2-5.34.14.tar.gz
* tar -xzvf Minuit2-5.34.14.tar.gz
* cd Minuit2-5.34.14
* ./configure --disable-openmp
* make && make install
* exit
===============================================================================
Set up other external dependencies:
------------------------------
* cd to Takin dir
* ./setup_externals.sh
===============================================================================
Building Takin using the CMake path
-----------------------------------
Takin has to be compiled with a fully C++11 compliant compiler, e.g.:
* GCC version 4.8 or above
* Clang
Make using CMake:
* mkdir build
* cd build
* cmake ..
* make
* optional: make install (as root)
Run program with
* takin
* Or, in case tlibs is not found,
e.g.: LD_LIBRARY_PATH=/usr/local/lib takin
===============================================================================
Alternative building path
-------------------------
* Open "themakefile" in your favourite editor.
* Adapt the flags in the first few lines according to your system.
* Build Takin using "./build.sh"
* Run "./gentab" to create required tables
* Run Takin with "./takin".
===============================================================================
This diff is collapsed.
COPYING
\ No newline at end of file
This diff is collapsed.
References for formulas and algorithms, which are employed in this software.
============================================================================
-------------------------------------------------------------------------------
Neutrons
-------------------------------------------------------------------------------
* (Shirane 2002) G. Shirane et al., "Neutron Scattering with a Triple-Axis Spectrometer", 2002, ISBN: 978-0521411264.
* (Squires 2012) G. L. Squires, "Thermal Neutron Scattering", 2012, ISBN: 9781139107808.
-------------------------------------------------------------------------------
General Mathematics & Physics
-------------------------------------------------------------------------------
* (Arens 2015) T. Arens et al., "Mathematik", 2015, ISBN: 978-3-642-44919-2
* (Bronstein 2008) I. N. Bronstein et al., "Taschenbuch der Mathematik", 2008, ISBN: 978-3-8171-2017-8.
* (Merziger 2006), G. Merziger and T. Wirth, "Repetitorium der hoeheren Mathematik", 2006, ISBN: 3923923333.
* (Scarpino 2011), M. Scarpino, "OpenCL in Action", 2011, ISBN: 9781617290176.
* (Scherer 2010) P. O. J. Scherer, "Computational Physics", 2010, ISBN: 978-3-642-13989-5.
* (Schroeder 2000) D. V. Schroeder, "Thermal Physics", 2000, ISBN: 0-321-27779-1.
* (Stoecker 1999), H. Stoecker et al., "Taschenbuch mathematischer Formeln", 1999, ISBN: 3-8171-1573-3.
directory for binaries
#!/bin/bash
#
# invokes "themakefile" (alternate build path)
# @author Tobias Weber <tobias.weber@tum.de>
# @license GPLv2
#
MAKE=make
GCC=$(which gcc 2>/dev/null)
SKIP_PREBUILD=0
if [ "$GCC" != "" ] # don't check version if only e.g. clang is available
then
GCC_VER=$($GCC -dumpversion)
echo -e "GCC is version $GCC_VER"
GCC_VER=(${GCC_VER//./ })
fi
if [ ! -d tlibs ] || [ ! -f tlibs/AUTHORS ]
then
echo -e "Error: tlibs not installed. Use ./setup_tlibs.sh"
exit -1;
fi
if [ "$SKIP_PREBUILD" == "0" ]
then
echo -e "Prebuilding..."
if ! ./prebuild.sh
then
echo -e "Error: Prebuild failed";
exit -1;
fi
fi
NPROC=$(which nproc 2>/dev/null)
if [ "$NPROC" == "" ]; then NPROC="/usr/bin/nproc"; fi
if [ ! -x $NPROC ]
then
CPUCNT=2
else
CPUCNT=$($NPROC --ignore=1)
fi
echo -e "\nBuilding using $CPUCNT processes..."
${MAKE} -j${CPUCNT} -f themakefile
#!/bin/bash
#
# cleans temporary files
# @author Tobias Weber <tobias.weber@tum.de>
# @license GPLv2
#
echo -e "Cleaning stuff made by themakefile..."
make -f themakefile clean
if [ -f Makefile ]
then
echo -e "\nCleaning stuff made by Makefile..."
make clean
fi
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm -f doc/takin.qch
rm -f doc/takin.qhc
# restore link
#rm takin
#ln -sf bin/takin
This diff is collapsed.
/**
* About Dialog
* @author Tobias Weber <tobias.weber@tum.de>
* @date nov-2015
* @license GPLv2
*/
#ifndef __ABOUT_DLG_H__
#define __ABOUT_DLG_H__
#include <QDialog>
#include <QSettings>
#include "ui/ui_about.h"
class AboutDlg : public QDialog, Ui::AboutDlg
{ Q_OBJECT
protected:
QSettings *m_pSettings = 0;
virtual void accept() override;
public:
AboutDlg(QWidget* pParent=0, QSettings *pSett=0);
virtual ~AboutDlg() = default;
};
#endif
/**
* Atom Positions Dialog
* @author Tobias Weber <tobias.weber@tum.de>
* @date nov-2015
* @license GPLv2
*/
#include "AtomsDlg.h"
#include "tlibs/string/string.h"
#include "tlibs/math/linalg.h"
#include "libs/formfactors/formfact.h"
#include <QMessageBox>
using t_real = t_real_glob;
enum class AtInfo : int
{
NAME = 0,
POS_X = 1,
POS_Y = 2,
POS_Z = 3,
SPIN_X = 4,
SPIN_Y = 5,
SPIN_Z = 6
};
AtomsDlg::AtomsDlg(QWidget* pParent, QSettings *pSettings, bool bEnableSpin)
: QDialog(pParent), m_pSettings(pSettings), m_bEnableSpin(bEnableSpin)
{
setupUi(this);
if(m_pSettings)
{
QFont font;
if(m_pSettings->contains("main/font_gen") && font.fromString(m_pSettings->value("main/font_gen", "").toString()))
setFont(font);
}
if(m_bEnableSpin)
{
tableAtoms->setColumnCount(7);
tableAtoms->setHorizontalHeaderItem(static_cast<int>(AtInfo::SPIN_X), new QTableWidgetItem("Spin x"));
tableAtoms->setHorizontalHeaderItem(static_cast<int>(AtInfo::SPIN_Y), new QTableWidgetItem("Spin y"));
tableAtoms->setHorizontalHeaderItem(static_cast<int>(AtInfo::SPIN_Z), new QTableWidgetItem("Spin z"));
}
tableAtoms->setColumnWidth(int(AtInfo::NAME), 75);
btnAdd->setIcon(load_icon("res/icons/list-add.svg"));
btnDel->setIcon(load_icon("res/icons/list-remove.svg"));
QObject::connect(btnAdd, &QAbstractButton::clicked, this, &AtomsDlg::AddAtom);
QObject::connect(btnDel, &QAbstractButton::clicked, this, &AtomsDlg::RemoveAtom);
QObject::connect(buttonBox, &QDialogButtonBox::clicked, this, &AtomsDlg::ButtonBoxClicked);
QObject::connect(tableAtoms, &QTableWidget::cellChanged, this, &AtomsDlg::AtomCellChanged);
if(m_pSettings && m_pSettings->contains("atoms/geo"))
restoreGeometry(m_pSettings->value("atoms/geo").toByteArray());
}
AtomsDlg::~AtomsDlg()
{}
void AtomsDlg::RemoveAtom()
{
const bool bSort = tableAtoms->isSortingEnabled();
tableAtoms->setSortingEnabled(0);
bool bNothingRemoved = 1;
// remove selected rows
QList<QTableWidgetSelectionRange> lstSel = tableAtoms->selectedRanges();
for(QTableWidgetSelectionRange& range : lstSel)
{
//std::cout << range.bottomRow() << " " << range.topRow() << std::endl;
for(int iRow=range.bottomRow(); iRow>=range.topRow(); --iRow)
{
tableAtoms->removeRow(iRow);
bNothingRemoved = 0;
}
}
// remove last row if nothing is selected
if(bNothingRemoved)
tableAtoms->removeRow(tableAtoms->rowCount()-1);
tableAtoms->setSortingEnabled(bSort);
}
void AtomsDlg::AddAtom()
{
const bool bSort = tableAtoms->isSortingEnabled();
tableAtoms->setSortingEnabled(0);
int iRow = tableAtoms->rowCount();
tableAtoms->insertRow(iRow);
tableAtoms->setItem(iRow, 0, new QTableWidgetItem("H"));
for(unsigned int i=0; i<3; ++i)
tableAtoms->setItem(iRow, static_cast<int>(AtInfo::POS_X)+i, new QTableWidgetItem("0"));
if(m_bEnableSpin)
for(unsigned int i=0; i<3; ++i)
tableAtoms->setItem(iRow, static_cast<int>(AtInfo::SPIN_X)+i, new QTableWidgetItem("0"));
tableAtoms->setSortingEnabled(bSort);
CheckAtoms();
}
void AtomsDlg::SetAtoms(const std::vector<xtl::AtomPos<t_real>>& vecAtoms)
{
const bool bSort = tableAtoms->isSortingEnabled();
tableAtoms->setSortingEnabled(0);
tableAtoms->setRowCount(vecAtoms.size());
for(std::size_t iRow=0; iRow<vecAtoms.size(); ++iRow)
{
// add missing items
for(int iCol=0; iCol<tableAtoms->columnCount(); ++iCol)
if(!tableAtoms->item(iRow, iCol))
tableAtoms->setItem(iRow, iCol, new QTableWidgetItem(""));
const xtl::AtomPos<t_real>& atom = vecAtoms[iRow];
tableAtoms->item(iRow, 0)->setText(atom.strAtomName.c_str());
for(unsigned int i=0; i<3; ++i)
tableAtoms->item(iRow, static_cast<int>(AtInfo::POS_X)+i)->setText(tl::var_to_str(atom.vecPos[i]).c_str());
if(m_bEnableSpin)
for(unsigned int i=0; i<3; ++i)
tableAtoms->item(iRow, static_cast<int>(AtInfo::SPIN_X)+i)->setText(tl::var_to_str(atom.vecSpin[i]).c_str());
}
tableAtoms->setSortingEnabled(bSort);
CheckAtoms();
}
void AtomsDlg::AtomCellChanged(int iRow, int iCol)
{
if(iCol == static_cast<int>(AtInfo::NAME))
CheckAtoms();
}
/**
* checks if atom names are in the scattering lenth table
*/
void AtomsDlg::CheckAtoms()
{
std::shared_ptr<const xtl::ScatlenList<t_real>> lstff = xtl::ScatlenList<t_real>::GetInstance();
m_strErr = "";
//QColor colOk = qApp->palette().color(QPalette::Base);
QColor colOk{0x00, 0x88, 0x00};
QColor colFail{0xff, 0x00, 0x00};
std::string strAtomsNotFound;
for(int iRow=0; iRow<tableAtoms->rowCount(); ++iRow)
{
QTableWidgetItem* pItem = tableAtoms->item(iRow, static_cast<int>(AtInfo::NAME));
if(!pItem)
continue;
std::string strAtomName = pItem->text().toStdString();
tl::trim(strAtomName);
bool bFound = (lstff && lstff->Find(strAtomName) != nullptr);
if(!bFound)
{
if(strAtomsNotFound != "")
strAtomsNotFound += ", ";
strAtomsNotFound += strAtomName;
}
tableAtoms->item(iRow, static_cast<int>(AtInfo::NAME))->setBackground(bFound ? colOk : colFail);
}
if(strAtomsNotFound != "")
{
m_strErr = "The following atoms were not found in the scattering length database, "
"their contribution to the cross-section will be ignored: " + strAtomsNotFound + ".";
}
}
bool AtomsDlg::ShowPossibleErrorDlg()
{
if(m_strErr != "")
{
QMessageBox::critical(this, "Error", m_strErr.c_str());
return 0;
}
return 1;
}
void AtomsDlg::SendApplyAtoms()
{
std::vector<xtl::AtomPos<t_real>> vecAtoms;
vecAtoms.reserve(tableAtoms->rowCount());
for(int iRow=0; iRow<tableAtoms->rowCount(); ++iRow)
{
xtl::AtomPos<t_real> atom;
atom.strAtomName = tableAtoms->item(iRow, static_cast<int>(AtInfo::NAME))->text().toStdString();
tl::trim(atom.strAtomName);
t_real dX = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::POS_X))->text().toStdString());
t_real dY = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::POS_Y))->text().toStdString());
t_real dZ = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::POS_Z))->text().toStdString());
atom.vecPos = tl::make_vec({dX, dY, dZ});
if(m_bEnableSpin)
{
t_real dSx = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::SPIN_X))->text().toStdString());
t_real dSy = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::SPIN_Y))->text().toStdString());
t_real dSz = tl::str_to_var_parse<t_real>(tableAtoms->item(iRow, static_cast<int>(AtInfo::SPIN_Z))->text().toStdString());
atom.vecSpin = tl::make_vec({dSx, dSy, dSz});
}
vecAtoms.emplace_back(std::move(atom));
}
emit ApplyAtoms(vecAtoms);
}