Skip to content

refactor: Remove Configuration AtomTypeMix - #2220

Merged
trisyoungs merged 6 commits into
dissolve2/double-keyed-mapfrom
dissolve2/remove-configuration-atomtypemix
Aug 15, 2025
Merged

refactor: Remove Configuration AtomTypeMix#2220
trisyoungs merged 6 commits into
dissolve2/double-keyed-mapfrom
dissolve2/remove-configuration-atomtypemix

Conversation

@trisyoungs

Copy link
Copy Markdown
Member

Follows #2214

This PR removes the AtomTypeMix from Configuration, moving towards a dynamic calculation of atom type populations etc. from stored Species populations. The effects are quite wide-ranging, so this is the only thing addressed here.

@trisyoungs
trisyoungs changed the base branch from develop to dissolve2/double-keyed-map August 13, 2025 14:25

@github-actions github-actions Bot 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.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 6edd5d6 Previous: 41d9664 Ratio
BM_Box_MinimumDistance<TriclinicBox> 24.659513680822435 ns/iter 11.082351824938764 ns/iter 2.23

This comment was automatically generated by workflow using github-action-benchmark.

CC: @disorderedmaterials/dissolve-devs

@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 good 👍

[&](int indexI, const auto &popI, int indexJ, const auto &popJ)
{
auto key = DoubleKeyedMapKey{atd1.atomTypeName(), atd2.atomTypeName()};
auto key = DoubleKeyedMapKey{popI.first->name(), popJ.first->name()};

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.

On one hand I do quite like the idea of self-contained class we can instantiate to store these more abstract keys - however, I worry it is a bit onerous to fully initialise a key in this way. Is it not possible to overload an operator on DoubleKeyedMap to handle it all-in-one?


auto &bound = unweightedsq.boundPartials().get(key);
auto &unbound = unweightedsq.unboundPartials().get(key);
auto &partial = unweightedsq.partials().get(key);

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.

Further to the previous comment, is:
auto &bound = unweightedsq.boundPartials[popI.first->name(), popJ.first->name()] where & operator[]
not possible?

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.

The answer is "Yes, but...". You could absolutely have an operator[] which takes a std::pair of the names and does the lookup (you can't have multiple args to operator[] so you have to wrap them in something like a std::pair). The "but" is that we typically only want to use it as a const getter, while std::map's operator[] is fully non-const as it creates new values if the key is not present. So, in the interest of maintaining "semantic compatibility" between DoubleKeyedMap and std::map, I elected to implement get() and at() instead.

Co-authored-by: Tristan Youngs <trisyoungs@googlemail.com>
@trisyoungs
trisyoungs merged commit 0c5da07 into dissolve2/double-keyed-map Aug 15, 2025
@trisyoungs
trisyoungs deleted the dissolve2/remove-configuration-atomtypemix branch August 15, 2025 13:59
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