Skip to content

Fix 1417 again#1419

Merged
GiovanniBussi merged 4 commits into
v2.10from
fix-1417-gat
May 20, 2026
Merged

Fix 1417 again#1419
GiovanniBussi merged 4 commits into
v2.10from
fix-1417-gat

Conversation

@gtribello
Copy link
Copy Markdown
Member

Description

@GiovanniBussi I think this should fix isssue #1417. I took your original fix kept the first two commits so kept your test. I removed the third commit that had the changes to the code, as they were not fixing the problem. I thus closed your PR and replaced it with this one.

The way the code was working (and why it was not doing what was expected) was as follows:

  1. You get a pointer containing the timestep from PLUMED and set a PLMD::Value equal to the timestep.
  2. When you set the PLMD::Value you do all the schenanigans with the float to double conversion.
  3. You then update the units, which resets the value of the PLMD::Value to the value from the MD code (multiplied by the conversion factor), so all the schenanigans that were done are lost.

I have changed it so in point 3, you multiply the quantity stored in the PLMD::Value by the conversion factor, so it should work now. Note that this resetting of the units is performed only if you pass a quantity that is fixed throughout the simulation and set before the MD loop starts.

Target release

I would like my code to appear in release 2.10

Type of contribution
  • changes to code or doc authored by PLUMED developers, or additions of code in the core or within the default modules
  • changes to a module not authored by you
  • new module contribution or edit of a module authored by you
Copyright
  • I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
  • the module I added or modified contains a COPYRIGHT file with the correct license information. Code should be released under an open source license. I also used the command cd src && ./header.sh mymodulename in order to make sure the headers of the module are correct.
Tests
  • I added a new regtest or modified an existing regtest to validate my changes.
  • I verified that all regtests are passed successfully on GitHub Actions.

GiovanniBussi and others added 3 commits May 19, 2026 16:57
Timestep was passed correctly with code for dealing with rounding error when converting float to double.
When updating unit, however, the timestep is reset using the data that was pssed from the MD code.  This
has now been changed so you use the value of the timestep that was set in PLUMED.
@gtribello
Copy link
Copy Markdown
Member Author

Spoke too soon. Let me investigate.

@gtribello
Copy link
Copy Markdown
Member Author

OK, @GiovanniBussi, I hope this should be a better fix. The only thing is that I now also do the same thing that is done with the timestep when you transfer the value of k_B T. It is probably less critical in that case, but making that change is hopefully harmless.

Not sure why codecheck is failing. It looks like it is not able to download something or other, and that it is not because of a change I have made.

@GiovanniBussi
Copy link
Copy Markdown
Member

Yes I agree this solution is better (and cleaner)

@gtribello
Copy link
Copy Markdown
Member Author

Do you understand what has gone wrong with code check?

@GiovanniBussi
Copy link
Copy Markdown
Member

Do you understand what has gone wrong with code check?

There has been a glitch in the ftp download of autoconf, it seems to be working now. Maybe you can wait for this test to run

@gtribello
Copy link
Copy Markdown
Member Author

OK will do. If this all passes then I will merge. OK?

@GiovanniBussi
Copy link
Copy Markdown
Member

Yes thanks!

@GiovanniBussi GiovanniBussi merged commit c237173 into v2.10 May 20, 2026
62 of 64 checks passed
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.

3 participants