from ATK.TwoProbe import *
from CalculateOptimizedTwoProbeGeometry import calculateOptimizedTwoProbeGeometry
def my_force_filter(forces):
for i in range(len(forces)):
forces[0] = 0.*eV/Ang
forces[1] = 0.*eV/Ang
return forces
from ATK.TwoProbe import *
# Li chain lattice constant
a = 2.90
# Construct the electrode unit cell
unit_cell = [ [3*a, 0.0, 0.0 ],
[0.0, 3*a, 0.0 ],
[0.0, 0.0, 4*a ] ] * Angstrom
# Define the electrode
electrode_Li = PeriodicAtomConfiguration(
super_cell_vectors=unit_cell,
elements=4*[Lithium],
fractional_coordinates=[(0.5, 0.5, float(i)/4.0) for i in range(0,4)]
)
# Setup the two-probe scattering region
# Distances between Li-H and H-H (found from relaxing a Li4H2 cluster)
dist_HH = 0.804
dist_LiH = 2.366
# The atoms in the central region
elements = 3*[Lithium] + 2*[Hydrogen] + 3*[Lithium]
positions = [
(0.0, 0.0, 0*a),
(0.0, 0.0, 1*a),
(0.0, 0.0, 2*a),
(0.2, 0.0, 2*a + dist_LiH), # First H
(0.0, 0.2, 2*a + dist_LiH + dist_HH), # Second H
(0.0, 0.0, 2*a + dist_LiH + dist_HH + dist_LiH + 0*a),
(0.0, 0.0, 2*a + dist_LiH + dist_HH + dist_LiH + 1*a),
(0.0, 0.0, 2*a + dist_LiH + dist_HH + dist_LiH + 2*a)
] * Angstrom
# Combine electrode and scattering region
# into a two-probe system
two_probe_conf = TwoProbeConfiguration(
electrodes = (electrode_Li,electrode_Li),
scattering_region_elements = elements,
scattering_region_cartesian_coordinates = positions
)
# Reduce basis set size for Li
basis_set_params = basisSetParameters(
type = SingleZeta,
element = Lithium
)
# Set k-points for electrodes
bz_int_param = brillouinZoneIntegrationParameters( (1,1,20) )
# Create parameters for electrodes
electrode_params = ElectrodeParameters(
brillouin_zone_integration_parameters = bz_int_param
)
# Collect parameters into a two-probe calculation method
method = TwoProbeMethod(
(electrode_params,electrode_params),
basis_set_parameters = basis_set_params,
electron_density_parameters = electronDensityParameters(mesh_cutoff = 70.0*Rydberg),
iteration_control_parameters = iterationControlParameters(tolerance = 1e-3),
electrode_voltages = (0.0, 0.0)*Volt
)
# Specify verbosity and checkpoint file
runtime_params = runtimeParameters(
verbosity_level = 1,
checkpoint_filename = 'lih2li-scf_tst.nc'
)
p = geometricOptimizationParameters (force_tolerance = 5.0e-2*eV/Ang, max_steps = 200)
x_constrained = [3,4]
y_constrained = [3,4]
fixed_atoms = [0,1,2,5,6,7]
# Perform SCF calculation with chosen parameters
relaxed_geometry,scf = calculateOptimizedTwoProbeGeometry (
two_probe_configuration = two_probe_conf,
method = method,
optimization_parameters = p,
runtime_parameters = runtime_params,
initial_calculation = restoreSelfConsistentCalculation ('lih2li-scf.nc'),
geometric_constraints = [x_constrained,y_constrained,[]],
fixed_atoms = fixed_atoms,
)
nlPrint(relaxed_geometry)