-
Notifications
You must be signed in to change notification settings - Fork 81
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 packmol_args parameter to packing fucntions. Allows user to give additional commands to PACKMOL. #787
Conversation
…commands, and later adds them to PACKMOL_HEADER
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #787 +/- ##
==========================================
+ Coverage 87.32% 87.45% +0.12%
==========================================
Files 62 62
Lines 6525 6568 +43
==========================================
+ Hits 5698 5744 +46
+ Misses 827 824 -3 ☔ View full report in Codecov by Sentry. |
Can you add an example of its use to one of the doc strings and also a unit test? not sure which extra parameter is the best to test, but probably whichever is easiest to verify. |
Ok, I added doc strings and a unit test. The best way to test is to check the PACKMOL input file, which the easiest way to access is by causing an error and inspecting the One potential issue that needs some input from others; how should it be handled when a user passes in a command for Along the same lines are the packmol commands for |
I'm no packmol expert, but I would lean towards the override + warn option, so people know they are overriding a default.
Ignore + warning seems reasonable to me. Or error out with a helpful message. You can have a list of supported args (or if the list of not supported args is shorter, then that might work too. How do you handle it if a user passes in an option that is not a valid packmol argument? IMO that should be a unit test as well. |
Error when args that don't make sense or will undermine how we are using packmol (like changing the intermediate file from xyz to something esle). I think warn+error when something like |
Per discussion; use a Example: # Combine default/custom args and override default
custom_args = {**default_args, **custom_args} |
This pull request introduces 1 alert when merging deb4343 into aefb71f - view on LGTM.com new alerts:
|
Just as a quick update on this...I kind of got stuck on figuring out how to handle parsing through all of the different commands allowed by PACKMOL (there are a lot), and which ones we should raise errors and/or warnings for, which ones make sense to append to the top of the temp txt file, and which ones should be ignored. I still think it would be nice to be able to let the user pass in any of the file-level (i.e. not atom/structure level) PACKMOL commands, but we still need to decide to what degree we are checking that the user is not breaking any PACKMOL stuff by passing in commands that don't exist, or make sense. |
IMO we don't have to support ALL of the packmol options for now. Even just increasing the number of possible options would give more general support for users. A few people have suggested particular functions that would be nice to use: |
I agree. I'll re-visit this one as well as the PR that adds fix orientation options. |
I think the main thing left to do here is 1) decide if we want to make a list of allowed packmol arguments that can be used in Here is an example of what using
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #787 +/- ##
==========================================
+ Coverage 85.59% 87.45% +1.85%
==========================================
Files 62 62
Lines 6540 6568 +28
==========================================
+ Hits 5598 5744 +146
+ Misses 942 824 -118 ☔ View full report in Codecov by Sentry. |
This is the failing test:
It's not clear to me what warning it is trying to catch, or what changes I made would cause this to fail. I kinda think we should just remove it since we have plenty of test coverage in |
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.
LGTM
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 is good to go, let's wait to merge #1189 since that's a more general bugfix I think to these failing packmol tests using the overlap argument, and then can be merged in right after.
for more information, see https://pre-commit.ci
PR Summary:
Each of the packing/fill functions now has a
packmol_args
parameter, where the user can pass in a dictionary of packmol commands with their values, and these are appended to thePACKMOL_HEADER
string.Quick example; using some of the additional input commands found here
It gives the user a little bit more control when initializing a system with
packing.py
.A couple of these were really helpful for the project I am currently working on, specifically
movebadrandom
andmovefrac
. I was manually editingpacking.py
and adding these intoPACKMOL_HEADER
, but it would be nice to have an easier option of changing these packmol inputs.I haven't updated the doc strings or made unit tests yet, I wanted to get some input first.
PR Checklist