Skip to content

Commit 4ba74c7

Browse files
committedMay 9, 2018
Crystal calculation works up until Linear now.
1 parent 1e03de1 commit 4ba74c7

File tree

8 files changed

+211
-115
lines changed

8 files changed

+211
-115
lines changed
 

‎TODO.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
- [ ] Bad use case: accidentally putting the same writer for multiple managers
22
will screw up the process because the first time the writer writes, it delares itself 'done'
33
- [ ] Manage path setup with setup script.
4+
- crystal, properties, pyscf, and qwalk executible names and locations.
45
- [ ] Compirable defaults between PySCF and Crystal are not the same.
6+
- [ ] Cannot yet do different paths with QMC and crystal because the basis and the orb file needs to be in the same place.
7+
- May need to have the crystal manager export the results to the same directory (this means there are redundant files then).

‎crystal2qmc.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def write_slater(basis,eigsys,kpt,outfn,orbfn,basisfn,maxmo_spin=-1):
369369
" " + " ".join(dnorblines),
370370
"}"
371371
]
372-
with open(outfn) as outf:
372+
with open(outfn,'w') as outf:
373373
outf.write("\n".join(outlines))
374374

375375
###############################################################################
@@ -759,21 +759,23 @@ def convert_crystal(
759759
# All the files that will get produced.
760760
files={
761761
'kpts':[],
762-
'basis':basename+".basis",
763-
'jastrow':basename+".jast2",
762+
'basis':base+".basis",
763+
'jastrow2':base+".jast2",
764+
'orbplot':{},
764765
'orb':{},
765766
'sys':{},
766767
'slater':{}
767768
}
768769
write_basis(basis,ions,files['basis'])
769-
write_jast2(lat_parm,ions,files['jast2'])
770+
write_jast2(lat_parm,ions,files['jastrow2'])
770771

771772
for kpt in eigsys['kpt_coords']:
772773
if eigsys['ikpt_iscmpx'][kpt] and kset=='real': continue
773774
files['kpts'].append(kpt)
774-
files['slater'][kpt]="%s_%d.slater"%(basename,eigsys['kpt_index'][kpt])
775-
files['orb'][kpt]="%s_%d.orb"%(basename,eigsys['kpt_index'][kpt])
776-
files['sys'][kpt]="%s_%d.sys"%(basename,eigsys['kpt_index'][kpt])
775+
files['orbplot'][kpt]="%s_%d.plot"%(base,eigsys['kpt_index'][kpt])
776+
files['slater'][kpt]="%s_%d.slater"%(base,eigsys['kpt_index'][kpt])
777+
files['orb'][kpt]="%s_%d.orb"%(base,eigsys['kpt_index'][kpt])
778+
files['sys'][kpt]="%s_%d.sys"%(base,eigsys['kpt_index'][kpt])
777779
write_slater(basis,eigsys,kpt,
778780
outfn=files['slater'][kpt],
779781
orbfn=files['orb'][kpt],

‎linear.py

+24-17
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,36 @@
33
####################################################
44
class LinearWriter:
55
def __init__(self,options={}):
6-
self.qmc_type='Linear optimization'
7-
self.sysfiles=['qw_000.sys']
8-
self.wffiles=[]
9-
#self.basenames=['qw_000']
10-
self.completed=False
6+
''' Object for producing input into a variance optimization QWalk run.
7+
Args:
8+
options (dict): editable options are as follows.
9+
trialfunc (str): system and trial wavefunction section.
10+
errtol (float): tolerance for the variance.
11+
minblocks (int): minimum number of VMC steps to take.
12+
iterations (int): number of VMC steps to attempt.
13+
macro_iterations (int): Number of optimize calls to make.
14+
'''
15+
self.trialfunc=''
1116
self.errtol=10
1217
self.minblocks=0
1318
self.total_nstep=2048*4 # 2048 gets stuck pretty often.
1419
self.total_fit=2048
1520
self.qmc_abr='energy'
21+
22+
self.qmc_type='Linear optimization'
23+
self.qmc_abr='energy'
24+
self.completed=False
1625
self.set_options(options)
26+
1727
#-----------------------------------------------
18-
1928
def set_options(self, d):
2029
selfdict=self.__dict__
2130
for k in d.keys():
2231
if not k in selfdict.keys():
2332
print("Error:",k,"not a keyword for LinearWriter")
2433
raise InputError
2534
selfdict[k]=d[k]
35+
2636
#-----------------------------------------------
2737
def is_consistent(self,other):
2838
#In principle we should check for the files, but
@@ -45,21 +55,18 @@ def is_consistent(self,other):
4555
return True
4656

4757
#-----------------------------------------------
48-
def qwalk_input(self,infiles):
49-
nfiles=len(infiles)
50-
assert nfiles==len(self.sysfiles), "Check sysfiles"
51-
assert nfiles==len(self.wffiles), "Check wffiles"
52-
53-
for inp,sys,wf in zip(infiles,self.sysfiles,self.wffiles):
54-
55-
with open(inp,'w') as f:
58+
def qwalk_input(self,infile):
59+
if self.trialfunc=='':
60+
print(self.__class__.__name__,": Trial function not ready. Postponing input file generation.")
61+
self.completed=False
62+
else:
63+
with open(infile,'w') as f:
5664
f.write("method { linear \n")
5765
f.write("total_nstep %i \n"%self.total_nstep)
5866
f.write("total_fit %i \n"%self.total_fit)
5967
f.write("}\n")
60-
f.write("include "+sys+"\n")
61-
f.write("trialfunc { include %s\n"%wf)
62-
f.write("}\n")
68+
f.write(self.trialfunc)
69+
6370
self.completed=True
6471

6572

‎manager.py

+103-26
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
######################################################################
1818
# Misc functions.
1919
######################################################################
20-
def resolve_status(runner,reader,outfile, method='not_defined'):
20+
def resolve_status(runner,reader,outfile):
2121
#Check if the reader is done
2222
if reader.completed:
2323
return 'done'
@@ -67,19 +67,44 @@ def update_attributes(copyto,copyfrom,skip_keys=[],take_keys=[]):
6767
pass
6868
return updated
6969

70+
def seperate_jastrow(wffile,optimizebasis=False):
71+
''' Seperate the jastrow section of a QWalk wave function file.'''
72+
# Copied from utils/seperate_jastrow TODO: no copy, bad
73+
wff=open(wffile,'r')
74+
tokens=wff.read().split('\n')
75+
in_jastrow=False
76+
nopen=0
77+
nclose=0
78+
jastlines=[]
79+
for line in tokens:
80+
if 'jastrow2' in line.lower():
81+
in_jastrow=True
82+
if in_jastrow:
83+
if not optimizebasis and 'optimizebasis' in line.lower():
84+
continue
85+
nopen+=line.count("{")
86+
nclose+=line.count("}")
87+
if in_jastrow and nopen >= nclose:
88+
jastlines.append(line)
89+
return '\n'.join(jastlines)
90+
7091
######################################################################
7192
# Manager classes.
7293
#######################################################################
7394
class CrystalManager:
7495
""" Internal class managing process of running a DFT job though crystal.
7596
Has authority over file names associated with this task."""
76-
def __init__(self,writer,runner,name='crystal_run',path=None,crys_reader=None,prop_reader=None,
97+
def __init__(self,writer,runner,creader=None,name='crystal_run',path=None,
98+
preader=None,prunner=None,
7799
trylev=False,bundle=False,max_restarts=5):
78100
''' CrystalManager manages the writing of a Crystal input file, it's running, and keeping track of the results.
79101
Args:
80102
writer (PySCFWriter): writer for input.
81103
reader (PySCFReader): to read PySCF output.
82104
runner (runner object): to run job.
105+
creader (CrystalReader): Reads the crystal results, (None implies use default reader).
106+
preader (PropertiesReader): Reads properties results, if any (None implies use default reader).
107+
prunner (runner object): run properties if needed (None implies use same runner as crystal).
83108
name (str): identifier for this job. This names the files associated with run.
84109
trylev (bool): When restarting use LEVSHIFT option to encourage convergence, then do a rerun without LEVSHIFT.
85110
bundle (bool): Whether you'll use a bundling tool to run these jobs.
@@ -99,11 +124,14 @@ def __init__(self,writer,runner,name='crystal_run',path=None,crys_reader=None,pr
99124

100125
print(self.logname,": initializing")
101126

127+
# Handle reader and runner defaults.
102128
self.writer=writer
103-
if crys_reader is None: self.creader=crystal.CrystalReader()
104-
else: self.creader=crys_reader
105-
if prop_reader is None: self.preader=propertiesreader.PropertiesReader()
106-
else: self.preader=prop_reader
129+
if creader is None: self.creader=crystal.CrystalReader()
130+
else: self.creader=creader
131+
if preader is None: self.preader=propertiesreader.PropertiesReader()
132+
else: self.preader=preader
133+
if prunner is None: self.prunner=runner
134+
else: self.prunner=prunner
107135
if runner is None: self.runner=RunnerPBS()
108136
else: self.runner=runner
109137

@@ -143,15 +171,18 @@ def recover(self,other):
143171
# This is because you are taking the attributes from the older instance, and copying into the new instance.
144172

145173
update_attributes(copyto=self,copyfrom=other,
146-
skip_keys=['writer','runner','creader','preader','lev','savebroy',
174+
skip_keys=['writer','runner','creader','preader','prunner','lev','savebroy',
147175
'path','logname','name',
148176
'trylev','max_restarts','bundle'],
149-
take_keys=['restarts','completed'])
177+
take_keys=['restarts','completed','qwfiles'])
150178

151179
# Update queue settings, but save queue information.
152180
update_attributes(copyto=self.runner,copyfrom=other.runner,
153181
skip_keys=['queue','walltime','np','nn','jobname'],
154182
take_keys=['queueid'])
183+
update_attributes(copyto=self.runner,copyfrom=other.runner,
184+
skip_keys=['queue','walltime','np','nn','jobname'],
185+
take_keys=['queueid'])
155186

156187
update_attributes(copyto=self.creader,copyfrom=other.creader,
157188
skip_keys=[],
@@ -185,7 +216,7 @@ def nextstep(self):
185216
self.writer.write_prop_input(self.propinpfn)
186217

187218
# Check on the CRYSTAL run
188-
status=resolve_status(self.runner,self.creader,self.crysoutfn,method='crystal')
219+
status=resolve_status(self.runner,self.creader,self.crysoutfn)
189220
print(self.logname,": status= %s"%(status))
190221

191222
if status=="not_started":
@@ -237,7 +268,7 @@ def nextstep(self):
237268
# Ready for bundler or else just submit the jobs as needed.
238269
if self.bundle:
239270
self.scriptfile="%s.run"%self.name
240-
self.bundle_ready=self.runner.script(self.scriptfile,self.driverfn)
271+
self.bundle_ready=self.runner.script(self.scriptfile)
241272
else:
242273
qsubfile=self.runner.submit()
243274

@@ -284,16 +315,38 @@ def export_qwalk(self):
284315
''' Export QWalk input files into current directory.'''
285316
if len(self.qwfiles)==0:
286317
self.nextstep()
318+
287319
if not self.completed:
288320
return False
289-
else:
290-
print(self.logname,": %s generating QWalk files."%self.name)
291-
cwd=os.getcwd()
292-
os.chdir(self.path)
293-
self.qwfiles=crystal2qmc.convert_crystal(base=self.name)
294-
os.chdir(cwd)
321+
322+
cwd=os.getcwd()
323+
os.chdir(self.path)
324+
325+
print(self.logname,": %s attempting to generate QWalk files."%self.name)
326+
327+
# Check on the properties run
328+
status=resolve_status(self.prunner,self.preader,self.propoutfn)
329+
print(self.logname,": properties status= %s"%(status))
330+
if status=='not_started':
331+
self.prunner.add_command("cp %s INPUT"%self.propinpfn)
332+
self.prunner.add_task("Pproperties &> %s"%self.propoutfn)
333+
334+
if self.bundle:
335+
self.scriptfile="%s.run"%self.name
336+
self.bundle_ready=self.prunner.script(self.scriptfile,self.driverfn)
337+
else:
338+
qsubfile=self.runner.submit()
339+
elif status=='ready_for_analysis':
340+
self.preader.collect(self.propoutfn)
341+
342+
if self.preader.completed:
343+
self.qwfiles=crystal2qmc.convert_crystal(base=self.name,propoutfn=self.propoutfn)
344+
print(self.logname,": crystal converted to QWalk input.")
345+
346+
os.chdir(cwd)
295347
with open(self.path+self.pickle,'wb') as outf:
296348
pkl.dump(self,outf)
349+
297350
return True
298351

299352
#----------------------------------------
@@ -381,7 +434,7 @@ def nextstep(self):
381434
if not self.writer.completed:
382435
self.writer.pyscf_input(self.driverfn,self.chkfile)
383436

384-
status=resolve_status(self.runner,self.reader,self.outfile, 'pyscf')
437+
status=resolve_status(self.runner,self.reader,self.outfile)
385438
print(self.logname,": %s status= %s"%(self.name,status))
386439

387440
if status=="not_started":
@@ -429,20 +482,19 @@ def export_qwalk(self):
429482
self.nextstep()
430483
if not self.completed:
431484
return False
432-
else:
433-
print(self.logname,": %s generating QWalk files."%self.name)
434-
cwd=os.getcwd()
435-
os.chdir(self.path)
436-
self.qwfiles=pyscf2qwalk.print_qwalk_chkfile(self.chkfile)
437-
os.chdir(cwd)
485+
print(self.logname,": %s generating QWalk files."%self.name)
486+
cwd=os.getcwd()
487+
os.chdir(self.path)
488+
self.qwfiles=pyscf2qwalk.print_qwalk_chkfile(self.chkfile)
489+
os.chdir(cwd)
438490
with open(self.path+self.pickle,'wb') as outf:
439491
pkl.dump(self,outf)
440492
return True
441493

442494
#----------------------------------------
443495
def status(self):
444496
''' Determine the course of action based on info from reader and runner.'''
445-
current_status = resolve_status(self.runner,self.reader,self.outfile, 'pyscf')
497+
current_status = resolve_status(self.runner,self.reader,self.outfile)
446498
if current_status == 'done':
447499
return 'ok'
448500
elif current_status == 'retry':
@@ -492,6 +544,7 @@ def __init__(self,writer,reader,runner=None,trialfunc=None,
492544
self.bundle_ready=False
493545
self.infile="%s.%s"%(name,writer.qmc_abr)
494546
self.outfile="%s.o"%self.infile
547+
self.qwfiles={}
495548
self.stdout="%s.out"%self.infile
496549

497550
# Handle old results if present.
@@ -584,7 +637,7 @@ def nextstep(self):
584637
self.completed=True
585638
else:
586639
print(self.logname,": %s status= %s, attempting rerun."%(self.name,status))
587-
exestr="%s %s"%' '.join(self.qwalk,self.infile)
640+
exestr="%s %s"%' '.join((self.qwalk,self.infile))
588641
exestr+=" &> %s.out"%self.infile[-1]
589642
self.runner.add_task(exestr)
590643
elif status=='done':
@@ -595,7 +648,7 @@ def nextstep(self):
595648
# Ready for bundler or else just submit the jobs as needed.
596649
if self.bundle:
597650
self.scriptfile="%s.run"%self.name
598-
self.bundle_ready=self.runner.script(self.scriptfile,self.driverfn)
651+
self.bundle_ready=self.runner.script(self.scriptfile)
599652
else:
600653
qsubfile=self.runner.submit()
601654

@@ -639,3 +692,27 @@ def collect(self):
639692
with open(self.path+self.pickle,'wb') as outf:
640693
pkl.dump(self,outf)
641694

695+
#----------------------------------------
696+
def export_qwalk(self):
697+
''' Extract jastrow from the optimization run and return that file name.'''
698+
# Theoretically more than just Jastrow can be provided, but practically that's the only type of wavefunction we tend to export.
699+
700+
assert self.writer.qmc_abr!='dmc',"DMC doesn't provide a wave function."
701+
702+
if len(self.qwfiles)==0:
703+
self.nextstep()
704+
if not self.completed:
705+
return False
706+
print(self.logname,": %s generating QWalk files."%self.name)
707+
cwd=os.getcwd()
708+
os.chdir(self.path)
709+
self.qwfiles['wfout']="%s.wfout"%self.infile
710+
newjast=seperate_jastrow(self.qwfiles['wfout'])
711+
self.qwfiles['jastrow2']="%s.jast"%self.infile
712+
with open(self.qwfiles['jastrow2'],'w') as outf:
713+
outf.write(newjast)
714+
os.chdir(cwd)
715+
716+
with open(self.path+self.pickle,'wb') as outf:
717+
pkl.dump(self,outf)
718+
return True

‎propertiesreader.py

+1-20
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,8 @@ def __init__(self):
88
self.out={}
99
#-------------------------------------------------
1010
def collect(self,outfilename):
11-
""" Collect results from output."""
11+
""" Just check that results are there. The actual data is too large to want to store."""
1212
if os.path.isfile("GRED.DAT") and os.path.isfile("KRED.DAT"):
13-
info, lat_parm, ions, basis, pseudo = read_gred()
14-
eigsys = read_kred(info,basis)
15-
16-
if eigsys['nspin'] > 1:
17-
eigsys['totspin'] = read_outputfile(outfilename)
18-
else:
19-
eigsys['totspin'] = 0
20-
21-
# Some of this info is redundant with the input.
22-
# But having all here makes conversion simpler.
23-
# This data can be fed directly into the write_files in crystal2qmc.
24-
self.out.update({
25-
'lat_parm':lat_parm,
26-
'ions':ions,
27-
'basis':basis,
28-
'pseudo':pseudo,
29-
'eigsys':eigsys
30-
})
31-
3213
self.completed=True
3314
else:
3415
self.completed=False

‎tests/simple_test/simple_test.py

+43-35
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from manager import PySCFManager,CrystalManager,QWalkManager
1111
from autorunner import PySCFRunnerLocal,PySCFRunnerPBS,RunnerPBS
1212
from variance import VarianceWriter,VarianceReader
13+
from linear import LinearWriter,LinearReader
1314
from trialfunc import SlaterJastrow
1415
import sys
1516

@@ -51,6 +52,9 @@ def h2_tests():
5152

5253
def si_tests():
5354
''' Simple tests that check PBC is working Crystal and PySCF.'''
55+
jobs=[]
56+
57+
5458
# Most basic possible job.
5559
cwriter=CrystalWriter({
5660
'xml_name':'../BFD_Library.xml',
@@ -69,50 +73,54 @@ def si_tests():
6973
walltime='0:10:00'
7074
)
7175
)
72-
73-
pwriter=PySCFPBCWriter({
74-
'cif':open('si.cif','r').read()
75-
})
76-
pman=PySCFManager(
77-
name='scf',
78-
path='sipyscf',
79-
writer=pwriter,
80-
runner=PySCFRunnerPBS(
81-
queue='secondary',
82-
np=1,
83-
walltime='0:20:00',
84-
ppath=sys.path
85-
)
76+
jobs.append(cman)
77+
78+
#pwriter=PySCFPBCWriter({
79+
# 'cif':open('si.cif','r').read()
80+
# })
81+
#pman=PySCFManager(
82+
# name='scf',
83+
# path='sipyscf',
84+
# writer=pwriter,
85+
# runner=PySCFRunnerPBS(
86+
# queue='secondary',
87+
# np=1,
88+
# walltime='0:20:00',
89+
# ppath=sys.path
90+
# )
91+
# )
92+
93+
var=QWalkManager(
94+
name='var',
95+
path=cman.path,
96+
writer=VarianceWriter(),
97+
reader=VarianceReader(),
98+
runner=RunnerPBS(
99+
np=1,queue='secondary',walltime='0:10:00'
100+
),
101+
trialfunc=SlaterJastrow(cman,kpoint=(0,0,0))
86102
)
87103

88-
return [cman,pman]
89-
90-
def si_qmc():
91-
''' Do QMC on the trial functions from `si_tests`. '''
92-
scfjobs=si_tests()
93-
qmcjobs=[]
104+
lin=QWalkManager(
105+
name='linear',
106+
path=cman.path,
107+
writer=LinearWriter(),
108+
reader=LinearReader(),
109+
runner=RunnerPBS(
110+
np=1,queue='secondary',walltime='1:00:00'
111+
),
112+
trialfunc=SlaterJastrow(slatman=cman,jastman=var,kpoint=(0,0,0))
113+
)
94114

95-
for scfman in scfjobs:
96-
var=QWalkManager(
97-
name='var',
98-
path=scfman.path.replace('/','')+'_qmc',
99-
writer=VarianceWriter(),
100-
reader=VarianceReader(),
101-
runner=RunnerPBS(
102-
np=1,queue='secondary',walltime='0:10:00'
103-
),
104-
trialfunc=SlaterJastrow(scfman)
105-
)
106-
qmcjobs.append(var)
115+
jobs.append(var)
107116

108-
return qmcjobs
117+
return [cman,var,lin]
109118

110119
def run_tests():
111120
''' Choose which tests to run and execute `nextstep()`.'''
112121
jobs=[]
113122
#jobs+=h2_tests()
114-
#jobs+=si_tests()
115-
jobs+=si_qmc()
123+
jobs+=si_tests()
116124

117125
for job in jobs:
118126
job.nextstep()

‎trialfunc.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,52 @@ def __init__(self,slatman,jastman=None,kpoint=0):
2121
Returns:
2222
str or None: None if managers are not ready, QWalk section (str) if they are.
2323
'''
24+
# Idea: kpoint=None means its not PBC.
2425
# TODO more transparent kpoint selection.
2526
self.slatman=slatman
2627
if jastman is None:
2728
self.jastman=slatman
2829
else:
2930
self.jastman=jastman
3031

32+
self.kpoint=kpoint
33+
3134
#------------------------------------------------
3235
def export(self,qmcpath):
3336
''' Export the wavefunction section for this trial wave function.
3437
Args:
3538
path (str): QWalkManager.path
36-
kpoint (int): the kpoint to choose for exporting.
39+
kpoint: the kpoint to choose for exporting.
3740
Returns:
3841
str: system and wave fumction section for QWalk. Empty string if not ready.
3942
'''
43+
# This assumes you're using 2-body, should be easy to make a new object or maybe an arg for 3body.
4044

4145
# Ensure files are correctly generated.
4246
if not (self.slatman.export_qwalk() and self.jastman.export_qwalk()):
4347
return ''
4448

45-
if type(self.slatman.qwfiles['slater'])==list:
46-
slater=self.slatman.qwfiles['slater'][kpoint]
47-
sys=self.slatman.qwfiles['sys'][kpoint]
48-
else:
49+
if type(self.slatman.qwfiles['slater'])==str:
4950
slater=self.slatman.qwfiles['slater']
5051
sys=self.slatman.qwfiles['sys']
52+
else:
53+
slater=self.slatman.qwfiles['slater'][self.kpoint]
54+
sys=self.slatman.qwfiles['sys'][self.kpoint]
5155
jastrow=self.jastman.qwfiles['jastrow2']
5256

5357
# There may be a use case for these two to be different, but I want to check the first time this happens.
5458
# You can have weird bugs if you use different system files for each wave function term, I think.
5559
# Should find a way to check for this bug.
56-
assert self.jastman.path+self.jastman.qwfiles['sys']==self.slatman.path+self.slatman.qwfiles['sys'],\
57-
'System file probably should be the same between Jastrow and Slater files. '
60+
# This doesn't work because we may have different jastrows in same directory, for instance.
61+
#assert (self.jastman.path+self.jastman.name)==\
62+
# (self.slatman.path+self.slatman.name),\
63+
# 'System file probably should be the same between Jastrow and Slater files. '
5864

5965
outlines=[
60-
'include %s/%s'%(os.path.relpath(qmcpath,self.slatman.path),sys),
66+
'include %s'%os.path.relpath(self.slatman.path+sys,qmcpath),
6167
'trialfunc { slater-jastrow ',
62-
' wf1 { include %s/%s }'%(os.path.relpath(qmcpath,self.slatman.path),slater),
63-
' wf2 { include %s/%s }'%(os.path.relpath(qmcpath,self.slatman.path),jastrow),
68+
' wf1 { include %s }'%os.path.relpath(self.slatman.path+slater,qmcpath),
69+
' wf2 { include %s }'%os.path.relpath(self.slatman.path+jastrow,qmcpath),
6470
'}'
6571
]
6672
return '\n'.join(outlines)

‎variance.py

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ def qwalk_input(self,infile):
4646
####################################################
4747
class VarianceReader:
4848
def __init__(self,vartol=10,vardifftol=0.1,minsteps=2):
49+
''' Object for reading, diagnosing, and storing variance optimizer results.
50+
51+
The arguements control when the object sends a 'restart' flag.
52+
53+
Args:
54+
vartol (float): Tolerance on the variance.
55+
vardifftol (float): Tolerance of the change between the first and last variance.
56+
minsteps (int): minimun number of steps to attempt >= 2.
57+
Attributes:
58+
output (dict): Results for energy, error, and other information.
59+
completed (bool): Whether no more runs are needed.
60+
'''
4961
self.output={}
5062
self.completed=False
5163

0 commit comments

Comments
 (0)
Please sign in to comment.