Skip to content

refactor: Instances in species - #2598

Merged
trisyoungs merged 32 commits into
develop2from
dissolve2/instances-in-species
Sep 1, 2026
Merged

refactor: Instances in species#2598
trisyoungs merged 32 commits into
develop2from
dissolve2/instances-in-species

Conversation

@trisyoungs

Copy link
Copy Markdown
Member

This PR adds instance storage to the Species class, introduces the InstantiateNode for adding detected molecule replicas into a configuration, and performs some refactoring on the CIF unit tests.

@trisyoungs trisyoungs changed the title Dissolve2/instances in species refactor: Instances in species Aug 28, 2026

@RobBuchananCompPhys RobBuchananCompPhys left a comment

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.

Looks very good 👍 , particularly like the clean logic flow in ReplicatedConfigurationNode. Would be good to get your thoughts on a couple of suggestions!

addOutput(name, "Detected molecular structure", structure);
else
{
// TODO Need to update the underlying ParameterBase here, but how?

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.

Is this outlying task going to be a blocker on the proper functioning of the node? Why/in what way exactly do we need to update the ParameterBase?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So this was a realisation that I had - the ParameterBase stores a reference to the Structure, but if the DetectMolecules node runs again the Structures are all recreated so the reference won't be valid any longer. We can't just replace the reference with another one, so we would have to recreate the dynamic output which means losing any connectivity we had to it before. Maybe this isn't a big issue in practice because - we need the UI to find out I guess!

Comment thread src/classes/configuration.cpp
Comment thread src/nodes/replicatedConfiguration.cpp Outdated

replicated_.updateObjectRelationships();

message("Created {}x{}x{} replica - {} atoms total.\n", repeat_.x, repeat_.y, repeat_.z, replicated_.nAtoms());

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
message("Created {}x{}x{} replica - {} atoms total.\n", repeat_.x, repeat_.y, repeat_.z, replicated_.nAtoms());
message("Configuration replicated: New dimensions are {}x{}x{}, {} atoms total.\n", repeat_.x, repeat_.y, repeat_.z, replicated_.nAtoms());

Really pedantic suggestion here (!). Although replication sounds fine as a description of the process taking place, the idea of a "replica" doesn't quite sit right (sounds a little too much like "made an exact copy"!). I suggest we frame this message slightly differently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

OK, what about "Configuration contents replicated ({}x{}x{}) - {} atoms in new configuration."?

Comment thread src/classes/species.cpp
@RobBuchananCompPhys
RobBuchananCompPhys self-requested a review August 28, 2026 14:34
@trisyoungs
trisyoungs merged commit fcd9af3 into develop2 Sep 1, 2026
9 checks passed
@trisyoungs
trisyoungs deleted the dissolve2/instances-in-species branch September 1, 2026 08:34
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