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

more explanation about energy density #2163

Closed
kryczko opened this issue Dec 18, 2019 · 18 comments
Closed

more explanation about energy density #2163

kryczko opened this issue Dec 18, 2019 · 18 comments
Labels

Comments

@kryczko
Copy link
Contributor

kryczko commented Dec 18, 2019

From reading the manual, it seems like one can compute the energy density of a system using qmcpack. I have a system with 8 electrons in an external potential, therefore no ions.

  1. Can I still use the energy density estimator?
  2. Where is the energy density stored in the HDF5 file? I have tried looking through it using h5py, but I don't understand how it is written.

Kevin

@jtkrogel
Copy link
Contributor

You should be able to use the energy density estimator without any ions, though some plumbing would need to be added to support the external potential.

Currently, the estimator is broken (see #982) but I am currently working to restore it (#2156 was a step toward this). If you will provide a working set of input files for your use case, I will try give it a look as I switch the lights back on.

@kryczko
Copy link
Contributor Author

kryczko commented Dec 18, 2019

This is the input file I am currently working with. I am using a fork of qmcpack, where I can read in a potential on a grid. I am also reading in SPOs from qbox.

<simulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.mcc.uiuc.edu/qmc/schema/molecu.xsd">
  <project id="qmc" series="0">
    <application class="serial" name="qmcapp" role="molecu" version="0.2">
      QMC calc after running in QBox
    </application>
  </project>

  <random seed="13" />
  <qmcsystem>


  <simulationcell>
    <parameter name="lattice">20.470000 0 0 
 0 20.470000 0 
 0 0 20.470000
</parameter>
      <parameter name="bconds">p p p</parameter>
      <parameter name="LR_dim_cutoff">15</parameter>
  </simulationcell>
  </qmcsystem>


  <particleset name="e" random="yes">
    <group name="u" size="4">
      <parameter name="charge">-1</parameter>
    </group>
    <group name="d" size="4">
      <parameter name="charge">-1</parameter>
    </group>
  </particleset>

  <wavefunction name="psi0" target="e">
    
    <determinantset href="wfs.h5" meshfactor="1.0" precision="single" source="e" type="einspline">

      <slaterdeterminant>
        <determinant id="updet" ref="updet" size="4">
          <occupation mode="ground" spindataset="0">
          </occupation>
        </determinant>
        <determinant id="downdet" ref="downdet" size="4">
          <occupation mode="ground" spindataset="0">
          </occupation>
        </determinant>
      </slaterdeterminant>

    </determinantset>

    <jastrow function="Bspline" name="J2" print="yes" type="Two-Body">
      
      <correlation rcut="5.0" size="8" speciesA="u" speciesB="u">
        <coefficients id="uu" type="Array"> 0.2309049836 0.1850005701 0.1312646071 0.08898145999 0.05464141356 0.02995184802 0.01306231516 0.00515269778</coefficients>
      </correlation>

      <correlation rcut="5.0" size="8" speciesA="u" speciesB="d">
        <coefficients id="ud" type="Array"> 0.4351561096 0.3247203462 0.2377951747 0.1683859417 0.1129144262 0.06948677091 0.0356789236 0.01593059439</coefficients>
      </correlation>
    </jastrow>

  </wavefunction>


  <hamiltonian name="h0" target="e" type="generic">
    <extpot dataset_name="vext" end="10.235" file_name="qmcpack_pot.h5" name="vext" num="88" pbc="true" start="-10.235" type="grid" /> 
    <pairpot name="ElecElec" physical="true" source="e" target="e" type="coulomb" />
    <estimator name="gr" num_bin="200" rmax="9.712825" type="gofr" />  
    <estimator delta="0.015625 0.015625 0.015625" name="density" type="density" /> 
    <estimator type="EnergyDensity" name="edens" dynamic="e">
	    <spacegrid coord="cartesian">
		    <origin p1="zero" />
	            <axis p1="a1" label="x" grid="0 (0.0625) 1" />
		    <axis p1="a2" label="y" grid="0 (0.0625) 1" />
		    <axis p1="a3" label="z" grid="0 (0.0625) 1" />
	    </spacegrid>
    </estimator>
  </hamiltonian>


<loop max="16">
  <qmc method="linear" move="pbyp">
  <parameter name="samples"> 1000 </parameter>
  <parameter name="stepsbetweensamples"> 1</parameter>
  <parameter name="substeps"> 1 </parameter>
  <parameter name="warmupSteps"> 1 </parameter>
  <parameter name="blocks"> 10 </parameter>
  <parameter name="timestep"> 5.0 </parameter>
  <parameter name="usedrift"> no </parameter>
  <estimator hdf5="no" name="LocalEnergy" />
  <parameter name="minwalkers"> 0.3 </parameter>
  <cost name="energy"> 0.95 </cost>
  <cost name="unreweightedvariance"> 0.00 </cost>
  <cost name="reweightedvariance"> 0.05 </cost>
  
  <parameter name="MinMethod"> OneShiftOnly </parameter>
  </qmc>
</loop>

</simulation>

@jtkrogel
Copy link
Contributor

Is it possible/advisable to merge your fork into mainline via a PR? How large is wfs.h5?

@kryczko
Copy link
Contributor Author

kryczko commented Dec 18, 2019

I have verified that this feature works in the case of a SHO in periodic boundary conditions but I have not done extensive testing of this feature, and the wfs.h5 file is 43 MB.

@jtkrogel
Copy link
Contributor

I only ask because it would make it easier to ensure that the restored estimator works in your case. How would you prefer to proceed?

@kryczko
Copy link
Contributor Author

kryczko commented Dec 18, 2019

I could create a PR for my fork. That way the plumbing can be done to include an external potential in the energy density estimator.

@jtkrogel
Copy link
Contributor

Sounds good. I will look for your PR.

@kryczko
Copy link
Contributor Author

kryczko commented Jan 8, 2020

Hi @jtkrogel, I'm not sure if you have seen, but I have a pull request that is close to being finished :-)

@jtkrogel
Copy link
Contributor

jtkrogel commented Jan 8, 2020

Great. Please upload a working set of files here once it is in so I can ensure your case works with the eventual energy density fix.

@kryczko
Copy link
Contributor Author

kryczko commented Jan 15, 2020

So the PR has gone through, but there is another issue now that I have opened with reading in QBox info when there are no ions in the system. To work around this I modified line 133 of qmcpack/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp to have the following:

    for (int i = 0; i < IonPos.size(); i++)

I have opened another issue for it, and there may be a better solution. In saying that, everything seems OK to me from what I have seen, and this is an orthogonal issue. Here is a link to the files: https://drive.google.com/file/d/16PJvYmL3bShneQubkgmFWy7HlReM-B9L/view?usp=sharing

In the Hamiltonian section you just need to add:

    <estimator type="EnergyDensity" name="edens" dynamic="e">
            <spacegrid coord="cartesian">
                    <origin p1="zero" />
                    <axis p1="a1" label="x" grid="0 (0.0625) 1" />
                    <axis p1="a2" label="y" grid="0 (0.0625) 1" />
                    <axis p1="a3" label="z" grid="0 (0.0625) 1" />
            </spacegrid>
    </estimator>

@kryczko
Copy link
Contributor Author

kryczko commented Jan 21, 2020

I have added another PR to fix the no ion issue. Any updates on your end?

@jtkrogel
Copy link
Contributor

Sorry, no updates yet. I've been progressing slowly on this due to work on #2105.

@kryczko
Copy link
Contributor Author

kryczko commented Jan 31, 2020

No problem, let me know when you get some time to check it out. If there is anything I could do to get started you could let me know! A PR went through to allow for an empty ions particle set, so now I have that working natively with an external potential. Basically, in the input file you must define:

  <particleset name="empty" random="no">
      <group name="u" size="0">
      <parameter name="charge">0</parameter>
    </group>
  </particleset>

followed by

    <determinantset href="wfs.h5" meshfactor="1.0" precision="single" type="einspline" source="empty">

and everything should work.

@kryczko
Copy link
Contributor Author

kryczko commented Feb 18, 2020

Any updates yet? Is there a reason why the energy density wouldn't work with a new potential?

@jtkrogel
Copy link
Contributor

It is mainly a data routing issue. Right now the energy density does not work with any potential, see #982. It will take some time to fix. Due to a mix of work items, I may not be able to get to this before midsummer.

@kryczko
Copy link
Contributor Author

kryczko commented Feb 18, 2020

do you know of anyone else who can look into it?

@kryczko
Copy link
Contributor Author

kryczko commented Mar 9, 2020

@markdewing could you possibly help out here?

@jtkrogel
Copy link
Contributor

The energy density now works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants