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

Spin dependent One body Jastrow factor is needed #3138

Closed
shivupa opened this issue Apr 26, 2021 · 5 comments · Fixed by #3257
Closed

Spin dependent One body Jastrow factor is needed #3138

shivupa opened this issue Apr 26, 2021 · 5 comments · Fixed by #3257
Labels

Comments

@shivupa
Copy link
Contributor

shivupa commented Apr 26, 2021

Describe the bug
When running a calculation with >2 particle types, only the last one body Jastrow factor is optimized. The rest have no values. This seems to be related to #3052

Potential Solution?:
I haven't looked further into this issue yet. It seems similar to the two body issue

To Reproduce
Steps to reproduce the behavior:

  1. b1a4692-dirty
  2. cmake command : cmake -DCMAKE_BUILD_TYPE=Debug ..
  3. qmcpack Li_wpos.qmc.in-wfj.xml
    The files needed to replicate this issue are located here https://gist.github.com/shivupa/9bfc976b35efbfe9b84a64a568197603.

Expected behavior
One body jastrow parameters could be optimized.

System:

  • Workstation Intel i7-2600S

Additional context
During the optimization the parameters do not appear in the optvariables

  <optVariables href="Li_wpos.s005.opt.xml">
 uu_0                -3.865297e-02 1 1  ON 0
 uu_1                -3.432272e-01 1 1  ON 1
 ud_0                -6.051654e-02 1 1  ON 2
 ud_1                 1.829733e-01 1 1  ON 3
 up_0                -4.290780e-01 1 1  ON 4
 up_1                -4.227348e-01 1 1  ON 5
 dd_0                -1.125009e-01 1 1  ON 6
 dd_1                -3.337817e-01 1 1  ON 7
 dp_0                -4.457856e-01 1 1  ON 8
 dp_1                -3.864281e-01 1 1  ON 9
pLi_0                -1.002001e-01 1 1  ON 10
pLi_1                 4.909281e-01 1 1  ON 11
  </optVariables>

but at the start of the output the variables are printed

   Jastrow
   -------
    Name: J2   Type: Two-Body   Function: Bspline

    Radial function for species: u - u
     Number of parameters: 2
     Cusp: -0.25
     Cutoff radius: 10

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     uu_0                -4.394752e-02    1         1  ON     0
     uu_1                -2.293588e-01    1         1  ON     1

    Radial function for species: d - d
     Number of parameters: 2
     Cusp: -0.25
     Cutoff radius: 10

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     dd_0                -5.433334e-02    1         1  ON     0
     dd_1                -1.663821e-01    1         1  ON     1

    Radial function for species: u - d
     Number of parameters: 2
     Cusp: -0.5
     Cutoff radius: 10

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     ud_0                 3.818599e-01    1         1  ON     0
     ud_1                 2.278448e-01    1         1  ON     1

    Radial function for species: u - p
     Number of parameters: 2
     Cusp: 0.5
     Cutoff radius: 10

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     up_0                -9.478729e-01    1         1  ON     0
     up_1                -6.388483e-01    1         1  ON     1

    Radial function for species: d - p
     Number of parameters: 2
     Cusp: 0.5
     Cutoff radius: 10

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     dp_0                -1.008447e+00    1         1  ON     0
     dp_1                -6.491591e-01    1         1  ON     1


   Jastrow
   -------
    Name: J1   Type: One-Body   Function: Bspline

    Radial function for element: Li
     Number of parameters: 2
     Cusp: 0
     Cutoff radius: 10

      Name                        Value Type Recompute Use Index
     ----- ---------------------------- ---- --------- --- -----
     uLi_0                -7.571247e-01    1         1  ON     0
     uLi_1                -5.042248e-01    1         1  ON     1

    Radial function for element: Li
     Number of parameters: 2
     Cusp: 0
     Cutoff radius: 10

      Name                        Value Type Recompute Use Index
     ----- ---------------------------- ---- --------- --- -----
     dLi_0                -7.571247e-01    1         1  ON     0
     dLi_1                -5.042248e-01    1         1  ON     1

    Radial function for element: Li
     Number of parameters: 2
     Cusp: 0
     Cutoff radius: 10

      Name                        Value Type Recompute Use Index
     ----- ---------------------------- ---- --------- --- -----
     pLi_0                -7.571247e-01    1         1  ON     0
     pLi_1                -5.042248e-01    1         1  ON     1
@prckent prckent added the bug label May 3, 2021
@shivupa
Copy link
Contributor Author

shivupa commented May 17, 2021

An update This is reproducible in the electron only case:
I used tests/molecules/H2_ae as an example
I made two changes: turned orbital optimization off and changed J1 to

    <jastrow name="J1" type="One-Body" function="Bspline" source="ion0" print="yes" spin="yes">
      <correlation rcut="2" size="10" cusp="0" speciesA="H" speciesB="u">
        <coefficients id="eu" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
      </correlation>
      <correlation rcut="2" size="10" cusp="0" speciesA="H" speciesB="d">
        <coefficients id="ed" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
      </correlation>
    </jastrow>

The resulting output:

   Jastrow
   -------
    Name: J1   Type: One-Body   Function: Bspline

    Radial function for element: H
     Number of parameters: 10
     Cusp: 0
     Cutoff radius: 2

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     eu_0                 0.000000e+00    1         1  ON     0
     eu_1                 0.000000e+00    1         1  ON     1
     eu_2                 0.000000e+00    1         1  ON     2
     eu_3                 0.000000e+00    1         1  ON     3
     eu_4                 0.000000e+00    1         1  ON     4
     eu_5                 0.000000e+00    1         1  ON     5
     eu_6                 0.000000e+00    1         1  ON     6
     eu_7                 0.000000e+00    1         1  ON     7
     eu_8                 0.000000e+00    1         1  ON     8
     eu_9                 0.000000e+00    1         1  ON     9

    Radial function for element: H
     Number of parameters: 10
     Cusp: 0
     Cutoff radius: 2

     Name                        Value Type Recompute Use Index
     ---- ---------------------------- ---- --------- --- -----
     ed_0                 0.000000e+00    1         1  ON     0
     ed_1                 0.000000e+00    1         1  ON     1
     ed_2                 0.000000e+00    1         1  ON     2
     ed_3                 0.000000e+00    1         1  ON     3
     ed_4                 0.000000e+00    1         1  ON     4
     ed_5                 0.000000e+00    1         1  ON     5
     ed_6                 0.000000e+00    1         1  ON     6
     ed_7                 0.000000e+00    1         1  ON     7
     ed_8                 0.000000e+00    1         1  ON     8
     ed_9                 0.000000e+00    1         1  ON     9

and

  <optVariables href="H2.s000.opt.xml">
ud_0                 1.695165e-01 1 1  ON 0
ud_1                 1.327967e-01 1 1  ON 1
ud_2                 9.829516e-02 1 1  ON 2
ud_3                 7.300552e-02 1 1  ON 3
ud_4                 5.071529e-02 1 1  ON 4
ud_5                 3.322423e-02 1 1  ON 5
ud_6                 2.079996e-02 1 1  ON 6
ud_7                 1.178769e-02 1 1  ON 7
ud_8                 5.648976e-03 1 1  ON 8
ud_9                 1.927845e-03 1 1  ON 9
ed_0                 3.796031e-02 1 1  ON 10
ed_1                 3.508334e-02 1 1  ON 11
ed_2                 3.469578e-02 1 1  ON 12
ed_3                 2.923949e-02 1 1  ON 13
ed_4                 2.138106e-02 1 1  ON 14
ed_5                 1.859484e-02 1 1  ON 15
ed_6                 1.453544e-02 1 1  ON 16
ed_7                 9.424226e-03 1 1  ON 17
ed_8                 4.841556e-03 1 1  ON 18
ed_9                 1.552929e-03 1 1  ON 19
  </optVariables>

and the .opt.xml

    <jastrow name="J1" type="One-Body" function="Bspline" source="ion0" print="yes" spin="yes">
      <correlation rcut="2" size="10" cusp="0" speciesA="H" speciesB="u">
        <coefficients id="eu" type="Array"></coefficients>
      </correlation>
      <correlation rcut="2" size="10" cusp="0" speciesA="H" speciesB="d">
        <coefficients id="ed" type="Array"> 0.01147619069 0.01681526524 0.02080846333 0.01785597558 0.01113696016 0.01064076615 0.008437624012 0.004219646343 0.0008331732195 -0.0006849097492</coefficients>
      </correlation>
    </jastrow>

@jtkrogel
Copy link
Contributor

Both sets of J1 coefficients have the same id (eH). Try labeling them differently, e.g. eHu and eHd.

@shivupa
Copy link
Contributor Author

shivupa commented May 17, 2021

Sorry updated the comment!

@shivupa
Copy link
Contributor Author

shivupa commented May 17, 2021

I am working on a PR for this. The issue is the J1 F vector is the wrong size and the addFunc code for the J1OrbitalSoA.h and DiffOneBodyJastrowOrbital.h don't take into account the target type. In my mind these should resemble their two body counter parts, but instead of mapping between NumGroups x NumGroups it should be Nions x NumGroups.

For reference I am thinking this becauseaddFunc in DiffOneBodyJastrowOrbital.h and J1OrbitalSoA.h seem to ignore the target_type.

@ye-luo
Copy link
Contributor

ye-luo commented May 17, 2021

It is not about having more than 2 species in target ParticleSet but the currently J1SoA implemention is target particle spin agnostic.
We did have a spin resolved J1 but it was deleted as part of AoS removal and we need to expand the current one to support target particle types. You can copy the current J1 to J1Spin and then expand it to target particle groups. I believe can replace the current spin agnostic one eventually but please start out-of-place.

@shivupa shivupa changed the title One body Jastrow optimization issue when there are more than 2 particle types Spin dependent One body Jastrow factor is needed May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants