Skip to content

Commit

Permalink
Merge branch 'master' into 'release'
Browse files Browse the repository at this point in the history
Release of version 0.7.0

See merge request luechow-group/inPsights!9
  • Loading branch information
heueristik committed Jan 20, 2022
2 parents 3000fa9 + ae9e06a commit bdc1f91
Show file tree
Hide file tree
Showing 27 changed files with 539 additions and 561 deletions.
2 changes: 0 additions & 2 deletions src/GUI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ set(HEADER_FILES
include/Bonds3D.h
include/SpinCorrelations3D.h
include/IntegerSortedTreeWidgetItem.h
include/MaximaProcessingWidget.h
include/SurfaceMesh.h
include/Surface.h
include/Arrow.h
Expand All @@ -72,7 +71,6 @@ set(SOURCE_FILES
source/SpinCorrelations3D.cpp
source/InPsightsWidget.cpp
source/IntegerSortedTreeWidgetItem.cpp
source/MaximaProcessingWidget.cpp
source/SurfaceMesh.cpp
source/Surface.cpp
source/Arrow.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/include/Bonds3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Bonds3D : public IConnection {
public:
explicit Bonds3D(AtomsVector3D *atomsVector3D, double bondDrawingLimit = 1.40 * 1e-10 / AU::length);
explicit Bonds3D(AtomsVector3D *atomsVector3D, double bondDrawingLimit = 0.5);

private:
double bondDrawingLimit_;
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/include/CartesianAxes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class CartesianAxes : public Abstract3dObject{
public:
CartesianAxes(Qt3DCore::QEntity *root, QVector3D origin = {0,0,0},
float length = 1.0f,
float baseRadius = 0.025f,
float alpha = 0.25f);
float length = 5.0f,
float baseRadius = 0.01f,
float alpha = 0.75f);

private:
Arrow *x_, *y_, *z_;
Expand Down
18 changes: 12 additions & 6 deletions src/GUI/include/InPsightsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define INPSIGHTS_INPSIGHTSWIDGET_H

#include <MoleculeWidget.h>
#include <MaximaProcessingWidget.h>

#include <QCheckBox>
#include <QDoubleSpinBox>
Expand All @@ -19,6 +18,7 @@ Q_OBJECT
explicit InPsightsWidget(QWidget *parent = nullptr, const std::string &filename = "");
bool plotAllActiveQ();
std::string filenameWithoutExtension();
std::vector<ClusterData> clusterCollection_;

public slots:
void selectedStructure(QTreeWidgetItem *item, int column);
Expand All @@ -28,20 +28,26 @@ public slots:
void onSpinCorrelationsChecked(int stateId= 0);
void onPlotAllChecked(int stateId= 0);
void onSpinCorrelationsBoxChanged(double value);
void onSedsExport(bool);
void onElectron1BoxChanged(int value);
void onElectron2BoxChanged(int value);
void onAtom1BoxChanged(int value);
void onAtom2BoxChanged(int value);
void onDeselectAll(bool);
void onSedChecked(int stateId);
void onSedBoxChanged(double value);
void onBondBoxChanged(double value);
void updateSelectedStructures(int);

private:
std::string filename_;
MoleculeWidget *moleculeWidget;
MaximaProcessingWidget *maximaProcessingWidget;
QCheckBox *atomsCheckBox, *bondsCheckBox, *axesCheckBox, *sampleAverageCheckBox, *spinCorrelationsCheckBox,
*sedsCheckBox,*maximaHullsCheckBox, *plotAllCheckBox, *coloredCheckBox;
QDoubleSpinBox *spinCorrelationBox, *sedPercentageBox;
QPushButton *sedsExportButton, *deselectAllButton;
QDoubleSpinBox *spinCorrelationBox, *sedPercentageBox, *bondBox;
QSpinBox *atom1Box, *atom2Box, *electron1Box, *electron2Box;
QPushButton *deselectAllButton;
QTreeWidget *maximaList;
QLabel *probabilitySum;
std::vector<ClusterData> clusterCollection_;

void showSplashScreen();
void loadData();
Expand Down
61 changes: 0 additions & 61 deletions src/GUI/include/MaximaProcessingWidget.h

This file was deleted.

24 changes: 14 additions & 10 deletions src/GUI/include/MoleculeWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class MoleculeWidget : public QWidget{

void drawAxes(bool drawQ = true);
void drawAtoms(bool drawQ = true);
void drawBonds(bool drawQ = true);
void drawSpinCorrelations(bool drawQ,
const std::vector<ClusterData> &clusterData,
void drawBonds(bool drawQ = true, double limit = 0.5);
void drawSpinCorrelations(const std::vector<ClusterData> &clusterData,
double spinCorrelationThreshold, bool drawSameSpinCorrelationsQ);
void deleteSpinCorrelations();

void initialCameraSetup(int zoom, int pan, int tilt, int roll);
void setupCameraBoxes(int pan, int tilt, int roll, int zoom);
Expand All @@ -53,25 +53,29 @@ class MoleculeWidget : public QWidget{
void addMaximaHulls(int clusterId, const std::vector<ClusterData> &clusterData);
void removeMaximaHulls(int clusterId);

int getAtomsNumber();

public slots:
void activateCompatabilityMode();
void onAtomsChecked(std::vector<int>);
void onElectronsChecked(std::vector<int>);
void onAtomsHighlighted(std::vector<int>);
void onElectronsHighlighted(std::vector<int>);
void activateCompatibilityMode();
void onAtomsChecked(int);
void onElectronsChecked(int);
void onAtomsHighlighted(int);
void onElectronsHighlighted(int);

void onCameraBoxesChanged(int);
void onScreenshot(bool);
void onX3dExport(bool);
void onResetCamera(bool);
void onSedsExport(bool);

private:
bool compatabilityMode_;
bool compatibilityMode_;
Qt3DExtras::Qt3DWindow *qt3DWindow_;
Qt3DCore::QEntity *root_, *moleculeEntity_;
Qt3DExtras::QOrbitCameraController *cameraController_;
QPushButton *screenshotButton_, *x3dExportButton_, *resetCameraButton_;
QPushButton *screenshotButton_, *x3dExportButton_, *resetCameraButton_, *sedsExportButton_;
QSpinBox *pan_, *tilt_, *roll_, *zoom_;
Qt3DRender::QDirectionalLight *light_;
int initPan_, initTilt_, initRoll_,initZoom_;
float defaultCameraRadius_;
public:
Expand Down
19 changes: 10 additions & 9 deletions src/GUI/include/Particle3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,27 @@ class Particle3D : public Particle<Type>, public Sphere {
GuiHelper::QColorFromType<Type>(this->type()),
GuiHelper::toQVector3D(this->position()),
GuiHelper::radiusFromType<Type>(this->type()),
1.0, 12, 24
1.0, 48, 96
) {
if(std::is_same<Type,Element>())
material->setAlpha(0.33f);
else if (std::is_same<Type,Spin>())
material->setAlpha(0.5f);
else if (std::is_same<Type,Spin>())
material->setAlpha(0.75f);
}

// colored constructor
Particle3D(Qt3DCore::QEntity *root, const Particle<Type>& particle, const QColor& color)
// colored constructor with optional arguments
Particle3D(Qt3DCore::QEntity *root, const Particle<Type>& particle, const QColor& color,
const float& radiusFactor = 1.0f, const int& rings=48, const int& slices=96, const float& elecAlpha=0.75f)
: Particle<Type>::Particle(particle),
Sphere(root, color,
GuiHelper::toQVector3D(this->position()),
GuiHelper::radiusFromType<Type>(this->type())/3.0,
1.0, 2, 4
GuiHelper::radiusFromType<Type>(this->type())*radiusFactor,
1.0, rings, slices
) {
if(std::is_same<Type,Element>())
material->setAlpha(0.33);
material->setAlpha(0.5f);
else if (std::is_same<Type,Spin>())
material->setAlpha(1.0f);
material->setAlpha(elecAlpha);
}


Expand Down
25 changes: 20 additions & 5 deletions src/GUI/include/ParticlesVector3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <ParticlesVector.h>
#include "Particle3D.h"
#include "ColorPalette.h"
#include <Metrics.h>

template <typename Type>
class ParticlesVector3D : public ParticlesVector<Type>, public Qt3DCore::QEntity {
Expand All @@ -27,16 +28,30 @@ public slots:
if(drawQ && particles3D_.empty())
for(long i = 0; i < ParticlesVector<Type>::numberOfEntities(); ++i)
if(coloredQ_) {
particles3D_.emplace_back(new Particle3D<Type>(this, this->operator[](i), ColorPalette::colorFunction(i)));
particles3D_.emplace_back(new Particle3D<Type>(this, this->operator[](i),
ColorPalette::colorFunction(i), 1.0f/3.0f, 2, 4, 1.0));
} else {
particles3D_.emplace_back(new Particle3D<Type>(this, this->operator[](i)));
bool violet = false;
for(long j = 0; j < ParticlesVector<Type>::numberOfEntities(); ++j)
if (j != i){
if (Metrics::distance(this->operator[](i).position(), this->operator[](j).position()) < 0.01){
violet = true;
break;
}
}
if (not violet) {
particles3D_.emplace_back(new Particle3D<Type>(this, this->operator[](i)));
}
else {
particles3D_.emplace_back(new Particle3D<Type>(this, this->operator[](i), Qt::darkMagenta));
}
}
else
for(auto it = particles3D_.begin(); it != particles3D_.end(); it++)
particles3D_.erase(it);
};

void drawConnections() {};
void drawConnections(const double &limit) {};

void deleteConnections(){
connections_->deleteLater();
Expand All @@ -57,9 +72,9 @@ using AtomsVector3D = ParticlesVector3D<Element>;
using ElectronsVector3D = ParticlesVector3D<Spin>;

template<>
void AtomsVector3D::drawConnections();
void AtomsVector3D::drawConnections(const double &limit);
template<>
void ElectronsVector3D::drawConnections();
void ElectronsVector3D::drawConnections(const double &limit);


#endif //INPSIGHTS_PARTICLESVECTOR3D_H
4 changes: 2 additions & 2 deletions src/GUI/include/SpinCorrelations3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class SpinCorrelations3D : public IConnection {
const TriangularMatrixStatistics& SeeStats,
double spinCorrelationThreshold,
bool drawSameSpinCorrelationsQ = false,
bool compatabilityMode = false);
bool compatibilityMode = false);

void createConnections(const ElectronsVector &electronsVector,
const TriangularMatrixStatistics &SeeStats,
double spinCorrelationThreshold,
bool drawSameSpinCorrelationsQ);
private:
bool compatabilityMode_;
bool compatibilityMode_;
};

#endif //INPSIGHTS_SPINCORRELATIONS3D_H
6 changes: 3 additions & 3 deletions src/GUI/include/X3domConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

class X3domConverter{
public:
X3domConverter(const std::string &filename);
explicit X3domConverter(const std::string &filename);

X3domConverter(const std::string &filename,
const std::string& title,
const std::string& comment);
const QVector3D& lightDirection);

void startScene(const std::string& title, const std::string& comment);
void startScene(const std::string& title, const QVector3D& lightDirection);

void addSphere(const Sphere & sphere, unsigned sortKey = 1);
void addCylinder(const Cylinder & cylinder, unsigned sortKey = 1);
Expand Down
5 changes: 3 additions & 2 deletions src/GUI/source/Bonds3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ void Bonds3D::createBonds(AtomsVector3D *atomsVector3D) {
auto atomDistance = Metrics::distance(
atomsVector3D->operator[](i).position(),
atomsVector3D->operator[](j).position());
auto addedGuiRadii = (GuiHelper::radiusFromType(atomsVector3D->operator[](i).type())
// GuiHelper::radiusFromType returns vdWRadius/10 and is thus taken times 10 in order to recover vdW radius
auto addedGuiRadii = 10*(GuiHelper::radiusFromType(atomsVector3D->operator[](i).type())
+ GuiHelper::radiusFromType(atomsVector3D->operator[](j).type()));

if (atomDistance - 0.5*addedGuiRadii < bondDrawingLimit_)
if (atomDistance/addedGuiRadii < bondDrawingLimit_)
new Bond3D(this, *atomsVector3D->particles3D_[i], *atomsVector3D->particles3D_[j]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/source/CartesianAxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CartesianAxes::CartesianAxes(Qt3DCore::QEntity *root, QVector3D origin, float length, float baseRadius, float alpha)
:
Abstract3dObject(root, QColor(), origin),
x_(new Arrow(this, Qt::red, {origin - QVector3D(length/2, 0, 0), origin + QVector3D(length/2, 0, 0)}, baseRadius, 0.1f, 2.0f, alpha)),
y_(new Arrow(this, Qt::green,{origin - QVector3D(0, length/2, 0), origin + QVector3D(0, length/2, 0)}, baseRadius, 0.1f, 2.0f, alpha)),
z_(new Arrow(this, Qt::blue, {origin - QVector3D(0, 0, length/2), origin + QVector3D(0, 0, length/2)}, baseRadius, 0.1f, 2.0f, alpha))
x_(new Arrow(this, Qt::red, {origin - QVector3D(length/2, 0, 0), origin + QVector3D(length/2, 0, 0)}, baseRadius, 0.05f, 4.0f, alpha)),
y_(new Arrow(this, Qt::green,{origin - QVector3D(0, length/2, 0), origin + QVector3D(0, length/2, 0)}, baseRadius, 0.05f, 4.0f, alpha)),
z_(new Arrow(this, Qt::blue, {origin - QVector3D(0, 0, length/2), origin + QVector3D(0, 0, length/2)}, baseRadius, 0.05f, 4.0f, alpha))
{}
12 changes: 9 additions & 3 deletions src/GUI/source/GuiHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ std::pair<QVector3D, QVector3D> GuiHelper::sphericalSurfacePositionPair(

Eigen::Vector3d v12 = position2-position1;
float distance = v12.norm();
Eigen::Vector3d p1 = position1 + v12 * radius1 / distance;
Eigen::Vector3d p2 = position2 - v12 * radius2 / distance;

Eigen::Vector3d p1, p2;
if (distance > radius1 + radius2) {
p1 = position1 + v12 * radius1 / distance;
p2 = position2 - v12 * radius2 / distance;
}
else {
p1 = position1 + 0.5*v12;
p2 = p1;
}
return {GuiHelper::toQVector3D(p1), GuiHelper::toQVector3D(p2)};
}
Loading

0 comments on commit bdc1f91

Please sign in to comment.