Skip to content

Commit

Permalink
Patch 0.2.3 (#10)
Browse files Browse the repository at this point in the history
* Fixing menu items w.r.t. issue #4

* Fixing issue #8

* Initial commit CLI

* Implementing NEB analysis via CLI

* Updating README.md

* Creating patch file for Qt5

* Fixing compilation instructions

* Fixing compilation instructions

* Fixing bug in info widget
  • Loading branch information
ifilot committed Sep 12, 2024
1 parent 6c1f5ed commit ce9149e
Show file tree
Hide file tree
Showing 22 changed files with 317 additions and 106 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: linux

on:
push:
branches: [ "master", "develop" ]
pull_request:
branches: [ "master", "develop" ]

jobs:
#
# Ubuntu
#
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt update && sudo apt install -y qt6-tools-dev qt6-base-dev libqt6charts6-dev libqt6widgets6 libqt6gui6 libqt6opengl6-dev libgl1-mesa-dev build-essential cmake
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cd build
make -j
#
# Ubuntu 12-Qt5
#
build-ubuntu-qt5:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt update && sudo apt install -y qtbase5-dev libqt5charts5-dev libgl1-mesa-dev build-essential cmake
- name: Apply patch
run: patch -p1 CMakeLists.txt < qt5.patch
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cd build
make -j
#
# Debian 12
#
build-debian12:
runs-on: ubuntu-latest
container:
image: debian:12
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
apt update && apt install -y qt6-tools-dev qt6-base-dev libqt6charts6-dev libqt6widgets6 libqt6gui6 libqt6opengl6-dev libgl1-mesa-dev build-essential cmake
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cd build
make -j
44 changes: 1 addition & 43 deletions .github/workflows/build.yml → .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: windows

on:
push:
Expand Down Expand Up @@ -35,48 +35,6 @@ jobs:
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

#
# Ubuntu
#
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt update && sudo apt install -y qt6-tools-dev qt6-base-dev libqt6charts6-dev libqt6widgets6 libqt6gui6 libqt6opengl6-dev libgl1-mesa-dev build-essential cmake
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cd build
make -j
#
# Debian 12
#
build-debian12:
runs-on: ubuntu-latest
container:
image: debian:12
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
apt update && apt install -y qt6-tools-dev qt6-base-dev libqt6charts6-dev libqt6widgets6 libqt6gui6 libqt6opengl6-dev libgl1-mesa-dev build-essential cmake
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cd build
make -j
#
# Windows
#
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ glm/*
.vscode/*
*.exe
bin/
*.zip
*.zip
debbuild
79 changes: 71 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Atom Architect

![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/ifilot/atom-architect?label=version)
[![build](https://github.com/ifilot/atom-architect/actions/workflows/build.yml/badge.svg)](https://github.com/ifilot/atom-architect/actions/workflows/build.yml)
[![windows](https://github.com/ifilot/atom-architect/actions/workflows/windows.yml/badge.svg)](https://github.com/ifilot/atom-architect/actions/workflows/windows.yml)
[![linux](https://github.com/ifilot/atom-architect/actions/workflows/linux.yml/badge.svg)](https://github.com/ifilot/atom-architect/actions/workflows/linux.yml)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

![Screenshot of Atom Architect](img/atom-architect-screenshot.JPG)
Expand All @@ -19,13 +20,17 @@ Latest installer for Window: [here](https://github.com/ifilot/atom-architect/rel

## Compilation

For Windows, it is recommended to use the installer as shown above. For Linux,
it is recommended to compile Atom Architect yourself. Please note that Atom
Architect is only tested for Debian 12 and Ubuntu 22.04. For other
distributions, you are on your own.
### Windows

To compile Atom Architect, please follow the compilation instructions as shown
below.
Compilation for Windows is most easily done by installing Qt Creator and loading
the project file `atom-architect.pro`.

### Linux Debian / Ubuntu

Please note that Atom Architect is only tested for Debian 12 and Ubuntu 22.04.
For other distributions, you are on your own.

#### Qt6

Start by installing all the required dependencies

Expand Down Expand Up @@ -60,11 +65,69 @@ folder the following command.
sudo cp -v ./atom_architect /usr/local/bin/atom_architect
```

#### Qt5

Start by installing all the required dependencies

```bash
sudo apt update && sudo apt install -y \
qtbase5-dev \
libqt5charts5-dev \
libgl1-mesa-dev \
build-essential \
cmake
```

After having cloned this repository and starting at its root folder, run a patch
file to change from Qt6 to Qt5.

```bash
patch -p1 CMakeLists.txt < qt5.patch
```

Create a new build folder, go to this folder, create the compilation and start
the compilation.

```bash
mkdir build
cd build
cmake ../
make -j
```

This will generate the compilation scripts and compile Atom Architect. You can
use Atom Architect by running `./atom_architect` in your `build` folder. If
you wish to install Atom Architect on your system, you can run in your `build`
folder the following command.

```bash
sudo cp -v ./atom_architect /usr/local/bin/atom_architect
```

### Snellius

To compile for the Snellius infrastructure, it is recommended to use the Qt5
toolchain. To do so, run the following patch file.

```bash
patch -p1 CMakeLists.txt < qt5.patch
```

## Dependencies

Atom Architect depends on [GLM](https://github.com/g-truc/glm) and
[Eigen3](https://eigen.tuxfamily.org/index.php?title=Main_Page). Both are
header-only C++ libraries and are for convenience purposes added to this
repository. This implies that compilation of Atom Architect will not use your
system-installed version of GLM and Eigen3, but use the one provided in this
repository.
repository.

## Common problems

> I have troubles running `Atom Architect` remotely via MobaXterm.
Try to enable direct rendering by setting the following environmental variable:

```bash
export LIBGL_ALWAYS_INDIRECT=0
```
Binary file added assets/structures/nebpack.bin
Binary file not shown.
8 changes: 8 additions & 0 deletions assets/themes/darkorange/darkorange.qss
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,11 @@ QHeaderView::section {
background-color: #222;
border: 0px;
}

QTableWidget QTableCornerButton::section {
background-color: #323232;
}

QTableWidget {
gridline-color: #fffff8;
}
22 changes: 22 additions & 0 deletions qt5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- CMakeLists.txt 2024-09-02 20:58:43.184160900 +0200
+++ CMakeLists-Qt5.txt 2024-09-12 11:33:12.719435600 +0200
@@ -20,8 +20,8 @@
)
add_compile_definitions(GIT_HASH="${GIT_HASH}")

-# Find Qt6 packages
-find_package(Qt6 REQUIRED COMPONENTS Widgets Charts)
+# Find Qt5 packages
+find_package(Qt5 REQUIRED COMPONENTS Widgets Charts)

add_executable(atom-architect
src/main.cpp
@@ -65,7 +65,7 @@
include_directories("src/vendor/eigen-3.4.0"
"src/vendor/glm-1.0.1")

-target_link_libraries(atom-architect PRIVATE Qt6::Core Qt6::Widgets Qt6::Charts)
+target_link_libraries(atom-architect PRIVATE Qt5::Core Qt5::Widgets Qt5::Charts)

set_target_properties(atom-architect PROPERTIES
WIN32_EXECUTABLE ON
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
#pragma once

#define PROGRAM_NAME "Atom Architect"
#define PROGRAM_VERSION "0.2.2"
#define PROGRAM_VERSION "0.2.3"
6 changes: 3 additions & 3 deletions src/data/structure_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ StructureLoader::StructureLoader(){}
std::shared_ptr<Structure> StructureLoader::load_file(const std::string& filename) {
QFileInfo qfi(QString(filename.c_str()));
std::shared_ptr<Structure> structure;
if(qfi.fileName() == "POSCAR" || qfi.fileName() == "CONTCAR") {
if(qfi.fileName().startsWith("POSCAR") || qfi.fileName().startsWith("CONTCAR")) {
structure = this->load_poscar(filename);
} else if(qfi.fileName() == "OUTCAR") {
} else if(qfi.fileName().startsWith("OUTCAR")) {
structure = this->load_outcar(filename).back();
} else if(qfi.completeSuffix() == "geo") {
structure = this->load_geo(filename);
Expand Down Expand Up @@ -392,7 +392,7 @@ std::vector<std::shared_ptr<Structure>> StructureLoader::load_outcar(const std::
unsigned int version_major = match.captured(2).toUInt();
unsigned int version_minor = match.captured(3).toUInt();

qDebug() << "Detected VASP: " << vasp_version;
qDebug() << "Detected VASP: " << vasp_version << "." << version_major << "." << version_minor;

continue;
}
Expand Down
21 changes: 17 additions & 4 deletions src/gui/anaglyph_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,17 @@ void AnaglyphWidget::mousePressEvent(QMouseEvent *event) {
emit(signal_selection_message(this->structure->get_selection_string()));
}

// custom menu
if (event->buttons() & Qt::RightButton && event->modifiers() & Qt::ControlModifier) {
this->custom_menu_requested(event->globalPosition().toPoint());
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// custom menu
if (event->buttons() & Qt::RightButton && event->modifiers() & Qt::ControlModifier) {
this->custom_menu_requested(event->globalPosition().toPoint());
}
#else
// custom menu
if (event->buttons() & Qt::RightButton && event->modifiers() & Qt::ControlModifier) {
this->custom_menu_requested(event->globalPos());
}
#endif
}

/**
Expand Down Expand Up @@ -287,8 +294,14 @@ void AnaglyphWidget::mouseMoveEvent(QMouseEvent *event) {
if(this->arcball_rotation_flag) { // drag event
// implementation adapted from
// https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Arcball

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
double ex = event->position().x();
double ey = event->position().y();
#else
double ex = event->pos().x();
double ey = event->pos().y();
#endif
if(ex != this->m_lastPos.x() || ey != this->m_lastPos.y()) {

// calculate arcball vectors
Expand Down
1 change: 1 addition & 0 deletions src/gui/anaglyph_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QDebug>
#include <QTimer>
#include <QMenu>
#include <QtGlobal>

#include <QtCore/qmath.h>
#include <QtCore/qvariant.h>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/analysis_geometry_optimization.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AnalysisGeometryOptimization : public QWidget {
public:
AnalysisGeometryOptimization(QWidget* parent = nullptr);

inline void set_structures(const std::vector<std::shared_ptr<Structure>> _structures) {
inline void set_structures(const std::vector<std::shared_ptr<Structure>>& _structures) {
this->structures = _structures;
this->structures.front()->update();
this->anaglyph_widget->set_structure(this->structures.front());
Expand Down
18 changes: 14 additions & 4 deletions src/gui/analysis_neb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,33 @@ void AnalysisNEB::update_graph() {
* @brief Open new OUTCAR file
*/
void AnalysisNEB::open() {
QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), "", tr("VASP NEB binary (nebpack.bin)"));
QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), "", tr("VASP NEB binary (*.bin)"));

if(filename.isEmpty()) {
return;
}

this->load_file(filename);
}

/**
* @brief load_file
* @param filename
*/
void AnalysisNEB::load_file(const QString& filename) {
StructureLoader sl;
this->set_structures(sl.load_neb_bin(filename.toStdString()));

// expand anaglyph widgets
unsigned int nr_rows = 4;
static const unsigned int nr_cols = 4;

qDebug() << "Loading " << this->structures.size() << " images.";
for(unsigned int i=0; i<this->structures.size(); i++) {
this->anaglyph_widgets.push_back(new AnaglyphWidget());
this->anaglyph_hypergrid->addWidget(this->anaglyph_widgets.back(), i / nr_rows * 2, i % nr_rows);
this->anaglyph_hypergrid->addWidget(this->anaglyph_widgets.back(), (i / nr_cols) * 2, i % nr_cols);

this->image_labels.push_back(new QLabel(tr("Image %1").arg(i+1)));
this->anaglyph_hypergrid->addWidget(this->image_labels.back(), i / nr_rows * 2 + 1, i % nr_rows);
this->anaglyph_hypergrid->addWidget(this->image_labels.back(), (i / nr_cols) * 2 + 1, i % nr_cols);

this->structures[i].front()->update();
this->anaglyph_widgets.back()->set_structure(this->structures[i].front());
Expand Down
Loading

0 comments on commit ce9149e

Please sign in to comment.