refactor: Test species as TOML#2424
Open
trisyoungs wants to merge 10 commits intodissolve2/tidy-up-species-intra-serialisationfrom
Open
refactor: Test species as TOML#2424trisyoungs wants to merge 10 commits intodissolve2/tidy-up-species-intra-serialisationfrom
trisyoungs wants to merge 10 commits intodissolve2/tidy-up-species-intra-serialisationfrom
Conversation
…sing using the non-DL_POLY water (site definitions were incorrect).
…Geometry() function.
RobBuchananCompPhys
approved these changes
May 5, 2026
| // Set up the test graph | ||
| TestGraph testGraph; | ||
| testGraph.createConfiguration("Box", {{createWater, 267}}, 0.1); | ||
| testGraph.createConfiguration("Box", {{[]() { return TestGraph::loadTOMLSpecies("species/water-dlpoly.toml"); }, 267}}, |
Contributor
There was a problem hiding this comment.
I think this goes back to a question I asked in a PR some time ago - do we need to revisit the use of a lambda here (which in this case takes up code space with curly braces and empty lambda/arg capture)? If we still need the option to operate further on the created species, then this might be useful, otherwise, perhaps we could look at setting this argument to a simple std::pair<std::unique_ptr<SpeciesNode>, int>, or even just have an extra optional argument const std::optional<std::function<SpeciesNode *>()>> &speciesInitialiser = {} which is there as a back-up in case we want to call it further down the line like
if (speciesInitialiser)
*speciesInitialiser(sp.get());
Comment on lines
+447
to
+451
| if (box_->type() != Box::BoxType::NonPeriodic) | ||
| { | ||
| attachedAtomListsGenerated_ = false; | ||
| return; | ||
| } |
Contributor
There was a problem hiding this comment.
Could this be a more simple bouncer pattern?
Suggested change
| if (box_->type() != Box::BoxType::NonPeriodic) | |
| { | |
| attachedAtomListsGenerated_ = false; | |
| return; | |
| } | |
| attachedAtomListsGenerated_ = box_->type() != Box::BoxType::NonPeriodic; | |
| if (attachedAtomListsGenerated_) | |
| { | |
| ... // everything from line 455 to 561 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #2422
This PR removes the code-based generation of test species in
speciesData.hand replaces it with loading of TOML species now thatAtomTypeandCommonTermdata is local to theSpeciesclass.