Skip to content
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

qmc-fit: Add parameter fitting with jackknife for e.g. DFT+U, EXX scans #4475

Merged
merged 13 commits into from
Mar 2, 2023

Conversation

kayahans
Copy link
Contributor

@kayahans kayahans commented Feb 21, 2023

Proposed changes

Hubbard U/exact exchange ratio parameter fitting capability is added to qmc-fit. Fits can be performed up to including 4th order polynomials using jackknife. To demonstrate use cases, I have used some of my own data as below. Minima is only printed out if the x value is within the range ([0,5] for examples below).

qmc-fit u -u "0 1 2 3 4 5" -f quadratic dmc_u_*/dmc.s001.scalar.dat

fit function : quadratic
fitted formula: (-1230.1084 +/- 0.0054) + (-0.0668 +/- 0.0050)*t + (0.00867 +/- 0.00093)*t^2
root 1 minimum_u : 3.85 +/- 0.15
root 1 minimum_e : -1230.2369 +/- 0.0027

qmc-fit u -u "0 1 2 3 4 5" -f cubic dmc_u_*/dmc.s001.scalar.dat

fit function : cubic
fitted formula: (-1230.1085 +/- 0.0057) + (-0.066 +/- 0.011)*t + (0.0083 +/- 0.0056)*t^2 + (0.00004 +/- 0.00071)*t^3
root 1 minimum_u : 3.87 +/- 0.14
root 1 minimum_e : -1230.2376 +/- 0.0044
root 1 curvature : 0.0176 +/- 0.0057

qmc-fit u -u "0 1 2 3 4 5" -f quartic dmc_u_*/dmc.s001.scalar.dat

fit function : quartic
fitted formula: (-1230.1105 +/- 0.0052) + (-0.0215 +/- 0.0057)*t + (-0.0419 +/- 0.0013)*t^2 + (0.01684 +/- 0.00068)*t^3 + (-0.00171 +/- 0.00013)*t^4
root 1 minimum_u : 3.09 +/- 0.12 eV
root 1 minimum_e : -1230.2360 +/- 0.0042 Ha
root 1 curvature : 0.0326 +/- 0.0033

Also close #4479

What type(s) of changes does this code introduce?

  • New feature

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

macOS Monterey 12.6.3, Python 3.9.13

Checklist

Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.

  • Yes. This PR is up to date with current the current state of 'develop'
  • No. Code added or changed in the PR has been clang-formatted
  • No. This PR adds tests to cover any new code, or to catch a bug that is being fixed
  • No. Documentation has been added (if appropriate)

@prckent prckent self-requested a review February 21, 2023 16:06
Copy link
Contributor

@prckent prckent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prckent prckent changed the title Hubbard U parameter fitting with jackknife qmc-fit: Add parameter fitting with jackknife for e.g. DFT+U, EXX scans Feb 21, 2023
prckent
prckent previously approved these changes Feb 23, 2023
prckent
prckent previously approved these changes Feb 23, 2023
Copy link
Contributor

@prckent prckent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught some rst problems. It is worth checking the readthedocs preview.

@ye-luo
Copy link
Contributor

ye-luo commented Feb 23, 2023

Is there an error trap if u is requested but -u option is not used.

@ye-luo
Copy link
Contributor

ye-luo commented Feb 23, 2023

Just noticed
#4479
added the issue to be addressed in the future.

@prckent
Copy link
Contributor

prckent commented Feb 23, 2023

Test this please

@prckent
Copy link
Contributor

prckent commented Feb 23, 2023

Disabled auto merge since Ye's question has not been answered.

@kayahans
Copy link
Contributor Author

I have made a more recent commit improving the concerns that Ye raised. This commit removes the duplicate optparsers in both timestep and u fit functions and uses argparse instead. Optparse has deprecated and its website recommends that argparse is used instead (https://docs.python.org/3/library/optparse.html). In this commit some additional help comments are added hopefully can address #4479.

U requested -u trap that Ye mentions is also added in this commit. In argparse, either -t, -u or --exx must be defined and within timestep_fit() or hubbard_u_fit() the existence of the relevant options are checked as well.

@ye-luo
Copy link
Contributor

ye-luo commented Feb 23, 2023

@kayahans could you take a look at the test ntest_nexus_qmc_fit failure?

@kayahans
Copy link
Contributor Author

Sorry it took me a while to get back to this. I ran "ctest -R nexus" under build directory and got no errors on my end. The build I have is current with my qmcfit branch on my qmcpack fork which has the "updated argparse" as its latest commit.
nexus_tests.txt

@prckent
Copy link
Contributor

prckent commented Feb 28, 2023

Test this please

@prckent
Copy link
Contributor

prckent commented Feb 28, 2023

Running the self-hosted CI to get more info on the failures.

@ye-luo
Copy link
Contributor

ye-luo commented Mar 1, 2023

@kayahans could you share your cmake? I'm afraid that due to python module difference, only a subset of tests were run on your machine compared to CI.

@kayahans
Copy link
Contributor Author

kayahans commented Mar 1, 2023

I have found that the error is related to the default timestep fit function. In the nexus test, the default option is used (which was linear). I have modified the /nexus/tests/unit/test_qmc_fit.py that the fitting function is defined explicitly as 'linear' now. I have changed the default fitting function in qmc-fit.py to be 'linear' it was 'quadratic' in the previous commit, which also lead to the failures.

@kayahans
Copy link
Contributor Author

kayahans commented Mar 2, 2023

@ye-luo I am guessing that you are asking this CMakeCache.txt file. Please let me know if you would like to see something else. CMakeCache.txt

@ye-luo
Copy link
Contributor

ye-luo commented Mar 2, 2023

@ye-luo I am guessing that you are asking this CMakeCache.txt file. Please let me know if you would like to see something else. CMakeCache.txt

Sorry that I didn't give a clear request. I was asking for cmake printout but it is not needed any more as you figured out the failure.

@ye-luo
Copy link
Contributor

ye-luo commented Mar 2, 2023

Test this please

@ye-luo ye-luo enabled auto-merge March 2, 2023 05:04
@ye-luo ye-luo merged commit 56e2f6c into QMCPACK:develop Mar 2, 2023
@prckent prckent mentioned this pull request Aug 18, 2023
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.

qmc-fit doesn't have a clean help option
3 participants