Skip to content

refactor: AverageMolecule node#2490

Merged
trisyoungs merged 9 commits into
develop2from
dissolve2/avgmol-node
Jun 10, 2026
Merged

refactor: AverageMolecule node#2490
trisyoungs merged 9 commits into
develop2from
dissolve2/avgmol-node

Conversation

@trisyoungs

Copy link
Copy Markdown
Member

Heavy refactor of AvgMolModule into AverageMoleculeNode.

Obsoletes #2328.

@rprospero rprospero 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.

I have a question/suggestion about how we're handling the sampled coordinates, but everything else looks good

Comment on lines +57 to +67
if (!sampledX_)
{
message("Initialising arrays for average molecule: size = {}\n", requiredSize);

sampledX_.emplace().initialise(requiredSize);
sampledY_.emplace().initialise(requiredSize);
sampledZ_.emplace().initialise(requiredSize);

// Copy current geometry of species to set up atom / bond relationships in the Structure
structure_ = targetSpecies->asStructure();
}

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.

If I change the target species in the GUI, does sampledX_ get resized to the new required size? The current logic seems to only check if the vector has every been initialised at all.

I'm wondering if we might be better off using the raw vector instead of an optional one. Our test would then be whether the vector has the correct length, instead of checking whether the optional has been filled.

@trisyoungs trisyoungs Jun 10, 2026

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 is effectively captured by issue #2488 which I put in yesterday - changing the input Site (== Species) should absolutely force the data to be cleared and reset. We should handle this in a general way at the Node/Parameter level, and we already have virtual Node::clearData(). What we don't currently have is the flag on Parameter to call that function if the parameter data changes, hence #2488.

@rprospero rprospero mentioned this pull request Jun 10, 2026
@trisyoungs trisyoungs merged commit 2987c2e into develop2 Jun 10, 2026
1 check passed
@trisyoungs trisyoungs deleted the dissolve2/avgmol-node branch June 10, 2026 09:44
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