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

Nexus: Add qdens-radial tool #3587

Merged
merged 16 commits into from
Nov 5, 2021
Merged

Conversation

mcbennet
Copy link
Contributor

@mcbennet mcbennet commented Nov 4, 2021

Proposed changes

This PR introduces the tool qdens-radial (name negotiable) into the Nexus collection of binaries. The tool calculates radial densities (or their integrals) around atomic sites given .xsf files containing density/spin-density data (tested for QE- and QMCPACK-generated densities). Key functionalities include:

  1. QE and QMCPACK radial densities at user-provided radiii (cumulative or non-cummulative).
  2. Plotting of atomic radial densities
  3. Mixed-estimator bias extrapolation if VMC and DMC .xsf files are provided.
  4. Resampling to obtain error bars on computed quantities if +err files are provided.
  5. Quantities can be calculated for a subset of species (list provided by user) and species-specific radii can be used (list provided by user)

A usage is provided that describes how the tool is run:

Usage: qdens-radial [options] xsf_file

Options:
  --version             show program's version number and exit
  -h, --help            Print help information and exit (default=False).
  -v, --verbose         Print detailed information (default=False).
  -R RADII, --radii=RADII
                        List of cutoff radii (default=None).
  -S SPECIES, --species=SPECIES
                        List of species (default=None).
  -s SOURCE, --source=SOURCE
                        Source that generated the .xsf file. Options: "pwscf",
                        "qmcpack" (default=qmcpack).
  -c, --cumulative      Evaluate cumulative radial density at cutoff radii
                        (default=False).
  -V VMC_FILE, --vmc_file=VMC_FILE
                        Location of VMC to be used for extrapolating mixed-
                        estimator bias (default=None).
  --vmc_err_file=VMC_ERR_FILE
                        Location of VMC+err to be used for extrapolating
                        mixed-estimator bias and resampling (default=None).
  --dmc_err_file=DMC_ERR_FILE
                        Location of DMC+err to be used for resampling
                        (default=None).
  -n NSAMPLES, --nsamples=NSAMPLES
                        Number of samples for resampling (default=10).
  -p, --plot            Show plots interactively (default=False).

Documentation should be added if this is merged. I can create an issue and assign myself and resolve it promptly after my workshop presentation.

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

  • New feature

Does this introduce a breaking change?

  • No. nxs-test tests pass (I checked since I modified nexus/lib/observables.py slightly)

What systems has this change been tested on?

Linux workstation

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'
  • N/A. 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)

@mcbennet mcbennet changed the title Nxs qdens radial Nexus: Add qdens-radial tool Nov 4, 2021
@qmc-robot
Copy link

Can one of the admins verify this patch?

@mcbennet
Copy link
Contributor Author

mcbennet commented Nov 4, 2021

I plan to use this tool for my workshop labs. It would be ideal if it could be merged prior, if there are no issues.

@prckent prckent requested a review from jtkrogel November 4, 2021 18:12
Copy link
Contributor

@jtkrogel jtkrogel left a comment

Choose a reason for hiding this comment

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

Please address comments below. Would be good to get a test + short manual entry for this, but this can wait until after the workshop session if time is tight.

nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
nexus/bin/qdens-radial Show resolved Hide resolved
nexus/bin/qdens-radial Outdated Show resolved Hide resolved
equiv_atoms = list(cd.info.structure.equivalent_atoms().keys())

if opt.species is not None and not set(opt.species).issubset(equiv_atoms):
self.error('Input species (-S,--species) must be a subset of the species in the .xsf file.\nThe .xsf contains: {}\nYou provided: {}.'.format(equiv_atoms,opt.species.tolist()))
Copy link
Contributor

Choose a reason for hiding this comment

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

-s

nexus/bin/qdens-radial Outdated Show resolved Hide resolved
@jtkrogel
Copy link
Contributor

jtkrogel commented Nov 5, 2021

@mcbennet, just a couple more flag name find/replace and then this can go in.

@mcbennet
Copy link
Contributor Author

mcbennet commented Nov 5, 2021

Thank you, @jtkrogel . I have addressed your latest comments

Copy link
Contributor

@jtkrogel jtkrogel left a comment

Choose a reason for hiding this comment

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

LGTM

@prckent
Copy link
Contributor

prckent commented Nov 5, 2021

Test this please

@prckent
Copy link
Contributor

prckent commented Nov 5, 2021

Start testing in-house

@ye-luo ye-luo enabled auto-merge November 5, 2021 15:09
@ye-luo ye-luo merged commit 7d3ba39 into QMCPACK:develop Nov 5, 2021
@mcbennet mcbennet deleted the nxs-qdens-radial branch November 5, 2021 15:52
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.

5 participants