-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Topology.add_molecules
#1920
Conversation
Run ``` $ pre-commit try-repo https://github.com/asottile/yesqa ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, now that I see it implemented (and reinforced by the need for @overload
decorators), I think that making a new add_molecules
API point is the way to go.
Topology.add_molecule
to take list[Molecule]Topology.add_molecules
|
||
assert topology.n_molecules == 10_000 | ||
|
||
assert indices == [*range(1, 10_001)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
assert indices == [*range(1, 10_001)] | |
assert indices == [*range(10_000)] |
but the behavior (of both functions) is to return a 1-indexed index whereas I expected 0-indexed: #1922
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not blocking) Agree, please feel free to change this behavior for add_molecule
and add_molecules
in this PR (though you've already gone through one major change so we can also handle this in a future PR if you prefer).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent - This is good to merge as-is, or feel free to also fix #1922 and include it in the releasenotes. Thanks @mattwthompson!
|
||
assert topology.n_molecules == 10_000 | ||
|
||
assert indices == [*range(1, 10_001)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not blocking) Agree, please feel free to change this behavior for add_molecule
and add_molecules
in this PR (though you've already gone through one major change so we can also handle this in a future PR if you prefer).
Thanks - my preference is to (and I will) do them in separate PRs - but it'd be nice for them to be a part of the same release. If nothing surprising pops up I'll have the next one up shortly |
Resolves #1916; modifying the reproduction to leverage this change (
topology.add_molecule(n_solvent * [water])
) indicates timing differences are within noise(Timings are at 2ed0083, see edit history for others)