As you said, I converted the Au electrode-molecule-Au electrode device into a bulk configuration and perform a structure optimization in "Script Generator". So I wanted to optimize the molecule position in Z direction. In the "OptimizeGeometry" tool parameters, I was not sure whether to constrain the Au atom position.
# Set up lattice
vector_a = [5.7671629, 0.0, 0.0]*Angstrom
vector_b = [0.0, 5.7671629, 0.0]*Angstrom
vector_c = [0.0, 0.0, 24.27299996]*Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)
# Define elements
elements = [Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold, Gold, Gold, Gold, Gold, Chlorine, Sodium, Chlorine,
Sodium, Chlorine, Sodium, Sodium, Chlorine, Gold, Gold, Gold,
Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold, Gold]
constraints = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
bulk_configuration = OptimizeGeometry(
bulk_configuration,
max_forces=0.05*eV/Ang,
max_steps=200,
max_step_length=0.5*Ang,
constraints=constraints,
trajectory_filename=None,
disable_stress=True,
optimizer_method=QuasiNewton(),
)