Commit 39db6a6f authored by Jens Jørgen Mortensen's avatar Jens Jørgen Mortensen
Browse files

Convert atoms.set_calculator(calc) to atoms.calc = calc

parent 2785ca4d
Pipeline #137758790 passed with stage
in 3 minutes and 15 seconds
......@@ -66,7 +66,7 @@ calc = GPAW(nbands=nbands,
eigensolver=es,
txt=prefix + '.txt')
atoms.set_calculator(calc)
atoms.calc = calc
try:
pot = atoms.get_potential_energy()
except ConvergenceError:
......
......@@ -35,7 +35,7 @@ calc = GPAW(nbands=nbands,
eigensolver=es,
txt=prefix + '.txt')
atoms.set_calculator(calc)
atoms.calc = calc
try:
pot = atoms.get_potential_energy()
except ConvergenceError:
......
......@@ -92,7 +92,7 @@ def memory_bandwidth(code='gpaw', runs=7):
nbands=nbands,
kpts=kpts,
**parameters)
slab.set_calculator(calc)
slab.calc = calc
e = slab.get_potential_energy()
del calc
if exists('out.nc'): remove('out.nc')
......
......@@ -15,7 +15,7 @@ calc = GPAW(nbands=8,
CO = molecule('CO')
CO.center(vacuum=3)
CO.set_calculator(calc)
CO.calc = calc
E_gs = CO.get_potential_energy()
......@@ -37,7 +37,7 @@ calc_es = GPAW(nbands=8,
'eigenstates': 1.0e-9,
'bands': -1})
CO.set_calculator(calc_es)
CO.calc = calc_es
lumo = dscf.AEOrbital(calc_es, wf_u, p_uai)
# lumo = dscf.MolecularOrbital(calc, weights={0: [0, 0, 0, 1],
# 1: [0, 0, 0, -1]})
......
......@@ -43,7 +43,7 @@ molecule = slab.copy()
del molecule[:-2]
# Molecule
molecule.set_calculator(c_mol)
molecule.calc = c_mol
molecule.get_potential_energy()
# Homo wavefunction
......@@ -55,7 +55,7 @@ p_uai = [dict([(mol[a], P_ni[4]) for a, P_ni in kpt.P_ani.items()])
for kpt in c_mol.wfs.kpt_u]
# Slab with adsorbed molecule
slab.set_calculator(calc)
slab.calc = calc
orbital = dscf.AEOrbital(calc, wf_u, p_uai, Estart=-100.0, Eend=0.0)
dscf.dscf_calculation(calc, [[-1.0, orbital, 1]], slab)
slab.get_potential_energy()
......@@ -45,7 +45,7 @@ molecule = slab.copy()
del molecule[:-2]
# Molecule
molecule.set_calculator(c_mol)
molecule.calc = c_mol
molecule.get_potential_energy()
# Find band corresponding to lumo
......@@ -78,7 +78,7 @@ p_uai = [dict([(mol[a], P_ni[band_k[kpt.k]]) for a, P_ni in kpt.P_ani.items()])
for kpt in c_mol.wfs.kpt_u]
# Slab with adsorbed molecule
slab.set_calculator(calc)
slab.calc = calc
orbital = dscf.AEOrbital(calc, wf_u, p_uai)
dscf.dscf_calculation(calc, [[1.0, orbital, 1]], slab)
slab.get_potential_energy()
......@@ -50,7 +50,7 @@ if charge == 0:
txt=name + '_gs.txt',
convergence=conv_par)
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
calc.write(name + '.gpw', mode='all')
......@@ -65,7 +65,7 @@ if charge == 1:
convergence=conv_fast,
external=const_pot)
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
# External potential used to prevent charge tranfer from graphene to ion.
......
......@@ -11,6 +11,6 @@ atoms.center(vacuum=4.0)
# Set groundstate calculator and get and save wavefunctions
calc = GPAW(h=0.3, nbands=1, basis='dzp', txt=name + '_gs.txt')
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
calc.write(name + '_gs.gpw', mode='all')
......@@ -56,7 +56,7 @@ atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms, vacuum=4.0)
gs_calc = GPAW(gpts=gpts,
nbands=-1,
poissonsolver=poissonsolver)
atoms.set_calculator(gs_calc)
atoms.calc = gs_calc
# Ground state
energy = atoms.get_potential_energy()
......
......@@ -53,7 +53,7 @@ del atoms[:] # Remove atoms, quantum system is empty
gs_calc = GPAW(gpts=gpts,
nbands=-1,
poissonsolver=poissonsolver)
atoms.set_calculator(gs_calc)
atoms.calc = gs_calc
# Ground state
energy = atoms.get_potential_energy()
......
......@@ -16,6 +16,6 @@ calc = GPAW(nbands=4,
mode='lcao',
basis='dzp')
mol.set_calculator(calc)
mol.calc = calc
dyn = QuasiNewton(mol, trajectory='lcao_h2o.traj')
dyn.run(fmax=0.05)
......@@ -23,7 +23,7 @@ else:
# Open different files depending on rank
output = '%d.txt' % rank
calc = GPAW(communicator=[rank], txt=output, xc='PBE')
system.set_calculator(calc)
system.calc = calc
energy = system.get_potential_energy()
# Now send the energy from the second process to the first process,
......
......@@ -24,6 +24,6 @@ calc = GPAW(mode='lcao',
txt=None,
occupations=FermiDirac(width=0.01))
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
calc.write(name + '.gpw')
......@@ -12,7 +12,7 @@ atoms.center(vacuum=4.0)
# Create GPAW calculator
calc = GPAW(nbands=10, h=0.3)
# Attach calculator to atoms
atoms.set_calculator(calc)
atoms.calc = calc
# Calculate the ground state
energy = atoms.get_potential_energy()
......
......@@ -25,7 +25,7 @@ c.calculate(s)
lr = LrTDDFT(c, xc=exc, eps=0.1, jend=nconv - 1)
ex = ExcitedState(lr, iex, d=d)
s.set_calculator(ex)
s.calc = ex
ftraj = 'relax_ex' + str(iex)
ftraj += '_box' + str(box) + '_h' + str(h)
......
......@@ -12,7 +12,7 @@ calc = GPAW(h=0.25,
xc='LDA',
maxiter=300,
txt='unocc.txt')
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
calc.write('r-methyl-oxirane.gpw', mode='all')
......@@ -10,7 +10,7 @@ atoms.center(vacuum=6.0)
# Standard ground state calculation with empty states
calc = GPAW(nbands=100, h=0.4, setups={'Na': '1'})
atoms.set_calculator(calc)
atoms.calc = calc
energy = atoms.get_potential_energy()
calc.set(convergence={'bands' : 90},
......
......@@ -11,7 +11,7 @@ atoms.center(vacuum=6.0)
# Standard ground state calculation
calc = GPAW(nbands=2, h=0.4, setups={'Na': '1'})
atoms.set_calculator(calc)
atoms.calc = calc
energy = atoms.get_potential_energy()
calc.write('na2_gs.gpw', mode='all')
......
......@@ -15,7 +15,7 @@ calc = GPAW(mode='lcao', h=0.3, basis='dzp',
setups={'Na': '1'},
poissonsolver=poissonsolver,
convergence={'density': 1e-12})
atoms.set_calculator(calc)
atoms.calc = calc
energy = atoms.get_potential_energy()
calc.write('gs.gpw', mode='all')
......
......@@ -27,6 +27,6 @@ calc = GPAW(mode='lcao', xc='GLLBSC', h=0.3, nbands=360,
occupations=occupations, mixer=mixer, parallel=parallel,
maxiter=1000,
txt='gs.out')
atoms.set_calculator(calc)
atoms.calc = calc
atoms.get_potential_energy()
calc.write('gs.gpw', mode='all')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment