Пример #1
0
 def get_nonselfconsistent_energies(self, type='beefvdw'):
     from gpaw.xc.bee import BEEFEnsemble
     if type not in ['beefvdw', 'mbeef', 'mbeefvdw']:
         raise NotImplementedError('Not implemented for type = %s' % type)
     assert self.scf.converged
     bee = BEEFEnsemble(self)
     x = bee.create_xc_contributions('exch')
     c = bee.create_xc_contributions('corr')
     if type == 'beefvdw':
         return np.append(x, c)
     elif type == 'mbeef':
         return x.flatten()
     elif type == 'mbeefvdw':
         return np.append(x.flatten(), c)
 def get_nonselfconsistent_energies(self, type='beefvdw'):
     from gpaw.xc.bee import BEEFEnsemble
     if type not in ['beefvdw', 'mbeef', 'mbeefvdw']:
         raise NotImplementedError('Not implemented for type = %s' % type)
     assert self.scf.converged
     bee = BEEFEnsemble(self)
     x = bee.create_xc_contributions('exch')
     c = bee.create_xc_contributions('corr')
     if type == 'beefvdw':
         return np.append(x, c)
     elif type == 'mbeef':
         return x.flatten()
     elif type == 'mbeefvdw':
         return np.append(x.flatten(), c)
Пример #3
0
def getXCcontribs(jobID):
    jobObject = db2BulkJob(jobID)
    if jobObject.dftCode == 'gpaw':
        from gpaw import restart
        from gpaw.xc.bee import BEEFEnsemble
        atoms, calc = restart('inp.gpw',
                              setups='sg15',
                              xc='mBEEF',
                              convergence={'energy': 5e-4},
                              txt='mbeef.txt')
        atoms.get_potential_energy()
        beef = BEEFEnsemble(calc)
        return beef.mbeef_exchange_energy_contribs()
    else:
        return np.zeros((8, 8))
Пример #4
0
	def run_task(self,fw_spec): 

		jobID = fw_spec['jobID']
		job   = db2object(jobID)
	
		if job.dftcode == 'gpaw':
			from gpaw        import restart
			from gpaw.xc.bee import BEEFEnsemble
			atoms,calc = restart('inp.gpw', setups='sg15', xc='mBEEF', convergence={'energy': 5e-4}, txt='mbeef.txt')
			atoms.get_potential_energy()
			beef = BEEFEnsemble(calc)
			xcContribs = beef.mbeef_exchange_energy_contribs()
		else: 
			xcContribs = np.zeros((8,8))

		return FWAction( stored_data={'xcContribs': xcContribs}
						,mod_spec=[{'_push': {'xcContribs': xcContribs}}])
Пример #5
0
	def run_task(self,fw_spec): 
		from gpaw        import restart
		from gpaw.xc.bee import BEEFEnsemble
		job,params,atoms = initialize(fw_spec)
		atoms.set_calculator(job.PBEcalc())
		atoms.get_potential_energy()
		atoms.calc.write('inp.gpw', mode='all') 

		atoms,calc = restart('inp.gpw', setups='sg15', xc='mBEEF', convergence={'energy': 5e-4}, txt='mbeef.txt')
		atoms.get_potential_energy()
		beef 		= BEEFEnsemble(calc)
		xcContribs 	= beef.mbeef_exchange_energy_contribs()
		ase.io.write('final.traj',atoms)
		resultDict 	= misc.mergeDicts([params,trajDetails(ase.io.read('final.traj'))
									,{'xcContribs': pickle.dumps(xcContribs)}])

		with open('result.json', 'w') as outfile:   json.dumps(resultDict, outfile)
		return fireworks.core.firework.FWAction( stored_data=resultDict)
Пример #6
0
def XCcontribsScript():
    import cPickle, json, ase
    from gpaw import restart
    from gpaw.xc.bee import BEEFEnsemble
    params, optAtoms = initialize(
    )  # Remove old .out/.err files, load from fw_spec, and write 'init.traj'
    pbeParams = copy.deepcopy(params)
    pbeParams['xc'] = 'PBE'

    atoms.set_calculator(makeCalc(pbeParams))
    atoms.get_potential_energy()
    atoms.calc.write('inp.gpw', mode='all')

    atoms, calc = restart('inp.gpw',
                          setups='sg15',
                          xc='mBEEF',
                          convergence={'energy': 5e-4},
                          txt='mbeef.txt')
    atoms.get_potential_energy()
    beef = BEEFEnsemble(calc)
    xcContribs = beef.mbeef_exchange_energy_contribs()
    ################################
    print "Storing Results..."
    #-------------------------------
    ase.io.write('final.traj', atoms)
    resultDict = mergeDicts([
        params,
        trajDetails(ase.io.read('final.traj')), {
            'xcContribs': cPickle.dumps(xcContribs)
        }
    ])
    with open('result.json', 'w') as outfile:
        outfile.write(json.dumps(resultDict))
    if rank() == 0:
        with open('result.json', 'r') as outfile:
            json.loads(outfile.read())  #test that dictionary isn't 'corrupted'
        log(params, atoms)
    return 0
Пример #7
0
                  mode=PW(800),
                  xc='PBE',
                  eigensolver=Davidson(5),
                  mixer=Mixer(0.1, 5, 100),
                  kpts=kpts,
                  occupations=FermiDirac(0.2),
                  nbands=-16,
                  txt='pbe.txt')

atoms.get_potential_energy()
atoms.calc.write('inp.gpw', mode='all')

#This uses libxc for MBEEF, you can use for relaxations, etc... (might be
#a little bit faster)
#atoms,calc = restart('inp.gpw', setups='sg15', xc='MGGA_X_MBEEF+GGA_C_PBE_SOL', convergence={'energy': 5e-6}, txt='mbeef.txt')
#But for xc energy contribution output (i.e. single-point calculations)
#only the python version works:
atoms, calc = restart('inp.gpw',
                      setups='sg15',
                      xc='mBEEF',
                      convergence={'energy': 5e-6},
                      txt='mbeef.txt')

f = paropen('total_energy_and_xc_coefficients.txt', 'w')
print >> f, atoms.get_potential_energy()

from gpaw.xc.bee import BEEFEnsemble

beef = BEEFEnsemble(calc)

print >> f, beef.mbeef_exchange_energy_contribs()