addDoping¶
- addDoping(configuration, indices, charge, doping_type, tag=None)¶
Add doping to selected atoms in a configuration.
- Parameters:
configuration (AtomicConfiguration) – The configuration to affect.
indices (ndarray) – The indices of a selection of atoms in the configuration to which doping should be added.
charge (float) – The doping charge to apply. This value is interpreted as being in the unit e/atom.
doping_type (NType | PType) – The new doping type to apply to the tagged atoms.
tag (str | None) – The tag to assign to this doping selection.
Usage Examples¶
Add n-type doping to a selection of atoms in a Si crystal.
# --- Setup a configuration ---
# Set up lattice
vector_a = [5.4306, 0.0, 0.0]*Angstrom
vector_b = [0.0, 5.4306, 0.0]*Angstrom
vector_c = [0.0, 0.0, 16.291800000000002]*Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)
# Define elements
elements = [Silicon, Silicon, Silicon, Silicon, Silicon, Silicon, Silicon,
Silicon, Silicon, Silicon, Silicon, Silicon, Silicon, Silicon,
Silicon, Silicon, Silicon, Silicon, Silicon, Silicon, Silicon,
Silicon, Silicon, Silicon]
# Define coordinates
fractional_coordinates = [[ 0. , 0. , 0. ],
[ 0. , 0. , 0.333333333333],
[ 0. , 0. , 0.666666666667],
[ 0.25 , 0.25 , 0.083333333333],
[ 0.25 , 0.25 , 0.416666666667],
[ 0.25 , 0.25 , 0.75 ],
[ 0.5 , 0.5 , 0. ],
[ 0.5 , 0.5 , 0.333333333333],
[ 0.5 , 0.5 , 0.666666666667],
[ 0.75 , 0.75 , 0.083333333333],
[ 0.75 , 0.75 , 0.416666666667],
[ 0.75 , 0.75 , 0.75 ],
[ 0.5 , 0. , 0.166666666667],
[ 0.5 , 0. , 0.5 ],
[ 0.5 , 0. , 0.833333333333],
[ 0.75 , 0.25 , 0.25 ],
[ 0.75 , 0.25 , 0.583333333333],
[ 0.75 , 0.25 , 0.916666666667],
[ 0. , 0.5 , 0.166666666667],
[ 0. , 0.5 , 0.5 ],
[ 0. , 0.5 , 0.833333333333],
[ 0.25 , 0.75 , 0.25 ],
[ 0.25 , 0.75 , 0.583333333333],
[ 0.25 , 0.75 , 0.916666666667]]
# Set up configuration
bulk_configuration = BulkConfiguration(
bravais_lattice=lattice,
elements=elements,
fractional_coordinates=fractional_coordinates
)
# Add external potential
external_potential = AtomicCompensationCharge()
bulk_configuration.setExternalPotential(external_potential)
# Make a selection of atoms to add doping to
selected_indices = numpy.array([2, 5, 8, 11, 14, 17, 20, 23])
# --- Add doping ---
addDoping(
configuration=bulk_configuration,
indices=selected_indices,
charge=0.000200195107106,
doping_type=N_type,
tag='doping_0'
)
See also Notes on Doping.