-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
small modification to fix bond/react to allow equal style variables as probability input #2013
Conversation
…s probability o On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: doc/src/fix_bond_react.rst new file: examples/USER/reaction/nylon,6-6_melt/in.large_nylon_melt_variable_probability modified: src/USER-REACTION/fix_bond_react.cpp modified: src/USER-REACTION/fix_bond_react.h
@jrgissing i realized that the data file is missing in the "nylon,6-6_melt" example |
thanks for noticing this! (strangely, it's not the first time this data file has disappeared...) |
thanks for this PR, this is a useful capability. I will probably push some small formatting changes to your branch. also, looks like you overwrote one of the existing 'log' files in the examples, instead of making a new one |
feel free to do so. I'm new to git and Github, but I'll do my best to proceed. regarding the log file. As already said, new to git (except for just cloning, pulling and compiling progs). So, sorry. My intention was to provide a new example script in the tiny nylon folder to show the usage. I also put a new log file called log.22Apr20.xxx, at least that was the intention. Sorry for any inconvenience. Anything I should do now? |
actually, it is just the name of your new log file that confused me. it should be something more like 'log.22Apr20.tiny_nylon.stabilized_variable_probability.g++.1' to be in line with other examples, where the number at the end is the number of processors |
I wasn't aware of the number at the end. Sorry, should be updated by now and follow the other examples. |
…nylon.stabilized_variable_probability.g++.1
…nylon.stabilized_variable_probability.g++.4
extended this feature to include the Nevery, Rmin, and Rmax keywords, and updated docs |
line 814 seems to be code that hasn't changed recently, are you sure that's what line you mean? i think i did utilize 'implicit conversions' a couple times |
By now I'm back home and did some small tests. Sorry, maybe i was not clear here. I thought that the variable might become "non int" during runtime. Which seems to be not an issue checking the following two examples. One other thing i found: rmin and rmax get their cutsq variables initilized. fraction is the same. nevery gets initilized for the numeric case but not for the variable case. So lines 245ff. should be
in my opinion. initialized nevery in the variable case and shifted the <0 test outside. I think the test for values < 0.0 should be also shifted one level up for rmin and rmax (around lines 270 and 290) |
thanks for looking into this. would it make more sense to round the 'Nevery' variable upward, to allow more wiggle room when defining the variable? regarding your second point, I actually purposely kept the 'sanity checks' out when first reading in the 'Nevery','Rmin','Rmax' variables, in case they were only initialized before bond/react, then modified afterward (as in the example i added to the docs). in the case of Nevery, the sanity check is instead included when Nevery is actually evaluated for use in the code |
since equal style variables are evaluated using double precision floating point math, you need to account for the fact, that certain fractions cannot be represented exactly and thus truncating to an int may give unexpected results and thus doing upward rounding by adding 0.5 might provide a more consistent behavior. |
I wanted to say that I think it would not make a big difference, it just should be documented. But I guess Axel made a point here. could we just round the value? rint( )? http://www.cplusplus.com/reference/cmath/rint/ |
@wverestek one recommendation for future contributions. Please do not use the "master" branch for making changes. Always create a feature branch. The master branch is best left untouched and updated from the master branch of the upstream repository, e.g. through |
@akohlmey Thanks for the hint. @jrgissing pointed that out already. Next time I'll do that |
Summary
modification to fix bond/react to allow equal style variables as probability input
Related Issues
n/a
Author(s)
Wolfgang Verestek, University of Stuttgart
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
Yes
Implementation Notes
Post Submission Checklist
Please check the fields below as they are completed after the pull request has been submitted. Delete lines that don't apply
Further Information, Files, and Links
Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)