mirror of https://github.com/QMCPACK/qmcpack.git
gamess update for mcscf workflows
git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@6410 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
parent
e7b93af71d
commit
3751252aa2
|
@ -146,7 +146,13 @@ class Convert4qmc(Simulation):
|
||||||
|
|
||||||
def incorporate_result(self,result_name,result,sim):
|
def incorporate_result(self,result_name,result,sim):
|
||||||
if result_name=='orbitals':
|
if result_name=='orbitals':
|
||||||
self.input.gamess_ascii = os.path.relpath(result.location,self.locdir)
|
orbpath = os.path.relpath(result.location,self.locdir)
|
||||||
|
if result.scftyp=='mcscf':
|
||||||
|
self.input.gamess_ascii = orbpath
|
||||||
|
self.input.ci = orbpath
|
||||||
|
else:
|
||||||
|
self.input.gamess_ascii = orbpath
|
||||||
|
#end if
|
||||||
self.job.app_command = self.input.app_command()
|
self.job.app_command = self.input.app_command()
|
||||||
else:
|
else:
|
||||||
self.error('ability to incorporate result '+result_name+' has not been implemented')
|
self.error('ability to incorporate result '+result_name+' has not been implemented')
|
||||||
|
@ -184,6 +190,9 @@ class Convert4qmc(Simulation):
|
||||||
|
|
||||||
def generate_convert4qmc(**kwargs):
|
def generate_convert4qmc(**kwargs):
|
||||||
sim_args,inp_args = Simulation.separate_inputs(kwargs)
|
sim_args,inp_args = Simulation.separate_inputs(kwargs)
|
||||||
|
if 'identifier' in sim_args and not 'prefix' in inp_args:
|
||||||
|
inp_args.prefix = sim_args.identifier
|
||||||
|
#end if
|
||||||
|
|
||||||
if not 'input' in sim_args:
|
if not 'input' in sim_args:
|
||||||
sim_args.input = generate_convert4qmc_input(**inp_args)
|
sim_args.input = generate_convert4qmc_input(**inp_args)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Gamess(Simulation):
|
||||||
def check_result(self,result_name,sim):
|
def check_result(self,result_name,sim):
|
||||||
input = self.input
|
input = self.input
|
||||||
if result_name=='orbitals':
|
if result_name=='orbitals':
|
||||||
calculating_result = 'contrl' in input and 'scftyp' in input.contrl and input.contrl.scftyp in ('rhf','rohf','uhf')
|
calculating_result = 'contrl' in input and 'scftyp' in input.contrl and input.contrl.scftyp.lower() in ('rhf','rohf','uhf','mcscf')
|
||||||
else:
|
else:
|
||||||
calculating_result = False
|
calculating_result = False
|
||||||
#end if
|
#end if
|
||||||
|
@ -60,11 +60,13 @@ class Gamess(Simulation):
|
||||||
|
|
||||||
def get_result(self,result_name,sim):
|
def get_result(self,result_name,sim):
|
||||||
result = obj()
|
result = obj()
|
||||||
|
input = self.input
|
||||||
analyzer = self.load_analyzer_image()
|
analyzer = self.load_analyzer_image()
|
||||||
if result_name=='orbitals':
|
if result_name=='orbitals':
|
||||||
result.location = os.path.join(self.locdir,self.outfile)
|
result.location = os.path.join(self.locdir,self.outfile)
|
||||||
result.vec = None
|
result.vec = None
|
||||||
result.norbitals = 0
|
result.norbitals = 0
|
||||||
|
result.scftyp = input.contrl.scftyp.lower()
|
||||||
if 'punch' in analyzer and 'vec' in analyzer.punch:
|
if 'punch' in analyzer and 'vec' in analyzer.punch:
|
||||||
result.norbitals = analyzer.punch.norbitals
|
result.norbitals = analyzer.punch.norbitals
|
||||||
result.vec = analyzer.punch.vec
|
result.vec = analyzer.punch.vec
|
||||||
|
@ -85,9 +87,11 @@ class Gamess(Simulation):
|
||||||
if not 'guess' in input:
|
if not 'guess' in input:
|
||||||
input.guess = GuessGroup()
|
input.guess = GuessGroup()
|
||||||
#end if
|
#end if
|
||||||
|
input.guess.clear()
|
||||||
input.guess.set(
|
input.guess.set(
|
||||||
guess = 'moread',
|
guess = 'moread',
|
||||||
norb = result.norbitals
|
norb = result.norbitals,
|
||||||
|
prtmo = True
|
||||||
)
|
)
|
||||||
input.vec = FormattedGroup(result.vec)
|
input.vec = FormattedGroup(result.vec)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -608,6 +608,31 @@ class CidrtGroup(KeywordSpecGroup):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DetGroup(KeywordSpecGroup):
|
||||||
|
keywords = set([
|
||||||
|
'ncore' ,'nact' ,'nels' ,'sz' ,'group' ,'stsym' ,'irreps',
|
||||||
|
'nstate','prttol','analys','itermx','cvgtol','nhgss' ,'nstgss',
|
||||||
|
'mxxpan','clobbr','pures' ,'iroot' ,'nflgdm','saflg' ,'wstate',
|
||||||
|
'idwref','dwparm'
|
||||||
|
])
|
||||||
|
|
||||||
|
integers = set(['ncore','nact','nels','nstate','itermx','nhgss','nstgss',
|
||||||
|
'mxxpan','iroot','idwref'])
|
||||||
|
reals = set(['sz','prttol','cvgtol','dwparm'])
|
||||||
|
bools = set(['analys','clobbr','pures','saflg'])
|
||||||
|
strings = set(['group','stsym'])
|
||||||
|
arrays = set(['irreps','nflgdm','wstate'])
|
||||||
|
|
||||||
|
allowed_values = obj(
|
||||||
|
group = set(['c1','c2','ci','cs','c2v','c2h','d2','d2h','c4v','d4','d4h']),
|
||||||
|
stsym = set(['a','ag','au','ap','app','a','b','a1','a2','b1','b2','ag',
|
||||||
|
'bu','bg','au','a','b1','b2','b3','ag','b1g','b2g','b3g',
|
||||||
|
'au','b1u','b2u','b3u']),
|
||||||
|
)
|
||||||
|
#end class DetGroup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#class XGroup(KeywordSpecGroup):
|
#class XGroup(KeywordSpecGroup):
|
||||||
# keywords = set([''])
|
# keywords = set([''])
|
||||||
# integers = set([''])
|
# integers = set([''])
|
||||||
|
@ -655,7 +680,7 @@ class GamessInput(SimulationInput,GIbase):
|
||||||
all_groups = set(group_order)
|
all_groups = set(group_order)
|
||||||
|
|
||||||
key_groups = set(['contrl','system','guess','scf','mcscf','dft',
|
key_groups = set(['contrl','system','guess','scf','mcscf','dft',
|
||||||
'gugdia','drt','cidrt'])
|
'gugdia','drt','cidrt','det'])
|
||||||
|
|
||||||
card_groups = set()
|
card_groups = set()
|
||||||
#card_groups = set(['ecp','data','mcp','gcilst','points','stone','efrag',
|
#card_groups = set(['ecp','data','mcp','gcilst','points','stone','efrag',
|
||||||
|
@ -674,7 +699,8 @@ class GamessInput(SimulationInput,GIbase):
|
||||||
dft = DftGroup,
|
dft = DftGroup,
|
||||||
gugdia = GugdiaGroup,
|
gugdia = GugdiaGroup,
|
||||||
drt = DrtGroup,
|
drt = DrtGroup,
|
||||||
cidrt = CidrtGroup
|
cidrt = CidrtGroup,
|
||||||
|
det = DetGroup
|
||||||
)
|
)
|
||||||
keyspec_group_order = []
|
keyspec_group_order = []
|
||||||
for gname in group_order:
|
for gname in group_order:
|
||||||
|
@ -951,7 +977,6 @@ def generate_any_gamess_input(**kwargs):
|
||||||
|
|
||||||
invalid_names = kwset-GamessInput.all_name_aliases
|
invalid_names = kwset-GamessInput.all_name_aliases
|
||||||
if len(invalid_names)>0:
|
if len(invalid_names)>0:
|
||||||
obj.class_error('this\nthat\nother')
|
|
||||||
GamessInput.class_error('invalid group names or keywords encountered\n invalid names/keywords provided: {0}\n please check if these group names or keywords are actually valid GAMESS inputs\n if so, unsupported groups can be generated by providing the keywords as a single argument:\n generate_gamess_input(\n ...,\n group_name = obj(assign keywords),\n ...,\n )'.format(sorted(invalid_names)),'generate_gamess_input')
|
GamessInput.class_error('invalid group names or keywords encountered\n invalid names/keywords provided: {0}\n please check if these group names or keywords are actually valid GAMESS inputs\n if so, unsupported groups can be generated by providing the keywords as a single argument:\n generate_gamess_input(\n ...,\n group_name = obj(assign keywords),\n ...,\n )'.format(sorted(invalid_names)),'generate_gamess_input')
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
|
@ -1016,7 +1041,7 @@ def generate_any_gamess_input(**kwargs):
|
||||||
# handle nexus specific input generation keywords
|
# handle nexus specific input generation keywords
|
||||||
# ecp 287
|
# ecp 287
|
||||||
# data 37
|
# data 37
|
||||||
if pskw.system!=None:
|
if pskw.system!=None and not 'data' in gi:
|
||||||
system = pskw.system
|
system = pskw.system
|
||||||
if not 'contrl' in gi:
|
if not 'contrl' in gi:
|
||||||
gi.contrl = ContrlGroup()
|
gi.contrl = ContrlGroup()
|
||||||
|
|
|
@ -206,10 +206,9 @@ class Qmcpack(Simulation):
|
||||||
elif isinstance(sim,Convert4qmc):
|
elif isinstance(sim,Convert4qmc):
|
||||||
|
|
||||||
res = QmcpackInput(result.location)
|
res = QmcpackInput(result.location)
|
||||||
wfn = res.qmcsystem.wavefunction
|
|
||||||
qs = input.simulation.qmcsystem
|
qs = input.simulation.qmcsystem
|
||||||
oldwfn = qs.wavefunction
|
oldwfn = qs.wavefunction
|
||||||
newwfn = wfn.copy()
|
newwfn = res.qmcsystem.wavefunction
|
||||||
if 'jastrows' in newwfn:
|
if 'jastrows' in newwfn:
|
||||||
del newwfn.jastrows
|
del newwfn.jastrows
|
||||||
#end if
|
#end if
|
||||||
|
|
|
@ -140,7 +140,8 @@ class collection(hidden):
|
||||||
#self.add(value)
|
#self.add(value)
|
||||||
#end def __setitem__
|
#end def __setitem__
|
||||||
|
|
||||||
def add(self,element,strict=True):
|
def add(self,element,strict=True,key=None):
|
||||||
|
if key is None:
|
||||||
identifier = element.identifier
|
identifier = element.identifier
|
||||||
public = self.public()
|
public = self.public()
|
||||||
missing_identifier = False
|
missing_identifier = False
|
||||||
|
@ -171,6 +172,10 @@ class collection(hidden):
|
||||||
# return False
|
# return False
|
||||||
##end if
|
##end if
|
||||||
#end if
|
#end if
|
||||||
|
#end if
|
||||||
|
if key in public:
|
||||||
|
self.error('attempted to add duplicate key to collection: {0}\n keys present: {1}'.format(key,sorted(public.keys())))
|
||||||
|
#end if
|
||||||
public[key] = element
|
public[key] = element
|
||||||
self.hidden().order.append(key)
|
self.hidden().order.append(key)
|
||||||
return True
|
return True
|
||||||
|
@ -196,6 +201,14 @@ class collection(hidden):
|
||||||
#end for
|
#end for
|
||||||
return lst
|
return lst
|
||||||
#end def list
|
#end def list
|
||||||
|
|
||||||
|
def pairlist(self):
|
||||||
|
pairs = []
|
||||||
|
for key in self.hidden().order:
|
||||||
|
pairs.append((key,self[key]))
|
||||||
|
#end for
|
||||||
|
return pairs
|
||||||
|
#end def pairlist
|
||||||
#end class collection
|
#end class collection
|
||||||
|
|
||||||
|
|
||||||
|
@ -1359,7 +1372,7 @@ param = Param()
|
||||||
|
|
||||||
|
|
||||||
class simulation(QIxml):
|
class simulation(QIxml):
|
||||||
elements = ['project','random','qmcsystem','particleset','wavefunction','hamiltonian','init','traces','qmc','loop']
|
elements = ['project','random','include','qmcsystem','particleset','wavefunction','hamiltonian','init','traces','qmc','loop']
|
||||||
write_types = obj(random=yesno)
|
write_types = obj(random=yesno)
|
||||||
#end class simulation
|
#end class simulation
|
||||||
|
|
||||||
|
@ -1373,12 +1386,15 @@ class application(QIxml):
|
||||||
attributes = ['name','role','class','version']
|
attributes = ['name','role','class','version']
|
||||||
#end class application
|
#end class application
|
||||||
|
|
||||||
|
|
||||||
class random(QIxml):
|
class random(QIxml):
|
||||||
attributes = ['seed','parallel']
|
attributes = ['seed','parallel']
|
||||||
write_types= obj(parallel=truefalse)
|
write_types= obj(parallel=truefalse)
|
||||||
#end class random
|
#end class random
|
||||||
|
|
||||||
|
class include(QIxml):
|
||||||
|
attributes = ['href']
|
||||||
|
#end def include
|
||||||
|
|
||||||
|
|
||||||
class qmcsystem(QIxml):
|
class qmcsystem(QIxml):
|
||||||
elements = ['simulationcell','particleset','wavefunction','hamiltonian']
|
elements = ['simulationcell','particleset','wavefunction','hamiltonian']
|
||||||
|
@ -1729,7 +1745,7 @@ class traces(QIxml):
|
||||||
write_types = obj(write_=yesno,verbose=yesno,scalar=yesno,array=yesno,
|
write_types = obj(write_=yesno,verbose=yesno,scalar=yesno,array=yesno,
|
||||||
scalar_defaults=yesno,array_defaults=yesno,
|
scalar_defaults=yesno,array_defaults=yesno,
|
||||||
particle=yesno,particle_defaults=yesno)
|
particle=yesno,particle_defaults=yesno)
|
||||||
#end class
|
#end class traces
|
||||||
|
|
||||||
|
|
||||||
class loop(QIxml):
|
class loop(QIxml):
|
||||||
|
@ -1822,7 +1838,7 @@ classes = [ #standard classes
|
||||||
atomicbasisset,basisgroup,init,var,traces,scalar_traces,particle_traces,array_traces,
|
atomicbasisset,basisgroup,init,var,traces,scalar_traces,particle_traces,array_traces,
|
||||||
reference_points,nearestneighbors,neighbor_trace,dm1b,
|
reference_points,nearestneighbors,neighbor_trace,dm1b,
|
||||||
coefficient,radfunc,spindensity,structurefactor,
|
coefficient,radfunc,spindensity,structurefactor,
|
||||||
sposet,bspline_builder,composite_builder,heg_builder
|
sposet,bspline_builder,composite_builder,heg_builder,include
|
||||||
]
|
]
|
||||||
types = dict( #simple types and factories
|
types = dict( #simple types and factories
|
||||||
host = param,
|
host = param,
|
||||||
|
@ -1854,7 +1870,8 @@ plurals = obj(
|
||||||
neighbor_traces = 'neighbor_trace',
|
neighbor_traces = 'neighbor_trace',
|
||||||
sposet_builders = 'sposet_builder',
|
sposet_builders = 'sposet_builder',
|
||||||
sposets = 'sposet',
|
sposets = 'sposet',
|
||||||
radfuncs = 'radfunc'
|
radfuncs = 'radfunc',
|
||||||
|
qmcsystems = 'qmcsystem'
|
||||||
)
|
)
|
||||||
plurals_inv = plurals.inverse()
|
plurals_inv = plurals.inverse()
|
||||||
plural_names = set(plurals.keys())
|
plural_names = set(plurals.keys())
|
||||||
|
@ -2400,6 +2417,146 @@ class QmcpackInput(SimulationInput,Names):
|
||||||
Param.metadata = None
|
Param.metadata = None
|
||||||
#end def include_xml
|
#end def include_xml
|
||||||
|
|
||||||
|
# This include functionality is currently not being used
|
||||||
|
# The rationale is essentially this:
|
||||||
|
# -Having includes explicitly represented in the input file object
|
||||||
|
# makes it very difficult to search for various components
|
||||||
|
# i.e. where is the particleset? the wavefunction? a particular determinant?
|
||||||
|
# -Difficulty in locating components makes it difficult to modify them
|
||||||
|
# -Includes necessarily introduce greater variability in input file structure
|
||||||
|
# and it is difficult to ensure every possible form is preserved each and
|
||||||
|
# every time a modification is made
|
||||||
|
# -The only time it is undesirable to incorporate the contents of an
|
||||||
|
# include directly into the input file object is if the data is large
|
||||||
|
# e.g. for an xml wavefunction or pseudopotential.
|
||||||
|
# In these cases, an external file should be provided that contains
|
||||||
|
# only the large object in question (pseudo or wavefunction).
|
||||||
|
# This is already done for pseudopotentials and should be done for
|
||||||
|
# wavefunctions, e.g. multideterminants.
|
||||||
|
# Until that time, wavefunctions will be explicitly read into the full
|
||||||
|
# input file.
|
||||||
|
def add_include(self,element_type,href,placement='on'):
|
||||||
|
# check the element type
|
||||||
|
elems = ['cell','ptcl','wfs','ham']
|
||||||
|
emap = obj(
|
||||||
|
simulationcell = 'cell',
|
||||||
|
particleset = 'ptcl',
|
||||||
|
wavefunction = 'wfs',
|
||||||
|
hamiltonian = 'ham'
|
||||||
|
)
|
||||||
|
if not element_type in elems:
|
||||||
|
self.error('cannot add include for element of type {0}\n valid element types are {1}'.format(element_type,elems))
|
||||||
|
#end if
|
||||||
|
# check the requested placement
|
||||||
|
placements = ('before','on','after')
|
||||||
|
if not placement in placements:
|
||||||
|
self.error('cannot add include for element with placement {0}\n valid placements are {1}'.format(placement,list(placements)))
|
||||||
|
#end if
|
||||||
|
# check that the base element is a simulation
|
||||||
|
base = self.get_base()
|
||||||
|
if not isinstance(base,simulation):
|
||||||
|
self.error('an include can only be added to simulation\n attempted to add to {0}'.format(base.__class__.__name__))
|
||||||
|
#end if
|
||||||
|
# gather a list of current qmcsystems
|
||||||
|
if 'qmcsystem' in base:
|
||||||
|
qslist = [(0,base.qmcsystem)]
|
||||||
|
del base.qmcsystem
|
||||||
|
elif 'qmcsystems' in base:
|
||||||
|
qslist = base.qmcsystems.pairlist()
|
||||||
|
del base.qmcsystems
|
||||||
|
else:
|
||||||
|
qslist = []
|
||||||
|
#end if
|
||||||
|
# organize the elements of the qmcsystems
|
||||||
|
cur_elems = obj()
|
||||||
|
for elem in elems:
|
||||||
|
for place in placements:
|
||||||
|
cur_elems[elem,place] = None
|
||||||
|
#end for
|
||||||
|
#end for
|
||||||
|
for qskey,qs in qslist:
|
||||||
|
if isinstance(qs,include):
|
||||||
|
inc = qs
|
||||||
|
ekey = qskey.split('_')[1]
|
||||||
|
if not ekey in elems:
|
||||||
|
self.error('encountered invalid element key: {0}\n valid keys are: {1}'.format(ekey,elems))
|
||||||
|
#end if
|
||||||
|
if cur_elems[ekey,'on'] is None:
|
||||||
|
cur_elems[ekey,'before'] = ekey,inc
|
||||||
|
else:
|
||||||
|
cur_elems[ekey,'after' ] = ekey,inc
|
||||||
|
#end if
|
||||||
|
elif not isinstance(qs,qmcsystem):
|
||||||
|
self.error('expected qmcsystem element, got {0}'.format(qs.__class__.__name__))
|
||||||
|
else:
|
||||||
|
for elem in qmcsystem.elements:
|
||||||
|
elem_plural = elem+'s'
|
||||||
|
name = None
|
||||||
|
if elem in qs:
|
||||||
|
name = elem
|
||||||
|
elif elem_plural in qs:
|
||||||
|
name = elem_plural
|
||||||
|
#end if
|
||||||
|
if name!=None:
|
||||||
|
cur_elems[emap[elem],'on'] = name,qs[name]
|
||||||
|
del qs[name]
|
||||||
|
#end if
|
||||||
|
#end for
|
||||||
|
residue = qs.keys()
|
||||||
|
if len(residue)>0:
|
||||||
|
self.error('extra keys found in qmcsystem: {0}'.format(sorted(residue)))
|
||||||
|
#end if
|
||||||
|
#end if
|
||||||
|
#end for
|
||||||
|
for elem in elems:
|
||||||
|
pbef = cur_elems[elem,'before']
|
||||||
|
pon = cur_elems[elem,'on' ]
|
||||||
|
paft = cur_elems[elem,'after' ]
|
||||||
|
if pon is None:
|
||||||
|
if not pbef is None and paft is None:
|
||||||
|
cur_elems[elem,'on' ] = pbef
|
||||||
|
cur_elems[elem,'before'] = None
|
||||||
|
elif not paft is None and pbef is None:
|
||||||
|
cur_elems[elem,'on' ] = paft
|
||||||
|
cur_elems[elem,'after' ] = None
|
||||||
|
#end if
|
||||||
|
#end if
|
||||||
|
#end for
|
||||||
|
# insert the new include
|
||||||
|
inc_name = 'include_'+element_type
|
||||||
|
inc_value = include(href=href)
|
||||||
|
cur_elems[element_type,placement] = inc_name,inc_value
|
||||||
|
# create a collection of qmcsystems
|
||||||
|
qmcsystems = collection()
|
||||||
|
qskey = ''
|
||||||
|
qs = qmcsystem()
|
||||||
|
for elem in elems:
|
||||||
|
for place in placements:
|
||||||
|
cur_elem = cur_elems[elem,place]
|
||||||
|
if cur_elem!=None:
|
||||||
|
name,value = cur_elem
|
||||||
|
if isinstance(value,include):
|
||||||
|
if len(qskey)>0:
|
||||||
|
qmcsystems.add(qs,key=qskey)
|
||||||
|
qskey = ''
|
||||||
|
qs = qmcsystem()
|
||||||
|
#end if
|
||||||
|
qmcsystems.add(value,key=name)
|
||||||
|
else:
|
||||||
|
qskey += elem[0]
|
||||||
|
qs[name] = value
|
||||||
|
#end if
|
||||||
|
#end if
|
||||||
|
#end for
|
||||||
|
#end for
|
||||||
|
if len(qskey)>0:
|
||||||
|
qmcsystems.add(qs,key=qskey)
|
||||||
|
#end if
|
||||||
|
# attach the collection to the input file
|
||||||
|
base.qmcsystems = qmcsystems
|
||||||
|
#end def add_include
|
||||||
|
|
||||||
|
|
||||||
def get_output_info(self,*requests):
|
def get_output_info(self,*requests):
|
||||||
project = self.simulation.project
|
project = self.simulation.project
|
||||||
prefix = project.id
|
prefix = project.id
|
||||||
|
|
Loading…
Reference in New Issue