-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from NLESC-JCER/unify_slaterjastrow
Unify slaterjastrow
- Loading branch information
Showing
140 changed files
with
6,142 additions
and
3,523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env python | ||
import h5py | ||
import matplotlib.pyplot as plt | ||
import argparse | ||
|
||
|
||
def get_energy(mol): | ||
with h5py.File(mol, 'r') as f5: | ||
data = f5['wf_opt']['energy'][()] | ||
return data | ||
|
||
|
||
def get_correlation_energy(e, e0, ehf): | ||
return 1 - (e-e0)/(ehf-e0) | ||
|
||
|
||
def plot_percent_correlation_energy(args): | ||
|
||
nepoch = args.num_epoch | ||
energy = [] | ||
percent_correlation_energy = [] | ||
for mol in args.filename: | ||
e = get_energy(mol)[:nepoch] | ||
print(e[-1]) | ||
energy.append(e) | ||
percent_correlation_energy.append( | ||
get_correlation_energy(e, args.exact_energy, args.hf_energy)) | ||
|
||
plt_fn = plt.plot | ||
if args.semi_logy: | ||
plt_fn = plt.semilogy | ||
|
||
for ec in percent_correlation_energy: | ||
plt_fn(ec) | ||
plt.show() | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('filename', nargs='+', | ||
help='name of the files') | ||
parser.add_argument('-l', '--labels', nargs='+', | ||
help='label of the data') | ||
parser.add_argument('-ne', '--num_epoch', type=int, | ||
default=-1, help='Number of epcoh to plot') | ||
parser.add_argument('-e0', '--exact_energy', type=float, | ||
default=None, help='True exact energy of thre system') | ||
parser.add_argument('-ehf', '--hf_energy', type=float, | ||
default=None, help='Hartree Fock energy of thre system') | ||
parser.add_argument('-log', '--semi_logy', action='store_true', | ||
help='plot on semilog y axis') | ||
args = parser.parse_args() | ||
|
||
plot_percent_correlation_energy(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
from qmctorch.wavefunction.jastrows.graph.jastrow_graph import JastrowFactorGraph | ||
import torch | ||
from torch.autograd import grad | ||
nup = 2 | ||
ndown = 2 | ||
atomic_pos = torch.rand(2, 3) | ||
atom_types = ["Li", "H"] | ||
jast = JastrowFactorGraph(nup, ndown, | ||
atomic_pos, | ||
atom_types) | ||
|
||
|
||
pos = torch.rand(10, 12) | ||
pos.requires_grad = True | ||
jval = jast(pos) | ||
|
||
gval = jast(pos, derivative=1) | ||
hval = jast(pos, derivative=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.