I know .. I was able to try in VNL on windows, I got memory error .. then I tried on a very powerful linux machine with tons of memory ... segmentation fault ... I made the script first using VNL, following a tutorial ... my code looks like this:
device_configuration = nlread(<filename>, object_id="cfg")[0]
calculator2 = my_DeviceLCAOCalculator(oList, bias, 0.0*Volt)
device_configuration.setCalculator(calculator2)
device_configuration.update()
device_configuration = OptimizeGeometry(
device_configuration, max_forces=0.05*eV/Ang, max_steps=100, max_step_length=0.5*Ang,
trajectory_filename=None, disable_stress=True, optimizer_method=QuasiNewton())
def my_DeviceLCAOCalculator(oList, leftBias, rightBias):
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
LDABasis.Carbon_SingleZeta,
LDABasis.Boron_SingleZeta,
LDABasis.Hydrogen_SingleZeta,
LDABasis.Nitrogen_SingleZeta,
]
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
if oList["SCF"] == 1:
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
# set these for SCF
iteration_control_parameters=oList["iteration_control_parameters"],
)
right_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
# set these for SCF
iteration_control_parameters=oList["iteration_control_parameters"],
)
#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
basis_set=basis_set,
# set these for SCF
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
iteration_control_parameters=oList["iteration_control_parameters"],
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
electrode_voltages=( leftBias, rightBias )
)
else:
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
iteration_control_parameters=NonSelfconsistent,
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
)
right_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
iteration_control_parameters=NonSelfconsistent,
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
)
#----------------------------------------
# Device Calculator
#----------------------------------------
device_algorithm_parameters = DeviceAlgorithmParameters(
initial_density_type=NeutralAtom(electrode_constraint_length=0.0*Ang),
)
calculator = DeviceLCAOCalculator(
basis_set=basis_set,
numerical_accuracy_parameters=oList["numerical_accuracy_parameters"],
iteration_control_parameters=NonSelfconsistent,
device_algorithm_parameters = device_algorithm_parameters,
electrode_calculators= [left_electrode_calculator, right_electrode_calculator],
electrode_voltages=( leftBias, rightBias)
)
return calculator