mirror of https://github.com/QMCPACK/qmcpack.git
Merge pull request #230 from jtkrogel/dev
fix for parallel pw2qmcpack workflow, other small updates
This commit is contained in:
commit
98297c304d
|
@ -194,7 +194,7 @@ class SimulationBundle(Simulation):
|
|||
|
||||
|
||||
def progress(self,dependency_id=None):
|
||||
if dependency_id!=None:
|
||||
if dependency_id!=None and dependency_id in self.wait_ids:
|
||||
self.wait_ids.remove(dependency_id)
|
||||
#end if
|
||||
if len(self.wait_ids)==0 and not self.block and not self.failed:
|
||||
|
|
|
@ -366,3 +366,13 @@ def unavailable(module,*items):
|
|||
return voids
|
||||
#end if
|
||||
#end def unavailable
|
||||
|
||||
|
||||
def available(*items):
|
||||
for item in items:
|
||||
if isinstance(item,Void):
|
||||
return False
|
||||
#end if
|
||||
#end for
|
||||
return True
|
||||
#end def available
|
||||
|
|
|
@ -609,6 +609,16 @@ class obj(object_interface):
|
|||
|
||||
|
||||
# dict extensions
|
||||
def random_key(self):
|
||||
key = None
|
||||
nkeys = len(self)
|
||||
if nkeys>0:
|
||||
key = self._keys()[randint(0,nkeys-1)]
|
||||
#end if
|
||||
return key
|
||||
#end def random_key
|
||||
|
||||
|
||||
def set(self,*objs,**kwargs):
|
||||
for key,value in kwargs.iteritems():
|
||||
self[key]=value
|
||||
|
@ -858,6 +868,25 @@ class obj(object_interface):
|
|||
return new
|
||||
#end def inverse
|
||||
|
||||
def serial(self,s=None,path=None):
|
||||
first = s is None
|
||||
if first:
|
||||
s = obj()
|
||||
path = ''
|
||||
#end if
|
||||
for k,v in self._iteritems():
|
||||
p = path+str(k)
|
||||
if isinstance(v,obj):
|
||||
v._serial(s,p+'/')
|
||||
else:
|
||||
s[p]=v
|
||||
#end if
|
||||
#end for
|
||||
if first:
|
||||
return s
|
||||
#end if
|
||||
#end def serial
|
||||
|
||||
|
||||
|
||||
# access preserving functions
|
||||
|
@ -885,6 +914,8 @@ class obj(object_interface):
|
|||
def _select_random(self,*args,**kwargs):
|
||||
return obj.select_random(self,*args,**kwargs)
|
||||
# dict extensions
|
||||
def _random_key(self,*args,**kwargs):
|
||||
obj.random_key(self,*args,**kwargs)
|
||||
def _set(self,*args,**kwargs):
|
||||
obj.set(self,*args,**kwargs)
|
||||
def _set_optional(self,*args,**kwargs):
|
||||
|
@ -923,6 +954,8 @@ class obj(object_interface):
|
|||
obj.shallow_copy(self,*args,**kwargs)
|
||||
def _inverse(self,*args,**kwargs):
|
||||
return obj.inverse(self,*args,**kwargs)
|
||||
def _serial(self,*args,**kwargs):
|
||||
return obj.serial(self,*args,**kwargs)
|
||||
|
||||
#end class obj
|
||||
|
||||
|
|
|
@ -386,6 +386,7 @@ def run_project(*args,**kwargs):
|
|||
pm = ProjectManager()
|
||||
pm.add_simulations(*args,**kwargs)
|
||||
pm.run_project()
|
||||
return pm
|
||||
#end def run_project
|
||||
|
||||
|
||||
|
|
|
@ -330,6 +330,22 @@ class ProjectManager(NexusCore):
|
|||
#end def write_cascade_status
|
||||
|
||||
|
||||
def write_sim_dependencies(self,idkey=None):
|
||||
for simid in sorted(self.simulations.keys()):
|
||||
sim = self.simulations[simid]
|
||||
if idkey is None or sim.identifier==idkey:
|
||||
self.log('\n{0} {1} {2}'.format(sim.identifier,simid,sim.locdir))
|
||||
for did in sorted(sim.dependencies.keys()):
|
||||
dep = sim.dependencies[did]
|
||||
dsim = dep.sim
|
||||
names = dep.result_names
|
||||
self.log(' {0} {1} {2} {3}'.format(dsim.identifier,dsim.simid,names,dsim.locdir))
|
||||
#end for
|
||||
#end if
|
||||
#end for
|
||||
#end def write_sim_dependencies
|
||||
|
||||
|
||||
def write_cascade_dependents(self):
|
||||
self.log('cascade dependents',n=1)
|
||||
for cascade in self.cascades:
|
||||
|
@ -411,7 +427,7 @@ class ProjectManager(NexusCore):
|
|||
cascade.reset_wait_ids()
|
||||
#end for
|
||||
for cid,cascade in progressing_cascades.iteritems():
|
||||
if not cascade.bundled:
|
||||
if not cascade.bundled or cascade.bundler.finished:
|
||||
cascade.progress()
|
||||
#end if
|
||||
cascade.check_subcascade()
|
||||
|
|
|
@ -96,9 +96,9 @@ class Pwscf(Simulation):
|
|||
if result_name=='charge_density':
|
||||
calculating_result = True
|
||||
elif result_name=='orbitals':
|
||||
calculating_result = 'wf_collect' in control and control.wf_collect
|
||||
calculating_result = 'calculation' not in control or 'scf' in control.calculation.lower()
|
||||
elif result_name=='structure':
|
||||
calculating_result = 'relax' in control.calculation.lower()
|
||||
calculating_result = 'calculation' in control and 'relax' in control.calculation.lower()
|
||||
else:
|
||||
calculating_result = False
|
||||
#end if
|
||||
|
|
|
@ -55,6 +55,7 @@ from generic import obj
|
|||
from structure import Structure,kmesh
|
||||
from physical_system import PhysicalSystem
|
||||
from developer import DevBase,warn
|
||||
from pseudopotential import pp_elem_label
|
||||
from simulation import SimulationInput
|
||||
from debug import *
|
||||
|
||||
|
@ -1747,7 +1748,8 @@ def generate_any_pwscf_input(**kwargs):
|
|||
pseudopotentials = obj()
|
||||
atoms = []
|
||||
for ppname in pseudos:
|
||||
element = ppname[0:2].strip('.')
|
||||
#element = ppname[0:2].strip('.')
|
||||
label,element = pp_elem_label(ppname,guard=True)
|
||||
atoms.append(element)
|
||||
pseudopotentials[element] = ppname
|
||||
#end for
|
||||
|
|
|
@ -1940,6 +1940,14 @@ class kspace_jastrow(QIxml):
|
|||
write_types = obj(optimize=yesno)
|
||||
#end class kspace_jastrow
|
||||
|
||||
class rpa_jastrow(QIxml):
|
||||
tag = 'jastrow'
|
||||
attributes = ['type','name','source','function','kc']
|
||||
parameters = ['longrange']
|
||||
identifier = 'name'
|
||||
write_types = obj(longrange=yesno)
|
||||
#end class rpa_jastrow
|
||||
|
||||
class correlation(QIxml):
|
||||
attributes = ['elementtype','speciesa','speciesb','size','ispecies','especies',
|
||||
'especies1','especies2','isize','esize','rcut','cusp','pairtype',
|
||||
|
@ -1977,7 +1985,7 @@ class distancetable(QIxml):
|
|||
|
||||
jastrow = QIxmlFactory(
|
||||
name = 'jastrow',
|
||||
types = dict(one_body=jastrow1,two_body=jastrow2,jastrow1=jastrow1,jastrow2=jastrow2,eei=jastrow3,jastrow3=jastrow3,kspace=kspace_jastrow),
|
||||
types = dict(one_body=jastrow1,two_body=jastrow2,jastrow1=jastrow1,jastrow2=jastrow2,eei=jastrow3,jastrow3=jastrow3,kspace=kspace_jastrow,kspace_jastrow=kspace_jastrow,rpa=rpa_jastrow,rpa_jastrow=rpa_jastrow),
|
||||
typekey = 'type'
|
||||
)
|
||||
|
||||
|
@ -2133,9 +2141,9 @@ class structurefactor(QIxml):
|
|||
class force(QIxml):
|
||||
tag = 'estimator'
|
||||
attributes = ['type','name','mode','source','species','target','addionion']
|
||||
write_types= obj(addionion=yesno)
|
||||
parameters = ['rcut','nbasis','weightexp']
|
||||
identifier = 'name'
|
||||
write_types= obj(addionion=yesno)
|
||||
#end class force
|
||||
|
||||
class forwardwalking(QIxml):
|
||||
|
@ -2183,7 +2191,7 @@ class skall(QIxml):
|
|||
tag = 'estimator'
|
||||
attributes = ['name','type','hdf5','source','target','writeionion']
|
||||
identifier = 'name'
|
||||
write_types = obj(hdf5=yesno)
|
||||
write_types = obj(hdf5=yesno,writeionion=yesno)
|
||||
#end class skall
|
||||
|
||||
class gofr(QIxml):
|
||||
|
@ -2449,7 +2457,7 @@ classes = [ #standard classes
|
|||
header,local,force,forwardwalking,observable,record,rmc,pressure,dmccorrection,
|
||||
nofk,mpc_est,flux,distancetable,cpp,element,spline,setparams,
|
||||
backflow,transformation,cubicgrid,molecular_orbital_builder,cmc,sk,skall,gofr,
|
||||
host,date,user,
|
||||
host,date,user,rpa_jastrow
|
||||
]
|
||||
types = dict( #simple types and factories
|
||||
#host = param,
|
||||
|
@ -2624,7 +2632,15 @@ density.defaults.set(
|
|||
spindensity.defaults.set(
|
||||
type='spindensity',name='SpinDensity'
|
||||
)
|
||||
|
||||
skall.defaults.set(
|
||||
type='skall',name='skall'
|
||||
)
|
||||
force.defaults.set(
|
||||
type='Force',name='force'
|
||||
)
|
||||
pressure.defaults.set(
|
||||
type='Pressure'
|
||||
)
|
||||
|
||||
|
||||
linear.defaults.set(
|
||||
|
|
|
@ -1963,7 +1963,10 @@ def gen_vmc(simlabel,ch,depset,J,test=0,loc=''):
|
|||
else:
|
||||
qmcjob = wf.job
|
||||
#end if
|
||||
if J=='J0':
|
||||
other_inputs = obj(task.inputs)
|
||||
if 'jastrows' in other_inputs:
|
||||
jastrows = other_inputs.delete('jastrows')
|
||||
elif J=='J0':
|
||||
jastrows = []
|
||||
elif J=='J2':
|
||||
jastrows = jastrow_factor(**task.J2_inputs)
|
||||
|
@ -1976,7 +1979,7 @@ def gen_vmc(simlabel,ch,depset,J,test=0,loc=''):
|
|||
jastrows = jastrows,
|
||||
calculations = vmc_sections(test=test,J0=J=='J0',**task.sec_inputs),
|
||||
dependencies = deps,
|
||||
**task.inputs
|
||||
**other_inputs
|
||||
)
|
||||
sims[simlabel] = qmc
|
||||
#end def gen_vmc
|
||||
|
@ -2031,14 +2034,16 @@ def gen_dmc(simlabel,ch,depset,J,nlmove=None,test=0,loc=''):
|
|||
else:
|
||||
qmcjob = wf.job
|
||||
#end if
|
||||
if J=='J0':
|
||||
other_inputs = obj(task.inputs)
|
||||
if 'jastrows' in other_inputs:
|
||||
jastrows = other_inputs.delete('jastrows')
|
||||
elif J=='J0':
|
||||
jastrows = []
|
||||
elif J=='J2':
|
||||
jastrows = jastrow_factor(**task.J2_inputs)
|
||||
elif J=='J3':
|
||||
jastrows = jastrow_factor(**task.J3_inputs)
|
||||
#end if
|
||||
other_inputs = obj(task.inputs)
|
||||
if 'calculations' not in other_inputs:
|
||||
other_inputs.calculations = dmc_sections(nlmove=nlmove,test=test,J0=J=='J0',**task.sec_inputs)
|
||||
#end if
|
||||
|
|
Loading…
Reference in New Issue