Skip to content

refactor: Add general Structure class#2420

Open
trisyoungs wants to merge 8 commits intodevelop2from
dissolve2/structure-class
Open

refactor: Add general Structure class#2420
trisyoungs wants to merge 8 commits intodevelop2from
dissolve2/structure-class

Conversation

@trisyoungs
Copy link
Copy Markdown
Member

With plans in mind for introducing the capability for a Species to be created within a graph from source geometry and forcefield terms, this PR introduces a fairly lightweight Structure class. It is envisaged that this will be used to store, e.g. data read from XYZ files, data read from CIF files, etc. Since its focus is on utility rather than strictly protected data relationships (as is the case with Species) both atoms and bonds are represented as vectors of unique ptrs, rather than trying to emulate the reference-based system in Species which requires a bunch of copy / move constructor magic to maintain it. Thoughts on this welcome!

A little pre-emptive tidying of Species is done along the way to remove some unused stuff.

@trisyoungs
Copy link
Copy Markdown
Member Author

I have just realised that a number of functions were declared but not implemented. I'll be moving these over in a follow-up PR.

Comment thread src/classes/atom.cpp
Atom::Presence Atom::presence() const
{
return Z_ == Elements::Phantom ? Presence::Phantom : Presence::Physical;
;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
;

Comment thread src/classes/structure.cpp
#include "classes/structure.h"
#include "classes/species.h"

Structure::Structure() { box_ = std::make_unique<SingleImageBox>(); }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could all go into the initialiser list, in structure.h

Suggested change
Structure::Structure() { box_ = std::make_unique<SingleImageBox>(); }
Structure::Structure() : box_(std::make_unique<SingleImageBox>()) {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants