Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/classes/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ void AtomBase::deserialise(const SerialisedValue &node)
set(Deserialisable::deser<Elements::Element>(node.at("z")), Deserialisable::deser<Vector3>(node.at("r")),
Deserialisable::deser_or<double>(node, "q", 0));
}

// Set cell in which the atom exists
void AtomBase::setCell(Cell *cell) { cell_ = cell; }

// Return cell in which the atom exists
Cell *AtomBase::cell() const { return cell_; }
8 changes: 8 additions & 0 deletions src/classes/atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "data/elements.h"
#include "math/vector3.h"

class Cell;

// Atom Base
class AtomBase
{
Expand All @@ -26,6 +28,8 @@ class AtomBase
int index_{-1};
// Atom type index in parent object
int atomTypeIndex_{AtomConstants::TypeIndex::Ignore};
// Cell in which the atom exists
Cell *cell_{nullptr};

public:
// Set basic properties
Expand All @@ -52,6 +56,10 @@ class AtomBase
void setAtomTypeIndex(int id);
// Return associated atom type index
int atomTypeIndex() const;
// Set cell in which the atom exists
void setCell(Cell *cell);
// Return cell in which the atom exists
Cell *cell() const;

/*
* General Connectivity
Expand Down
8 changes: 4 additions & 4 deletions src/classes/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ const Vector3 &Cell::centre() const { return centre_; }
*/

// Return vector of contained Atoms
std::vector<ConfigurationAtom *> &Cell::atoms() { return atoms_; }
const std::vector<ConfigurationAtom *> &Cell::atoms() const { return atoms_; }
std::vector<AtomBase *> &Cell::atoms() { return atoms_; }
const std::vector<AtomBase *> &Cell::atoms() const { return atoms_; }

// Return number of Atoms in list
int Cell::nAtoms() const { return atoms_.size(); }

// Add atom to Cell
void Cell::addAtom(ConfigurationAtom *atom)
void Cell::addAtom(AtomBase *atom)
{
assert(atom);
assert(!atom->cell());
Expand All @@ -52,7 +52,7 @@ void Cell::addAtom(ConfigurationAtom *atom)
}

// Remove Atom from Cell
void Cell::removeAtom(ConfigurationAtom *atom)
void Cell::removeAtom(AtomBase *atom)
{
auto it = std::find(atoms_.begin(), atoms_.end(), atom);
assert(it != atoms_.end());
Expand Down
10 changes: 5 additions & 5 deletions src/classes/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ class Cell
*/
private:
// Vector of Atoms contained in this Cell
std::vector<ConfigurationAtom *> atoms_;
std::vector<AtomBase *> atoms_;

public:
// Return array of contained Atoms
std::vector<ConfigurationAtom *> &atoms();
const std::vector<ConfigurationAtom *> &atoms() const;
std::vector<AtomBase *> &atoms();
const std::vector<AtomBase *> &atoms() const;
// Return number of Atoms in array
int nAtoms() const;
// Add atom to Cell
void addAtom(ConfigurationAtom *atom);
void addAtom(AtomBase *atom);
// Remove Atom from Cell
void removeAtom(ConfigurationAtom *atom);
void removeAtom(AtomBase *atom);
// Clear all atoms from cell
void clearAtoms();
};
10 changes: 10 additions & 0 deletions src/classes/cellArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ const std::vector<CellNeighbour> &CellArray::neighbours(const Cell &cell) const
// Return vector of all unique cell neighbour pairs
const std::vector<CellNeighbourPair> &CellArray::getCellNeighbourPairs() const { return neighbourPairs_; }

// Return vector of all unique cell neighbour pairs with self cell pairs
const std::vector<CellNeighbourPair> CellArray::getCellNeighbourPairsWithSelf() const
{
auto result = neighbourPairs_;
for (auto &cell : cells_)
result.emplace_back(cell, cell, false);

return result;
}

// Return whether minimum image calculation is required between the supplied cells
bool CellArray::minimumImageRequired(const Cell &a, const Cell &b) const
{
Expand Down
2 changes: 2 additions & 0 deletions src/classes/cellArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class CellArray
const std::vector<CellNeighbour> &neighbours(const Cell &cell) const;
// Return vector of all unique cell neighbour pairs
const std::vector<CellNeighbourPair> &getCellNeighbourPairs() const;
// Return vector of all unique cell neighbour pairs with self cell pairs
const std::vector<CellNeighbourPair> getCellNeighbourPairsWithSelf() const;
// Return whether minimum image calculation is required between the supplied cells
bool minimumImageRequired(const Cell &a, const Cell &b) const;

Expand Down
6 changes: 0 additions & 6 deletions src/classes/configurationAtom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ void ConfigurationAtom::setMolecule(std::shared_ptr<Molecule> mol) { molecule_ =
// Return Molecule in which this Atom exists
const std::shared_ptr<Molecule> &ConfigurationAtom::molecule() const { return molecule_; }

// Set cell in which the atom exists
void ConfigurationAtom::setCell(Cell *cell) { cell_ = cell; }

// Return cell in which the atom exists
Cell *ConfigurationAtom::cell() const { return cell_; }

/*
* Intramolecular Information
*/
Expand Down
6 changes: 0 additions & 6 deletions src/classes/configurationAtom.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class ConfigurationAtom : public Atom<SpeciesBond>
const SpeciesAtom *speciesAtom_{nullptr};
// Molecule in which this Atom exists
std::shared_ptr<Molecule> molecule_{nullptr};
// Cell in which the atom exists
Cell *cell_{nullptr};

public:
// Set SpeciesAtom that this Atom represents
Expand All @@ -36,10 +34,6 @@ class ConfigurationAtom : public Atom<SpeciesBond>
void setMolecule(std::shared_ptr<Molecule> mol);
// Return Molecule in which this Atom exists
const std::shared_ptr<Molecule> &molecule() const;
// Set cell in which the atom exists
void setCell(Cell *cell);
// Return cell in which the atom exists
Cell *cell() const;

/*
* Intramolecular Information
Expand Down
104 changes: 50 additions & 54 deletions src/gui2/qml/DissolveMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ import "../../Dissolve"
ApplicationWindow {
id: dissolveWindow

property Dialog quickRunDialog: null
property vector3d scale: Qt.vector3d(Math.min(graphView.width / 2.5, graphView.height / 2.5), Math.min(graphView.width / 2.5, graphView.height / 2.5), 200)

height: Screen.height
width: Screen.width
title: "Dissolve"
visible: true

property Dialog quickRunDialog: null
Component {
id: quickRunDialogComponent

QuickRunDialog {
}
}
width: Screen.width

/*
* Dissolve2 Main Menu
Expand All @@ -50,51 +43,45 @@ ApplicationWindow {
title: "&File"

MenuItem {
text: "&New project"

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Create a new Dissolve project"
ToolTip.visible: hovered
text: "&New project"
}
MenuItem {
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Load an existing Dissolve graph from a TOML file"
ToolTip.visible: hovered
//shortcut: "Ctrl+O"
text: "&Load project from TOML"

onTriggered: openDialog.open()

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Load an existing Dissolve graph from a TOML file"
}
MenuItem {
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Save the current Dissolve graph to a TOML file"
ToolTip.visible: hovered
//shortcut: "Ctrl+S"
text: "&Save project to TOML"

onTriggered: saveDialog.open()

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Save the current Dissolve graph to a TOML file"
}

MenuSeparator {}

MenuSeparator {
}
MenuItem {
text: "Load Restart Point..."
}
MenuItem {
text: "Save Restart Point..."
}

MenuSeparator {}

MenuSeparator {
}
MenuItem {
//shortcut: "Ctrl+X"
text: "Close project"
}

MenuSeparator {}

MenuSeparator {
}
MenuItem {
//shortcut: "Ctrl+Q"
text: "&Quit Dissolve"
Expand All @@ -112,35 +99,33 @@ ApplicationWindow {
title: "&Graph"

DissolveMenuItem {
iconPath: "qrc:/DissolveIconsModule/play.svg"

dissolveAction: Action {
text: "&Run"
shortcut: "Ctrl+Enter"
text: "&Run"

onTriggered: dissolveWindow.quickRunDialog.open()
}
iconPath: "qrc:/DissolveIconsModule/play.svg"
}

MenuSeparator{}

MenuSeparator {
}
MenuItem {
//shortcut: "Ctrl+A"
text: "&Add Node"

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Search the Node registry by node name, and add the selection to the graph"

//onTriggered: dissolveWindow.nodeSearchDialog.open()
ToolTip.visible: hovered
//shortcut: "Ctrl+A"
text: "&Add Node"
}
MenuSeparator {
}

MenuSeparator{}

MenuItem {
text: "&EPSR"

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "Open the EPSR Manager"
ToolTip.visible: hovered
text: "&EPSR"
}
}

Expand All @@ -153,24 +138,30 @@ ApplicationWindow {
title: "&View"

MenuItem {
//shortcut: "Ctrl+N"
text: "&Nodes"

ToolTip.visible: hovered
ToolTip.delay: Application.styleHints.mousePressAndHoldInterval
ToolTip.text: "View all available Nodes"
ToolTip.visible: hovered
//shortcut: "Ctrl+N"
text: "&Nodes"
}
}
}

Component {
id: quickRunDialogComponent

QuickRunDialog {
}
}

/*
* TabBar
*/
TabBar {
id: tabBar

width: parent.width
currentIndex: 2
width: parent.width

// DEFAULT TABS
TabButton {
Expand All @@ -193,6 +184,7 @@ ApplicationWindow {
*/
StackLayout {
id: applicationTabStack

anchors.bottom: parent.bottom
anchors.top: tabBar.bottom
currentIndex: tabBar.currentIndex
Expand Down Expand Up @@ -226,7 +218,10 @@ ApplicationWindow {
id: graphModel

graph: dissolve.graph
Component.onCompleted: dissolveWindow.quickRunDialog = quickRunDialogComponent.createObject(dissolveWindow, {graphModel : graphModel})

Component.onCompleted: dissolveWindow.quickRunDialog = quickRunDialogComponent.createObject(dissolveWindow, {
graphModel: graphModel
})
}
Pane {
id: toolBar
Expand Down Expand Up @@ -291,8 +286,13 @@ ApplicationWindow {
parameterEndPointsModel: graphModel.parameterEndPoints
rootGraphModel: graphModel

Component.onCompleted: {
graphModel.canvasDimensions = Qt.size(graph.width, graph.height);
}

Repeater {
id: graphDelegateRepeater

model: graph.nodeModel

delegate: Component {
Expand All @@ -308,10 +308,6 @@ ApplicationWindow {
}
}
}

Component.onCompleted: {
graphModel.canvasDimensions = Qt.size(graph.width, graph.height)
}
}
}
}
Expand Down
Loading
Loading