Skip to content

Commit

Permalink
Merge pull request #201 from timcallow/better_defaults
Browse files Browse the repository at this point in the history
Use a better set of defaults
  • Loading branch information
timcallow authored Oct 4, 2023
2 parents 2dc1caa + dd36ba1 commit d8e5ed4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
14 changes: 7 additions & 7 deletions atoMEC/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
spinpol = False # spin-polarized functional
xfunc_id = "lda_x" # exchange functional (libxc ref)
cfunc_id = "lda_c_pw" # correlation functional (libxc ref)
bc = "dirichlet" # boundary condition
unbound = "ideal" # treatment for unbound electrons
bc = "bands" # boundary condition
unbound = "quantum" # treatment for unbound electrons
v_shift = True # whether to shift the KS potential vertically

# numerical grid for static calculations
grid_params = {"ngrid": 1000, "x0": -12, "ngrid_coarse": 300, "s0": 1e-3}
grid_params = {"ngrid": 500, "x0": -12, "ngrid_coarse": 300, "s0": 1e-3}
# convergence parameters for static calculations
conv_params = {
"econv": 1.0e-5,
"nconv": 1.0e-4,
"econv": 1.0e-6,
"nconv": 1.0e-5,
"vconv": 1.0e-4,
"eigtol": 1.0e-4,
"bandtol": 1.0e-3,
}
# scf parameters
scf_params = {"maxscf": 50, "mixfrac": 0.3}
# band parameters for massacrier band model
band_params = {"nkpts": 50, "de_min": 1e-3}
band_params = {"nkpts": 30, "de_min": 1e-3}

# forced bound energy levels (default none)
force_bound = []

grid_type = "log"
grid_type = "sqrt"

# parallelization
numcores = 0 # defaults to serial
1 change: 1 addition & 0 deletions tests/boundary_conditions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def _run(bc):

if __name__ == "__main__":
config.numcores = -1
config.fp = np.float32
dirichlet = TestBcs._run("dirichlet")
neumann = TestBcs._run("neumann")
bands = TestBcs._run("bands")
Expand Down
11 changes: 6 additions & 5 deletions tests/functionals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


# expected values and tolerance
lda_expected = -158.66453567079228
gdsmfb_expected = -158.6079090856573
no_xc_expected = -144.49795725080637
no_hxc_expected = -249.50772961499766
gga_expected = -159.37528906276566
lda_expected = -161.13694055882937
gdsmfb_expected = -161.07726791735197
no_xc_expected = -147.69699056522276
no_hxc_expected = -249.7299062816172
gga_expected = -161.79172099868805
accuracy = 1e-3


Expand Down Expand Up @@ -91,6 +91,7 @@ def _run(func):
6,
scf_params={"maxscf": 5, "mixfrac": 0.3},
grid_params={"ngrid": 1000},
band_params={"nkpts": 30},
)

# extract the total free energy
Expand Down
6 changes: 5 additions & 1 deletion tests/localization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ def _run_SCF(spinpol):

# set up the atom and model
Al_at = Atom("Al", 0.01, radius=5.0, units_temp="eV")
model = models.ISModel(Al_at, unbound="quantum", spinpol=spinpol)
model = models.ISModel(
Al_at, unbound="quantum", bc="dirichlet", spinpol=spinpol
)

# run the SCF calculation
output = model.CalcEnergy(
Expand Down Expand Up @@ -136,6 +138,7 @@ def _run_ELF(input_SCF, method, spinpol):
unbound=input_SCF["model"].unbound,
spinpol=input_SCF["model"].spinpol,
write_info=False,
bc="dirichlet",
)

ELF = localization.ELFTools(
Expand Down Expand Up @@ -177,6 +180,7 @@ def _run_epdc(input_SCF, method, spinpol):
unbound=input_SCF["model"].unbound,
spinpol=input_SCF["model"].spinpol,
write_info=False,
bc="dirichlet",
)

ELF = localization.ELFTools(
Expand Down
1 change: 1 addition & 0 deletions tests/pressure_test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _run_SCF():
grid_params={"ngrid": 1000},
band_params={"nkpts": 50},
verbosity=1,
grid_type="log",
)

output_dict = {"Atom": Li_at, "model": model, "SCF_out": output}
Expand Down
2 changes: 1 addition & 1 deletion tests/unbound_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _run():
units_temp="eV",
units_radius="angstrom",
)
model = models.ISModel(Be_at, unbound="ideal")
model = models.ISModel(Be_at, unbound="ideal", bc="dirichlet")

# run the SCF calculation
output = model.CalcEnergy(
Expand Down

0 comments on commit d8e5ed4

Please sign in to comment.