Skip to content

Commit 0eb14d0

Browse files
authored
Merge branch 'develop' into eden_agreement_hamiltonian_changes
2 parents 8fcf244 + b6d3074 commit 0eb14d0

128 files changed

Lines changed: 2324 additions & 3599 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/hamiltonianobservable.rst

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ density (``density``), number density resolved by particle spin
509509
(``gofr``), static structure factor (``sk``), static structure factor
510510
(``skall``), energy density (``energydensity``), one body reduced
511511
density matrix (``dm1b``), :math:`S(k)` based kinetic energy correction
512-
(``chiesa``), forward walking (``ForwardWalking``), and force
512+
(``chiesa``), and force
513513
(``Force``) estimators. Other estimators are not yet covered.
514514

515515
When an ``<estimator/>`` element appears in ``<hamiltonian/>``, it is
@@ -555,8 +555,6 @@ section (e.g., during VMC only).
555555
+------------------+------------------+-----------------------------------------------------------+
556556
| | Force | Family of "force" estimators (see :ref:`ccz-force-est`) |
557557
+------------------+------------------+-----------------------------------------------------------+
558-
| | ForwardWalking | Forward walking values for existing estimators |
559-
+------------------+------------------+-----------------------------------------------------------+
560558
| | orbitalimages | Create image files for orbitals, then exit |
561559
+------------------+------------------+-----------------------------------------------------------+
562560
| | flux | Checks sampling of kinetic energy |
@@ -1920,90 +1918,6 @@ Additional information:
19201918
<sposet type="bspline" name="dm_basis" size="50" spindataset="0"/>
19211919
</sposet_builder>
19221920
1923-
.. _forward-walking:
1924-
1925-
Forward-Walking Estimators
1926-
--------------------------
1927-
1928-
Forward walking is a method for sampling the pure fixed-node
1929-
distribution :math:`\langle \Phi_0 | \Phi_0\rangle`. Specifically, one
1930-
multiplies each walker’s DMC mixed estimate for the observable
1931-
:math:`\mathcal{O}`,
1932-
:math:`\frac{\mathcal{O}(\mathbf{R})\Psi_T(\mathbf{R})}{\Psi_T(\mathbf{R})}`,
1933-
by the weighting factor
1934-
:math:`\frac{\Phi_0(\mathbf{R})}{\Psi_T(\mathbf{R})}`. As it turns out,
1935-
this weighting factor for any walker :math:`\mathbf{R}` is proportional
1936-
to the total number of descendants the walker will have after a
1937-
sufficiently long projection time :math:`\beta`.
1938-
1939-
To forward walk on an observable, declare a generic forward-walking
1940-
estimator within a ``<hamiltonian>`` block, and then specify the
1941-
observables to forward walk on and the forward-walking parameters. Here
1942-
is a summary.
1943-
1944-
``estimator type=ForwardWalking`` element:
1945-
1946-
+------------------+----------------------+
1947-
| parent elements: | ``hamiltonian, qmc`` |
1948-
+------------------+----------------------+
1949-
| child elements: | ``Observable`` |
1950-
+------------------+----------------------+
1951-
1952-
attributes:
1953-
1954-
+---------------------+--------------+--------------------+-------------+---------------------------+
1955-
| **Name** | **Datatype** | **Values** | **Default** | **Description** |
1956-
+=====================+==============+====================+=============+===========================+
1957-
| ``type``:math:`^r` | text | **ForwardWalking** | | Must be "ForwardWalking" |
1958-
+---------------------+--------------+--------------------+-------------+---------------------------+
1959-
| ``name``:math:`^r` | text | *anything* | any | Unique name for estimator |
1960-
+---------------------+--------------+--------------------+-------------+---------------------------+
1961-
1962-
``Observable`` element:
1963-
1964-
+------------------+---------------------------------+
1965-
| parent elements: | ``estimator, hamiltonian, qmc`` |
1966-
+------------------+---------------------------------+
1967-
| child elements: | *None* |
1968-
+------------------+---------------------------------+
1969-
1970-
+--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1971-
| **Name** | **Datatype** | **Values** | **Default** | **Description** |
1972-
+==========================+==============+===============+=============+=================================================================================+
1973-
| ``name``:math:`^r` | text | *anything* | any | Registered name of existing estimator on which to forward walk |
1974-
+--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1975-
| ``max``:math:`^r` | integer | :math:`>0` | | Maximum projection time in steps (``max``:math:`=\beta/\tau`) |
1976-
+--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1977-
| ``frequency``:math:`^r` | text | :math:`\geq 1`| | Dump data only for every ``frequency``-th to ``scalar.dat`` file |
1978-
+--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1979-
1980-
Additional information:
1981-
1982-
- **Cost**: Because histories of observables up to ``max`` time steps
1983-
have to be stored, the memory cost of storing the nonforward-walked
1984-
observables variables should be multiplied by :math:`\texttt{max}`.
1985-
Although this is not an issue for items such as potential energy, it
1986-
could be prohibitive for observables such as density, forces, etc.
1987-
1988-
- **Naming Convention**: Forward-walked observables are automatically
1989-
named ``FWE_name_i``, where ``i`` is the forward-walked expectation
1990-
value at time step ``i``, and ``name`` is whatever name appears in
1991-
the ``<Observable>`` block. This is also how it will appear in the
1992-
``scalar.dat`` file.
1993-
1994-
In the following example case, QMCPACK forward walks on the potential
1995-
energy for 300 time steps and dumps the forward-walked value at every
1996-
time step.
1997-
1998-
.. code-block::
1999-
:caption: Forward-walking estimator element.
2000-
:name: Listing 42
2001-
2002-
<estimator name="fw" type="ForwardWalking">
2003-
<Observable name="LocalPotential" max="300" frequency="1"/>
2004-
<!--- Additional Observable blocks go here -->
2005-
</estimator>
2006-
20071921
.. _ccz-force-est:
20081922

20091923
Chiesa-Ceperley-Zhang Force Estimators

docs/lab_qmc_basics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ Container types: ``tuple, list, array, dict, obj``
13561356
::
13571357

13581358
from numpy import array # get array from numpy module
1359-
from generic import obj # get obj from Nexus' generic module
1359+
from developer import obj # get obj from Nexus' developer module
13601360

13611361
t=('A',42,56,123.0) # tuple
13621362

@@ -1461,7 +1461,7 @@ Iteration: ``for``
14611461

14621462
::
14631463

1464-
from generic import obj
1464+
from developer import obj
14651465

14661466
l = [1,2,3]
14671467
m = [4,5,6]

labs/lab2_qmc_basics/oxygen_atom/ip_conv.py

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
import sys
55
from subprocess import Popen,PIPE
66
from numpy import array,sqrt,polyfit,polyval,linspace
7-
from generic import obj
8-
from plotting import *
7+
from developer import obj
8+
import matplotlib.pyplot as plt
99

1010
params = {'legend.fontsize':14,'figure.facecolor':'white','figure.subplot.hspace':0.6,
11-
'axes.labelsize':16,'xtick.labelsize':14,'ytick.labelsize':14}
12-
rcParams.update(params)
13-
11+
'axes.labelsize':16,'xtick.labelsize':14,'ytick.labelsize':14}
12+
plt.rcParams.update(params)
1413

1514
#files = sys.argv[1:]
1615

@@ -119,29 +118,29 @@
119118
print()
120119
print()
121120

122-
figure()
123-
errorbar(q0.timesteps,q0.energies,q0.errs,fmt='b.',label='q0')
124-
plot(tfit,q0fit,'k--',lw=2)
125-
title('Oxygen q=0 total energy vs. timestep')
126-
ylabel('Total energy (eV)')
127-
xlabel('timestep (1/Ha)')
128-
legend()
129-
130-
figure()
131-
errorbar(q1.timesteps,q1.energies,q1.errs,fmt='b.',label='q1')
132-
plot(tfit,q1fit,'k--',lw=2)
133-
title('Oxygen q=1 total energy vs. timestep')
134-
ylabel('Total energy (eV)')
135-
xlabel('timestep (1/Ha)')
136-
legend()
137-
138-
figure()
139-
errorbar(ts,ip,iperr,fmt='r.',label='1st IP')
140-
plot(tfit,ipfit,'g--',lw=2)
141-
title('Oxygen 1st IP vs. timestep')
142-
ylabel('IP (eV)')
143-
xlabel('timestep (1/Ha)')
144-
legend()
145-
146-
show()
121+
plt.figure()
122+
plt.errorbar(q0.timesteps,q0.energies,q0.errs,fmt='b.',label='q0')
123+
plt.plot(tfit,q0fit,'k--',lw=2)
124+
plt.title('Oxygen q=0 total energy vs. timestep')
125+
plt.ylabel('Total energy (eV)')
126+
plt.xlabel('timestep (1/Ha)')
127+
plt.legend()
128+
129+
plt.figure()
130+
plt.errorbar(q1.timesteps,q1.energies,q1.errs,fmt='b.',label='q1')
131+
plt.plot(tfit,q1fit,'k--',lw=2)
132+
plt.title('Oxygen q=1 total energy vs. timestep')
133+
plt.ylabel('Total energy (eV)')
134+
plt.xlabel('timestep (1/Ha)')
135+
plt.legend()
136+
137+
plt.figure()
138+
plt.errorbar(ts,ip,iperr,fmt='r.',label='1st IP')
139+
plt.plot(tfit,ipfit,'g--',lw=2)
140+
plt.title('Oxygen 1st IP vs. timestep')
141+
plt.ylabel('IP (eV)')
142+
plt.xlabel('timestep (1/Ha)')
143+
plt.legend()
144+
145+
plt.show()
147146
#end if

labs/lab2_qmc_basics/oxygen_atom/reference/ip_conv.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import sys
55
from subprocess import Popen,PIPE
66
from numpy import array,sqrt,polyfit,polyval,linspace
7-
from generic import obj
8-
from plotting import *
7+
from developer import obj
8+
import matplotlib.pyplot as plt
99

1010
params = {'legend.fontsize':14,'figure.facecolor':'white','figure.subplot.hspace':0.6,
1111
'axes.labelsize':16,'xtick.labelsize':14,'ytick.labelsize':14}
12-
rcParams.update(params)
12+
plt.rcParams.update(params)
1313

1414

1515
#files = sys.argv[1:]
@@ -20,7 +20,7 @@
2020
res = obj()
2121
for file in files:
2222
if not os.path.exists(file):
23-
print 'file '+file+' does not exist'
23+
print('file '+file+' does not exist')
2424
exit()
2525
#end if
2626
prefix = None
@@ -89,59 +89,59 @@
8989
ipfit = polyval(polyfit(ts,ip,1),tfit)
9090

9191

92-
print
93-
print
94-
print 'Total energy (q=0, eV)'
92+
print()
93+
print()
94+
print('Total energy (q=0, eV)')
9595
for i in range(len(ts)):
96-
print ' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],q0.energies[i],q0.errs[i])
96+
print(' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],q0.energies[i],q0.errs[i]))
9797
#end for
98-
print '----------------------------------'
99-
print ' {0:<6.4f} {1:<6.4f}'.format(0.00,q0fit[0])
98+
print('----------------------------------')
99+
print(' {0:<6.4f} {1:<6.4f}'.format(0.00,q0fit[0]))
100100

101-
print
102-
print
103-
print 'Total energy (q=1, eV)'
101+
print()
102+
print()
103+
print('Total energy (q=1, eV)')
104104
for i in range(len(ts)):
105-
print ' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],q1.energies[i],q1.errs[i])
105+
print(' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],q1.energies[i],q1.errs[i]))
106106
#end for
107-
print '----------------------------------'
108-
print ' {0:<6.4f} {1:<6.4f}'.format(0.00,q1fit[0])
107+
print('----------------------------------')
108+
print(' {0:<6.4f} {1:<6.4f}'.format(0.00,q1fit[0]))
109109

110-
print
111-
print
112-
print '1st ionization potential (eV)'
110+
print()
111+
print()
112+
print('1st ionization potential (eV)')
113113
for i in range(len(ts)):
114-
print ' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],ip[i],iperr[i])
114+
print(' {0:<6.4f} {1:<6.4f} +/- {2:<6.4f}'.format(ts[i],ip[i],iperr[i]))
115115
#end for
116-
print '----------------------------------'
117-
print ' {0:<6.4f} {1:<6.4f}'.format(0.00,ipfit[0])
116+
print('----------------------------------')
117+
print(' {0:<6.4f} {1:<6.4f}'.format(0.00,ipfit[0]))
118118

119-
print
120-
print
121-
122-
figure()
123-
errorbar(q0.timesteps,q0.energies,q0.errs,fmt='b.',label='q0')
124-
plot(tfit,q0fit,'k--',lw=2)
125-
title('Oxygen q=0 total energy vs. timestep')
126-
ylabel('Total energy (eV)')
127-
xlabel('timestep (1/Ha)')
128-
legend()
129-
130-
figure()
131-
errorbar(q1.timesteps,q1.energies,q1.errs,fmt='b.',label='q1')
132-
plot(tfit,q1fit,'k--',lw=2)
133-
title('Oxygen q=1 total energy vs. timestep')
134-
ylabel('Total energy (eV)')
135-
xlabel('timestep (1/Ha)')
136-
legend()
137-
138-
figure()
139-
errorbar(ts,ip,iperr,fmt='r.',label='1st IP')
140-
plot(tfit,ipfit,'g--',lw=2)
141-
title('Oxygen 1st IP vs. timestep')
142-
ylabel('IP (eV)')
143-
xlabel('timestep (1/Ha)')
144-
legend()
145-
146-
show()
119+
print()
120+
print()
121+
122+
plt.figure()
123+
plt.errorbar(q0.timesteps,q0.energies,q0.errs,fmt='b.',label='q0')
124+
plt.plot(tfit,q0fit,'k--',lw=2)
125+
plt.title('Oxygen q=0 total energy vs. timestep')
126+
plt.ylabel('Total energy (eV)')
127+
plt.xlabel('timestep (1/Ha)')
128+
plt.legend()
129+
130+
plt.figure()
131+
plt.errorbar(q1.timesteps,q1.energies,q1.errs,fmt='b.',label='q1')
132+
plt.plot(tfit,q1fit,'k--',lw=2)
133+
plt.title('Oxygen q=1 total energy vs. timestep')
134+
plt.ylabel('Total energy (eV)')
135+
plt.xlabel('timestep (1/Ha)')
136+
plt.legend()
137+
138+
plt.figure()
139+
plt.errorbar(ts,ip,iperr,fmt='r.',label='1st IP')
140+
plt.plot(tfit,ipfit,'g--',lw=2)
141+
plt.title('Oxygen 1st IP vs. timestep')
142+
plt.ylabel('IP (eV)')
143+
plt.xlabel('timestep (1/Ha)')
144+
plt.legend()
145+
146+
plt.show()
147147
#end if

labs/lab2_qmc_basics/oxygen_dimer/dimer_fit.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from numpy import array,polyfit,polyval,linspace,sqrt
66
from qmcpack_analyzer import QmcpackAnalyzer
77
from unit_converter import convert
8-
from plotting import *
9-
from debug import *
8+
import matplotlib.pyplot as plt
109

1110

1211
args = sys.argv[1:]
@@ -88,12 +87,12 @@
8887
print('Exp bond length, binding energy:',se,ee)
8988

9089

91-
figure()
92-
errorbar(seps,energies,errors,fmt='r.')
93-
plot(sf,ef,'g-',lw=2,label='n={0} fit'.format(nfit))
94-
xlabel('bond length (A)')
95-
ylabel(Elabel+' (eV)')
96-
title('DMC '+Elabel+' vs. bond length')
97-
legend()
90+
plt.figure()
91+
plt.errorbar(seps,energies,errors,fmt='r.')
92+
plt.plot(sf,ef,'g-',lw=2,label='n={0} fit'.format(nfit))
93+
plt.xlabel('bond length (A)')
94+
plt.ylabel(Elabel+' (eV)')
95+
plt.title('DMC '+Elabel+' vs. bond length')
96+
plt.legend()
9897

99-
show()
98+
plt.show()

0 commit comments

Comments
 (0)