@@ -237,8 +237,8 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
237237 // ------------------------------------------------------------
238238 // Geometry optimization viewer (BOTTOM-LEFT)
239239 // ------------------------------------------------------------
240- geometryOptimization = new AnalysisGeometryOptimization (this );
241- this ->analysis_panel_ = geometryOptimization ->viewer ();
240+ structureAnalysis = new StructureAnalysis (this );
241+ this ->analysis_panel_ = structureAnalysis ->viewer ();
242242
243243 QMenuBar *analysisMenuBar = new QMenuBar (this );
244244 analysisMenuBar->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Fixed);
@@ -273,6 +273,7 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
273273
274274 QAction *analysisActionOpen = analysisMenuFile->addAction (tr (" Open" ));
275275 analysisActionOpen->setShortcuts (QKeySequence::Open);
276+ QAction *analysisActionOpenNeb = analysisMenuFile->addAction (tr (" Open NEB calculation" ));
276277 QAction *analysisActionSendToEditor = analysisMenuFile->addAction (tr (" Send to editor" ));
277278
278279 analysisActionCameraDefault->setText (tr (" Default" ));
@@ -321,7 +322,7 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
321322 analysisActionProjectionInterlacedCheckerboardLr->setIcon (QIcon (" :/assets/icon/interlaced_checkerboard_lr_32.png" ));
322323 analysisActionProjectionInterlacedCheckerboardRl->setIcon (QIcon (" :/assets/icon/interlaced_checkerboard_rl_32.png" ));
323324
324- for (QAction *action : {analysisActionOpen, analysisActionSendToEditor,
325+ for (QAction *action : {analysisActionOpen, analysisActionOpenNeb, analysisActionSendToEditor,
325326 analysisActionCameraDefault, analysisActionCameraTop, analysisActionCameraBottom,
326327 analysisActionCameraLeft, analysisActionCameraRight, analysisActionCameraFront,
327328 analysisActionCameraBack, analysisActionCameraPerspective, analysisActionCameraOrthographic,
@@ -356,13 +357,13 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
356357 analysisMenuProjectionInterlaced->addAction (analysisActionProjectionInterlacedCheckerboardLr);
357358 analysisMenuProjectionInterlaced->addAction (analysisActionProjectionInterlacedCheckerboardRl);
358359
359- geometryOptimization ->viewer ()->set_header_widget (analysisMenuBar);
360+ structureAnalysis ->viewer ()->set_header_widget (analysisMenuBar);
360361
361- analysis_toolbar = new ToolBarWidget (geometryOptimization ->viewer (), false );
362+ analysis_toolbar = new ToolBarWidget (structureAnalysis ->viewer (), false );
362363 analysis_toolbar->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Expanding);
363- geometryOptimization ->viewer ()->set_side_toolbar (analysis_toolbar);
364+ structureAnalysis ->viewer ()->set_side_toolbar (analysis_toolbar);
364365
365- leftSplitter->addWidget (geometryOptimization ->viewer ());
366+ leftSplitter->addWidget (structureAnalysis ->viewer ());
366367
367368 // ============================================================
368369 // RIGHT COLUMN (Structure info + Optimization graph)
@@ -383,7 +384,7 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
383384 // ------------------------------------------------------------
384385 // Optimization graph (BOTTOM-RIGHT)
385386 // ------------------------------------------------------------
386- rightSplitter->addWidget (geometryOptimization ->graph ());
387+ rightSplitter->addWidget (structureAnalysis ->graph ());
387388
388389 // ============================================================
389390 // Initial 50/50/50/50 layout (relative to MainWindow size)
@@ -422,12 +423,12 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
422423
423424 connect (analysis_toolbar->get_action (" toggle_periodicity_xy" ),
424425 SIGNAL (triggered ()),
425- geometryOptimization ->viewer ()->get_anaglyph_widget (),
426+ structureAnalysis ->viewer ()->get_anaglyph_widget (),
426427 SLOT (toggle_periodicity_xy ()));
427428
428429 connect (analysis_toolbar->get_action (" toggle_periodicity_z" ),
429430 SIGNAL (triggered ()),
430- geometryOptimization ->viewer ()->get_anaglyph_widget (),
431+ structureAnalysis ->viewer ()->get_anaglyph_widget (),
431432 SLOT (toggle_periodicity_z ()));
432433
433434 connect (anaglyph_widget, SIGNAL (signal_interaction_message (const QString&)),
@@ -449,12 +450,13 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
449450 anaglyph_widget->get_user_action ().get (),
450451 SLOT (set_fragment (const Fragment&)));
451452
452- connect (geometryOptimization ->viewer (), SIGNAL (edit_requested ()),
453+ connect (structureAnalysis ->viewer (), SIGNAL (edit_requested ()),
453454 this , SLOT (load_structure_from_geometry_analysis ()));
454455
455456 connect (editorActionOpen, &QAction::triggered, this , &InterfaceWindow::open_editor_file);
456457 connect (editorActionSave, &QAction::triggered, this , &InterfaceWindow::save_editor_file);
457458 connect (analysisActionOpen, &QAction::triggered, this , &InterfaceWindow::open_analysis_file);
459+ connect (analysisActionOpenNeb, &QAction::triggered, this , &InterfaceWindow::open_analysis_neb_calculation);
458460 connect (analysisActionSendToEditor, &QAction::triggered, this , &InterfaceWindow::load_structure_from_geometry_analysis);
459461
460462 connect (editorActionSelectAll, SIGNAL (triggered ()), this , SLOT (select_all_atoms ()));
@@ -474,16 +476,16 @@ InterfaceWindow::InterfaceWindow(MainWindow *mw)
474476 connect (editorActionProjectionInterlacedCheckerboardLr, &QAction::triggered, this , [this ]{ this ->anaglyph_widget ->set_stereo (" stereo_interlaced_checkerboard_lr" ); });
475477 connect (editorActionProjectionInterlacedCheckerboardRl, &QAction::triggered, this , [this ]{ this ->anaglyph_widget ->set_stereo (" stereo_interlaced_checkerboard_rl" ); });
476478
477- connect (analysisMenuCameraAlign, SIGNAL (triggered (QAction*)), geometryOptimization , SLOT (set_camera_align (QAction*)));
478- connect (analysisMenuCameraMode, SIGNAL (triggered (QAction*)), geometryOptimization , SLOT (set_camera_mode (QAction*)));
479- connect (analysisActionProjectionTwoDimensional, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" no_stereo_flat" ); });
480- connect (analysisActionProjectionAnaglyphRedCyan, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_anaglyph_red_cyan" ); });
481- connect (analysisActionProjectionInterlacedRowsLr, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_rows_lr" ); });
482- connect (analysisActionProjectionInterlacedRowsRl, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_rows_rl" ); });
483- connect (analysisActionProjectionInterlacedColumnsLr, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_columns_lr" ); });
484- connect (analysisActionProjectionInterlacedColumnsRl, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_columns_rl" ); });
485- connect (analysisActionProjectionInterlacedCheckerboardLr, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_checkerboard_lr" ); });
486- connect (analysisActionProjectionInterlacedCheckerboardRl, &QAction::triggered, this , [this ]{ this ->geometryOptimization ->set_stereo (" stereo_interlaced_checkerboard_rl" ); });
479+ connect (analysisMenuCameraAlign, SIGNAL (triggered (QAction*)), structureAnalysis , SLOT (set_camera_align (QAction*)));
480+ connect (analysisMenuCameraMode, SIGNAL (triggered (QAction*)), structureAnalysis , SLOT (set_camera_mode (QAction*)));
481+ connect (analysisActionProjectionTwoDimensional, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" no_stereo_flat" ); });
482+ connect (analysisActionProjectionAnaglyphRedCyan, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_anaglyph_red_cyan" ); });
483+ connect (analysisActionProjectionInterlacedRowsLr, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_rows_lr" ); });
484+ connect (analysisActionProjectionInterlacedRowsRl, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_rows_rl" ); });
485+ connect (analysisActionProjectionInterlacedColumnsLr, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_columns_lr" ); });
486+ connect (analysisActionProjectionInterlacedColumnsRl, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_columns_rl" ); });
487+ connect (analysisActionProjectionInterlacedCheckerboardLr, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_checkerboard_lr" ); });
488+ connect (analysisActionProjectionInterlacedCheckerboardRl, &QAction::triggered, this , [this ]{ this ->structureAnalysis ->set_stereo (" stereo_interlaced_checkerboard_rl" ); });
487489
488490 this ->active_panel_timer_ = new QTimer (this );
489491 this ->active_panel_timer_ ->setInterval (40 );
@@ -543,8 +545,8 @@ void InterfaceWindow::set_active_panel(bool editor_active)
543545 this ->anaglyph_widget ->set_active_highlight (editor_active);
544546 }
545547
546- if (this ->geometryOptimization != nullptr && this ->geometryOptimization ->viewer () != nullptr ) {
547- auto *analysisAnaglyph = this ->geometryOptimization ->viewer ()->get_anaglyph_widget ();
548+ if (this ->structureAnalysis != nullptr && this ->structureAnalysis ->viewer () != nullptr ) {
549+ auto *analysisAnaglyph = this ->structureAnalysis ->viewer ()->get_anaglyph_widget ();
548550 if (analysisAnaglyph != nullptr ) {
549551 analysisAnaglyph->set_active_highlight (!editor_active);
550552 }
@@ -627,7 +629,7 @@ void InterfaceWindow::open_file(const QString& filename)
627629
628630 // ---- Update analysis panels ----
629631 if (structures.size () == 1 && structures.front ()->get_nr_eigenmodes () > 0 ) {
630- geometryOptimization ->set_frequency_structure (structures.front ()->clone_for_view ());
632+ structureAnalysis ->set_frequency_structure (structures.front ()->clone_for_view ());
631633 } else {
632634 std::vector<std::shared_ptr<Structure>> geometry_structures;
633635 geometry_structures.reserve (structures.size ());
@@ -636,7 +638,7 @@ void InterfaceWindow::open_file(const QString& filename)
636638 geometry_structures.push_back (s->clone_for_view ());
637639 }
638640
639- geometryOptimization ->set_structures (geometry_structures);
641+ structureAnalysis ->set_structures (geometry_structures);
640642 }
641643
642644 // ---- Also sync editor + info to first structure ----
@@ -717,7 +719,44 @@ void InterfaceWindow::open_analysis_file()
717719 return ;
718720 }
719721
720- geometryOptimization->load_file (filename);
722+ structureAnalysis->load_file (filename);
723+ }
724+
725+ void InterfaceWindow::open_analysis_neb_calculation ()
726+ {
727+ const QString folder = QFileDialog::getExistingDirectory (
728+ this ,
729+ tr (" Open NEB calculation" ),
730+ QString (),
731+ QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks
732+ );
733+
734+ if (folder.isEmpty ()) {
735+ return ;
736+ }
737+
738+ NebCalculationLoader neb_loader;
739+ QString error_message;
740+ if (!neb_loader.load (folder, &error_message)) {
741+ QMessageBox message_box (this );
742+ message_box.setIcon (QMessageBox::Critical);
743+ message_box.setWindowTitle (tr (" Could not open NEB calculation" ));
744+ message_box.setText (tr (" The selected folder is not a valid VASP NEB calculation." ));
745+ message_box.setInformativeText (error_message);
746+ message_box.setStyleSheet (" QLabel{min-width: 420px; font-weight: normal;}" );
747+ message_box.exec ();
748+ return ;
749+ }
750+
751+ std::vector<std::shared_ptr<Structure>> geometry_structures;
752+ const auto & loaded_structures = neb_loader.structures ();
753+ geometry_structures.reserve (loaded_structures.size ());
754+
755+ for (const auto & structure : loaded_structures) {
756+ geometry_structures.push_back (structure->clone_for_view ());
757+ }
758+
759+ structureAnalysis->set_structures (geometry_structures, StructureAnalysisViewer::SeriesKind::NEB);
721760}
722761
723762void InterfaceWindow::save_editor_file ()
@@ -915,6 +954,6 @@ void InterfaceWindow::decrement_structure_stack_pointer() {
915954 */
916955void InterfaceWindow::load_structure_from_geometry_analysis () {
917956 this ->anaglyph_widget ->set_structure (
918- this ->geometryOptimization ->viewer ()->get_anaglyph_widget ()->get_structure ()->clone_for_view ()
957+ this ->structureAnalysis ->viewer ()->get_anaglyph_widget ()->get_structure ()->clone_for_view ()
919958 );
920959}
0 commit comments