ProjectionList¶
- class ProjectionList(atoms=None, elements=None, angular_momenta=None)¶
Class for representing a list of orbitals. Results of many analysis objects, e.g. MolecularEnergySpectrum, can be projected onto this limited set of orbitals.
- Parameters:
atoms (list of int |
All
) – List of integers specifying the atom indices to include in the projection list. Default:All
elements (list of
PeriodicTableElement
|All
) – List of elements to include in the projection list Default:All
angular_momenta (list of int |
All
) – List of angular momenta, specified as integers (0=s, 1=p, …), to include in the projection list Default:All
- angularMomenta()¶
- Returns:
The angular momenta which are included in the projection list.
- Return type:
list of int
- atoms()¶
- Returns:
The atom indices which are included in the projection list.
- Return type:
list of int
- elements()¶
- Returns:
The elements which are included in the projection list.
- Return type:
list of
PeriodicTableElement
- includeAll()¶
- Returns:
True
if we include all orbitals as targets.- Return type:
bool
- orbitalIndex(configuration)¶
Generate a list with indices of the orbitals in the projection list
- Parameters:
configuration (
MoleculeConfiguration
|BulkConfiguration
|DeviceConfiguration
|SurfaceConfiguration
) – The configuration to extract orbital index from- Returns:
A list with orbital indices
- Return type:
list of int
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Examples¶
Calculate the Nitrogen s level within an ammonia molecule:
# Set up configuration
molecule_configuration = MoleculeConfiguration(
elements=[Nitrogen, Hydrogen, Hydrogen, Hydrogen],
cartesian_coordinates= [[ 0. , 0. , 0.124001],
[ 0. , 0.941173, -0.289336],
[ 0.81508 , -0.470587, -0.289336],
[-0.81508 , -0.470587, -0.289336]]*Angstrom )
# Define the calculator
calculator = HuckelCalculator()
molecule_configuration.setCalculator(calculator)
# Calculate and save the molecular energy spectrum
molecular_energy_spectrum = MolecularEnergySpectrum(
configuration=molecule_configuration,
energy_zero_parameter=AbsoluteEnergy,
projection_list=ProjectionList(elements=[Nitrogen], angular_momenta = [0])
)
nlsave('molecular.hdf5', molecular_energy_spectrum)
# Extract the energy
energy = molecular_energy_spectrum.evaluate()
occ = molecular_energy_spectrum.occupation()
# ... and print it out
print("level energy(eV) occupation")
for i in range(len(energy[0])):
print(' %d %12.4f %12.4f ' % (i, energy[0][i].inUnitsOf(eV),occ[0][i]))