PDielec.Materials
#
Materials DataBase
An interface to the spreadsheet which holds materials data
Module Contents#
Classes#
A class representing a material with constant scalar permittivity, inheriting from the Material class. |
|
A subclass representing a material with a Lorentz-Drude model permittivity. |
|
A class for representing materials with externally specified permittivity. |
|
Class representing a material with a FPSQ model for permittivity. |
|
A class for representing materials with properties like name, density, permittivity, and unit cell. |
|
A class for managing a database of materials' properties. |
|
A class to define materials using the Sellmeier model for permittivity. |
|
A class for materials with tabulated permittivities. |
- class PDielec.Materials.Constant(name, permittivity=None, density=None, cell=None)[source]#
Bases:
Material
A class representing a material with constant scalar permittivity, inheriting from the Material class.
Attributes#
- typestr
The type of material, set to ‘Constant permittivity’.
Methods#
Inherits methods from the Material class.
- class PDielec.Materials.DrudeLorentz(name, epsinf, omegas, strengths, gammas, density=None, cell=None)[source]#
Bases:
Material
A subclass representing a material with a Lorentz-Drude model permittivity.
Parameters#
- namestr
The name of the material.
- epsinfarray_like
Epsilon infinity, either a 3x3 list or a 3x3 array representing the static dielectric constant.
- omegaslist
The transverse optical (TO) frequencies.
- strengthslist
The oscillator strengths for each resonance.
- gammaslist
The damping (or broadening) factors for each resonance.
- densityfloat, optional
The density of the material in grams per milliliter (g/ml). Default is None.
- cellunitCell, optional
The unit cell of the material. Default is None.
Notes#
The Drude-Lorentz model is used to calculate the permittivity of the material by considering the contributions from both free electrons (Drude) and bound electrons (Lorentz). This class requires specifying the infinite frequency dielectric constant (epsinf), the transverse optical frequencies (omegas), the oscillator strengths (strengths), and the damping factors (gammas) for each resonance in the material.
Examples#
>>> drude_lorentz_material = DrudeLorentz("Gold", [[1, 0, 0], [0, 1, 0], [0, 0, 1]], ... [0.5, 1.0], [1.0, 2.0], [0.2, 0.1], ... density=19.3) This represents a Drude-Lorentz material with the name "Gold", an isotropic epsilon infinity, two resonances with specified frequencies, strengths, and damping factors, and a density of 19.3 g/ml.
- class PDielec.Materials.External(name, permittivityObject=None, density=None, cell=None)[source]#
Bases:
Material
A class for representing materials with externally specified permittivity.
This class inherits from the Material class and is used to define materials where the permittivity is specified externally, rather than calculated or predefined. Permittivity can be a complex value indicating both the real and imaginary parts.
- class PDielec.Materials.FPSQ(name, epsinf, omega_tos, gamma_tos, omega_los, gamma_los, density=None, cell=None)[source]#
Bases:
Material
Class representing a material with a FPSQ model for permittivity.
Parameters#
- namestr
The name of the material.
- epsinfarray_like
Epsilon infinity (eps0), either a 3x3 list or a 3x3 array representing the dielectric constant at infinite frequency.
- omega_toslist
The transverse optical (TO) frequencies.
- gamma_toslist
The TO absorption widths.
- omega_loslist
The longitudinal optical (LO) frequencies.
- gamma_loslist
The LO absorption widths.
- densityfloat, optional
The density of the material in grams per milliliter (g/ml).
- cellunitCell, optional
The unit cell of the material.
Notes#
The FPSQ (fitted phonon simple quantum) model is used to describe the permittivity of the material. This model is based on the harmonic oscillator model and describes the permittivity as a function of frequency.
- class PDielec.Materials.Material(name, density=None, permittivityObject=None, cell=None)[source]#
A class for representing materials with properties like name, density, permittivity, and unit cell.
The Material class also contains the permittivity object for the material. The permittivity object is an instance of
DielectricFunction
or one its children. The permittivity object is responsible for calculating the permittivity at the given frequency. The subclasses which inherit from the Material class are: Constant, External, DrudeLorentz, FPSQ, Sellmeier, and Tabulated. Each subclass has an initialisation routine which instantiates the permittivity object of the appropriate type for the material. The relationship between the Material subclass and the DielectricFunction subclass of the permittivity object is shown below.Material subclass
DielectricFunction subclass
Constant
This class is passed a permittivity object which has been defined externally
Parameters#
- namestr
The name of the material.
- densityfloat, optional
The density of the material. If not provided and a cell is given, it will be calculated based on the cell.
- permittivityObject
DielectricFunction
, optional An object representing the dielectric function of the material. This is intended to be passed by classes that inherit from Material, and it should contain methods for calculating scalar/tensor permittivity. (see
DielectricFunction
and its sub-classes)- cell
UnitCell
, optional An object representing the unit cell of the material. If provided without a density, the density will be calculated from this cell. (See
UnitCell
)
Attributes#
- densityfloat
The density of the material, which may be calculated based on the cell if not provided initially.
- cellCell or None
The unit cell of the material if provided.
- namestr
The name of the material.
- typestr
A string indicating the type of the object. Defaults to ‘Base Class’ for the base Material class.
- permittivityObjectDielectricFunction or None
An object to handle the permittivity calculations for the material.
Methods#
- getName()
Returns the name of the material.
- getInformation()
Returns information about the material, including its type and, if applicable, its permittivity frequency range.
- getSigmas()
If the material has a lorentzian dielectric this routine returns the sigma parameters
- setSigmas()
If the material has a lorentzian dielectric this routine sets the sigma parameters
- getFrequencies()
If the material has a lorentzian dielectric this routine returns the frequencies
- setFrequencies()
If the material has a lorentzian dielectric this routine sets the frequencies
- getOscillatorStrengths()
If the material has a lorentzian dielectric this routine returns the oscillator strengths
- setOscillatorStrengths()
If the material has a lorentzian dielectric this routine sets the oscillator strengths
- print()
Prints information about the material, such as its name, density, type, and permittivity details.
- isScalar()
Checks and returns True if the material’s permittivity is scalar.
- isTensor()
Checks and returns True if the material’s permittivity is tensor.
- getPermittivityObject()
Returns the permittivityObject of the material.
- getPermittivityFunction()
Returns the permittivity function from the permittivityObject.
- getDensity()
Returns the density of the material.
- setCell(cell)
Sets the cell of the material and updates the density if it was initially None.
- getCell()
Returns the cell of the material.
- setDensity(value)
Sets the density of the material.
- setEpsilonInfinity(eps)
Sets the epsilon infinity of the material
- setPermittivityObject(permittivityObject)
Sets the permittivityObject for the material.
- getFrequencies()[source]#
Gets the frequencies for a Lorentzian permittivity
Parameters#
None
Returns#
- 1d array of floats
Returns the frequencies for a Lorentzian function in cm-1
- getInformation()[source]#
Returns information about the material.
Parameters#
None
Returns#
- str
A description of the material.
- getName()[source]#
Get the name attribute of the object.
Parameters#
None
Returns#
- str
The name attribute of the object.
- getOscillatorStrengths()[source]#
Gets the oscillator strengths for a Lorentzian permittivity
The oscillator strength of each transition is a 3x3 matrix
Parameters#
None
Returns#
- list of 3x3 array of floats
Returns the oscillator strengths for a Lorentzian permittivity function in cm-1
- getPermittivityFunction()[source]#
Returns the permittivity function.
Parameters#
None
Returns#
- permittivityObjectFunction
Return the permittivity object function
- getPermittivityObject()[source]#
Returns the permittivity object.
Parameters#
None
Returns#
- permittivityObject
Return the permittivity object (dielectric function object)
- getSigmas()[source]#
Gets the sigma parameters for a Lorentzian permittivity
Parameters#
None
Returns#
- 1d array of floats
Returns the sigma parameters for a Lorentz permittivity function in cm-1
- isScalar()[source]#
Returns true if the material returns a scalar permittivity.
Parameters#
None
Returns#
- bool
True if the material returns a scalar permittivity, False otherwise.
- isTensor()[source]#
Returns true if the material returns a tensor permittivity.
Parameters#
None
Returns#
- bool
True if the material returns a tensor permittivity, False otherwise.
- setFrequencies(frequencies)[source]#
Sets the frequencies for a Lorentzian permittivity
Parameters#
- frequencies1D array of floats
The frequencies for a Drude-Lorentzian permittivity in cm-1
Returns#
None
- setOscillatorStrengths(strengths)[source]#
Sets the oscillator strengths for a Lorentzian permittivity
Parameters#
- strengthsa 3x3 array of floats for each frequency
The oscillator strengths for a Lorentzian permittivity function in cm-1
Returns#
None
- class PDielec.Materials.MaterialsDataBase(filename, debug=False)[source]#
A class for managing a database of materials’ properties.
This database is initialized from an Excel spreadsheet which contains various material properties including names, densities, refractive indices, and permittivities, among others. Additional functionalities include validation checks, retrieval of sheet names, material information, and specific data based on the property of interest (e.g., constant permittivity, tabulated refractive index). The getMaterial() method returns a material with a dielectric function of the appropriate type. There are routines which read (process) the data stored for the following dielectric functions:
constant refractive index
constant permittivity
tabulated refractive index (may be 1, 3 or 6 parameters for isotropic, uniaxial or anisotropic)
tabulated permittivity (may be 1, 3 or 6 parameters for isotropic, uniaxial or anisotropic)
Lorentz-Drude
FPSQ (Four parameters semi-quantum model)
Sellmeier
Further information can be found in the following classes and their sub-classes:
Parameters#
- filenamestr
The filename of the spreadsheet/database.
- debugbool, optional
Set to true for additional debugging information
Attributes#
- filenamestr
The path to the Excel spreadsheet containing materials data.
- sheetNameslist
A list of strings representing the names of the sheets within the Excel spreadsheet.
- debugbool, optional
A flag indicating whether debugging information should be printed. Default is False.
Methods#
- __init__(filename, debug=False)
Initializes the MaterialsDataBase class with a given Excel spreadsheet and a debug flag.
- getFileName()
Returns the filename of the Excel spreadsheet being used as the database.
- valid()
Checks if the spreadsheet is a valid materials database based on certain criteria.
- getSheetNames()
Retrieves a sorted list of sheet names within the spreadsheet, including additional predefined names.
- getMaterial(sheet)
Returns a material object based on the data in a given sheet of the Excel spreadsheet.
- readConstantRefractiveIndex(sheet, worksheet, density)
Reads constant refractive index data for a given material from the spreadsheet.
- readConstantPermittivity(sheet, worksheet, density)
Reads constant permittivity data for a given material from the spreadsheet.
- readTabulatedRefractiveIndex(sheet, worksheet, density)
Reads tabulated refractive index data for a given material from the spreadsheet.
- readTabulatedPermittivity(sheet, worksheet, density)
Reads tabulated permittivity data for a given material from the spreadsheet.
- readLorentzDrude(sheet, worksheet, density, unitCell)
Reads Drude-Lorentz model parameters for a given material from the spreadsheet.
- readFPSQ(sheet, worksheet, density, unitCell)
Reads FPSQ model parameters for a given material from the spreadsheet.
- readSellmeier(sheet, worksheet, density, unitCell)
Reads Sellmeier model parameters for a given material from the spreadsheet.
- getMaterial(sheet)[source]#
Return a material object based on the data in sheet (an excel sheet).
If one of the following is requested: air, vacuum, ptfe, ldpe, mdpe, kbr, nujol, then the material is created even if it is not in the database.
Parameters#
- sheetExcel sheet
The excel sheet containing the material data.
Returns#
- Material object
The material object created from the excel sheet data.
- getSheetNames()[source]#
Returns a list of the sheetnames in the database.
As well as the sheets in the database, there are some default materials which will be added to the list of materials and which are provided internally by this module.
Parameters#
None
Returns#
- list
A list of the sheet names present in the database.
- readConstantPermittivity(sheet, worksheet, density)[source]#
Read constant permittivity data from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The worksheet instance.
- densityfloat
The density of the material.
Returns#
None
- readConstantRefractiveIndex(sheet, worksheet, density)[source]#
Read constant refractive index from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The worksheet.
- densityfloat
The density of the material.
Returns#
None
- readFPSQ(sheet, worksheet, density, unitCell)[source]#
Read FPSQ data from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The actual worksheet object.
- densityfloat
The density of the material.
- unitCellobject
The unit cell.
Returns#
None
- readLorentzDrude(sheet, worksheet, density, unitCell)[source]#
Read Drude-Lorentz data from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The worksheet.
- densityfloat
The density of the material.
- unitCellobject
The unit cell.
Returns#
None
- readSellmeier(sheet, worksheet, density, unitCell)[source]#
Read Sellmeier data from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The worksheet.
- densityfloat
The density of the material.
- unitCellobject
The unit cell.
Returns#
None
- readTabulatedPermittivity(sheet, worksheet, density)[source]#
Read tabulated permittivity data from the spreadsheet.
Parameters#
- sheetstr
The worksheet name.
- worksheetworksheet
The worksheet.
- densityfloat
The density of the material.
Returns#
None
- class PDielec.Materials.Sellmeier(name, Bs, Cs, density=None, cell=None)[source]#
Bases:
Material
A class to define materials using the Sellmeier model for permittivity.
Parameters#
- namestr
The name of the material.
- Bslist or array_like
The B parameters (coefficients) in the Sellmeier equation.
- Cslist or array_like
The C parameters (coefficients) in the Sellmeier equation.
- densityfloat, optional
The density of the material in g/ml. Default is None.
- cellunitCell, optional
The unit cell of the material. Default is None.
Attributes#
- typestr
The type of the material, which is ‘Sellmeier’ for instances of this class.
Methods#
- __init__(self, name, Bs, Cs, density=None, cell=None)
Initializes a Sellmeier material with specified parameters.
- class PDielec.Materials.Tabulated(name, vs_cm1=None, permittivities=None, density=None, cell=None)[source]#
Bases:
Material
A class for materials with tabulated permittivities.
Parameters#
- namestr
The name of the material.
- vs_cm1list or None, optional
The list of tabulated frequencies in cm-1. Defaults to None.
- permittivitiesarray-like or None, optional
The permittivities, either as a single vector (n,) or a tensor (3,n) or (6,n) for more complex materials. Defaults to None.
- densityfloat or None, optional
The density of the material in g/ml. Defaults to None.
- cellunitCell or None, optional
The unit cell of the material. Defaults to None.
Notes#
This class is designed to handle materials with a constant permittivity as well as those requiring more complex permittivity tensors.
The permittivity can be defined using either a scalar for simple materials or tensors for materials that require a support matrix.
The constructor converts the input lists of frequencies (vs_cm1) and permittivities into numpy arrays, and then generates the appropriate permittivity object depending on the complexity of the material’s permittivities.
Examples#
>>> material1 = Tabulated("Quartz", vs_cm1=[500, 1000, 1500], permittivities=[2.1, 2.3, 2.5], density=2.65) >>> material2 = Tabulated("Synthetic", vs_cm1=[200, 400, 600], permittivities=[[2.1, 2.3, 2.5], [2.4, 2.6, 2.8], [3.0, 3.2, 3.4]], density=1.5)