def test(): # Generate setup symbol = 'He' if rank == 0: g = Generator(symbol, 'revPBE', scalarrel=True, nofiles=True) g.run(exx=True, **parameters[symbol]) barrier() setup_paths.insert(0, '.') a = 7.5 * Bohr n = 16 atoms = Atoms([Atom('He', (0.0, 0.0, 0.0))], cell=(a, a, a), pbc=True) calc = Calculator(gpts=(n, n, n), nbands=1, xc='revPBE') atoms.set_calculator(calc) e1 = atoms.get_potential_energy() calc.write('He') e2 = e1 + calc.get_xc_difference('vdWDF') print e1, e2
file_prefix = 'Fe_%d_%1.1f_par%d' % (nkpt, magmom, nhosts) fcc = Atoms([Atom('Fe', (0, 0, 0.0001), magmom=magmom)], pbc=True, cell=(2.55, 2.55, 2.55)) calc = Calculator(nbands=6, gpts=(ng, ng, ng), kpts=(4, 2, 2), txt=file_prefix + '.txt', tolerance=1e-10) fcc.set_calculator(calc) #fcc[0].set_magnetic_moment(magmom) e = fcc.get_potential_energy() calc.write(file_prefix + '.gpw') del calc, fcc for nhosts in nhostsread: file_prefix = 'Fe_%d_%1.1f_par%d' % (nkpt, magmom, nhosts) print '------ restart calculation ', file_prefix, rank * 111111111 calc = Calculator(file_prefix + '.gpw', txt=file_prefix + '_restart.txt', tolerance=1e-10) atoms = calc.get_atoms() atoms.positions[0] = (0, 0, -0.0001) erg = atoms.get_potential_energy() result = 'ok' equal(e, erg, 1e-4)
file_prefix = 'Fe_%d_%1.1f_par%d'%(nkpt,magmom,nhosts) fcc = Atoms([Atom('Fe', (0, 0, 0.0001) ,magmom=magmom)], pbc=True, cell = (2.55,2.55,2.55)) calc = Calculator(nbands=6, gpts=(ng,ng,ng), kpts=(4, 2, 2), txt=file_prefix+'.txt', tolerance = 1e-10) fcc.set_calculator(calc) #fcc[0].set_magnetic_moment(magmom) e = fcc.get_potential_energy() calc.write(file_prefix+'.gpw') del calc,fcc for nhosts in nhostsread: file_prefix = 'Fe_%d_%1.1f_par%d'%(nkpt,magmom,nhosts) print '------ restart calculation ',file_prefix, rank*111111111 calc = Calculator(file_prefix+'.gpw', txt=file_prefix+'_restart.txt', tolerance = 1e-10) atoms = calc.get_atoms() atoms.positions[0] = (0, 0, -0.0001) erg = atoms.get_potential_energy() result = 'ok' equal(e,erg,1e-4)