crystals package

Submodules

crystals.RCD_CubicLattice module

BFDTD+GWL class system + GUI:

class PhotonicCrystallineDiamond(object):
  '''
  Also known as:
  -Photonic Crystalline Diamond (PCD)
  -ice crystal
  -spin-ice
  -diamond
  '''

  def __init__(self,
    mesh = None):
    return

class PhotonicCrystallineDiamond_F_RD(PhotonicCrystallineDiamond):
  def __init__(self,
    mesh = None):
    return

But then we will want defects… :/ There is no way out. We need GUIs (with script support and parameter based structure design (like in RSOFT))…

idea: The RCD class should use generic lines/cylinders (independent of FDTD or GWL usage). It could even define multiple different ones (ex: vertical and non-vertical lines).
These lines/cylinders could then be actually written using different classes: parallelepiped, spiral cylinder, flat lines, BFDTD cylinders, etc Depending on the chosen class (or maybe even class instance, which would then be copied over), different attributes like permittivity, writing direction, voxel distance, etc could then be defined. The generic crystal should store a list of lines to write with maybe an indication on whether or not to connect the current line to the next one ([a,b,c] instead of [[a,b],[b,c]]). (This mean it could be a GWLobject. The subclasses would just read the GWL object and replace A-B lines with some other random structure from A to B.) To optimize speed, it would be better to pass the “line function” to the writer process instead of first getting a list of lines and then looping through it again to write.

attributes:

  • output location (only used on writing, does not need to be an object attribute (except maybe for BFDTD or other classes writing multiple files)):
    • outdir’, action=”store”, dest=”outdir”, default=tempfile.gettempdir(), help=’output directory’)
    • basename’, action=”store”, dest=”basename”, default=’RCD’, help=’output basename’)
  • general RCD properties:
    • cube_side”, help=”length of unit cube side”, type=float, default=2.8)
    • Nx”, help=”number of periods in the X direction”, type=int, default=3)
    • Ny”, help=”number of periods in the Y direction”, type=int, default=3)
    • Nz”, help=”number of periods in the Z direction”, type=int, default=3)
    • “–centro_X”, help=”Centre X position”, type=float, default=0)
    • “–centro_Y”, help=”Centre Y position”, type=float, default=0)
    • “–centro_Z”, help=”Centre Z position”, type=float, default=0)
  • GWL:
    • special attributes (not sure where to put them):
      • TopDownWriting/downwardWriting”, help=”Write from top to bottom”, action=”store_true”, default=True)
    • GWLobject properties:
      • “–set-lower-to-origin”, help=’offset structure so that its “lower corner” is moved to the (0,0,0) coordinates. This will make all coordinates positive.’, action=”store_true”)
      • GWL power compensation:
        • “–write-power”, help=”Write power values using the power compensation (PC) parameters.”, action=”store_true”)
        • “–PC_laser_power_at_z0”, help=”PC: laser power at z0”, type=float, default=100)
        • “–PC_slope”, help=”PC: power compensation slope”, type=float, default=0)
        • “–PC_interfaceAt”, help=”PC: interface position”, type=float, default=0)
        • “–PC_bool_InverseWriting”, help=”PC: To write a file designed for use with the InvertZAxis command”, action=”store_true”, default=False)
        • “–PC_float_height”, help=’PC: “substrate height”, in practice just a value added to the interfaceAt value’, type=float, default=0)
        • “–PC_bool_LaserPowerCommand”, help=”PC: Use the LaserPower command instead of a 4th coordinate for power.”, action=”store_true”, default=False)
    • GWL Parallelepiped:
      • rod_height”, help=”rod height”, type=float, default=0.375)
      • rod_width”, help=”rod width”, type=float, default=0.25)
      • connected”, help=”connect lines”, action=”store_true”)
      • orthogonal”, help=’orthogonal “z-axis”’, action=”store_true”)
      • axis0”, help=”index of axis 0”, choices=[0,1,2], default=0, type=int)
      • axis1”, help=”index of axis 1”, choices=[0,1,2], default=1, type=int)
      • axis2”, help=”index of axis 2”, choices=[0,1,2], default=2, type=int)
      • N0”, help=”number of lines along axis 0”, type=int, default=3)
      • N1”, help=”number of lines along axis 1”, type=int, default=3)
      • N2”, help=”number of lines along axis 2”, type=int, default=3)
    • GWL Cylinder/Tube:
      • “–method”, help=”writing method”, type=str, choices=[‘spiral’, ‘vertical lines’, ‘horizontal disks’], default=’spiral’)
      • inner_radius
      • outer_radius
      • “–PointDistance_r”, help=”PointDistance_r”, type=float, default=0.2)
      • “–PointDistance_theta”, help=”PointDistance_theta”, type=float, default=0.2)
      • “–PointDistance_z”, help=”PointDistance_z”, type=float, default=0.2)
      • “–zigzag”, help=”zigzag”, action=”store_true”)
      • “–rotateSpirals”, help=”rotateSpirals”, action=”store_true”)
      • “–add_flat_ends”, help=”add_flat_ends”, action=”store_true”)
      • “–closed_loop”, help=”closed_loop”, action=”store_true”)
  • BFDTD:
    • BFDTD RCD properties:
      • cylinder_radius_normalized
      • BFDTD refractive indices:
        • n_defect
        • n_crystal
        • n_backfill
    • BFDTD .inp file:
      • fmin_normalized
      • fmax_normalized
    • BFDTD defect:
      • i_sub_defect
      • k_sub_defect
class crystals.RCD_CubicLattice.RCD_CubicLattice[source]

Bases: object

Note

Keeping thing independent from GWL and BFDTD here for the moment.

  • cube_side: length of unit cube side
  • Nx: number of periods in the X direction
  • Ny: number of periods in the Y direction
  • Nz: number of periods in the Z direction
  • location
  • rotation (later)
add_arguments(parser)[source]
createRCD(line_structure_function)[source]
location
setAttributesFromParsedOptions(options)[source]
class crystals.RCD_CubicLattice.RCD_GWL_Cylinder[source]

Bases: GWL.GWL_parser.GWLobject, crystals.RCD_CubicLattice.RCD_CubicLattice

addTube(start_point, end_point)[source]
add_arguments(parser)[source]

Adds GWLobject related arguments to the given parser (an argparse.ArgumentParser instance).

See also: setAttributesFromParsedOptions()

computePoints()[source]
get_argument_parser()[source]
method
setAttributesFromParsedOptions(options)[source]

Sets the object’s attributes based on the ones from the options object (usually an argparse.ArgumentParser instance).

See also: add_arguments()

writeFromParsedOptions(options)[source]
class crystals.RCD_CubicLattice.RCD_GWL_Parallelepiped[source]

Bases: GWL.GWL_parser.GWLobject, crystals.RCD_CubicLattice.RCD_CubicLattice

addParallelepiped(start_point, end_point)[source]
add_arguments(parser)[source]

Adds GWLobject related arguments to the given parser (an argparse.ArgumentParser instance).

See also: setAttributesFromParsedOptions()

computePoints()[source]
get_argument_parser()[source]
setAttributesFromParsedOptions(options)[source]

Sets the object’s attributes based on the ones from the options object (usually an argparse.ArgumentParser instance).

See also: add_arguments()

writeFromParsedOptions(options)[source]
crystals.RCD_CubicLattice.createIceCrystal_BFDTD(DSTDIR, Nx, Ny, Nz, n_defect, n_crystal, n_backfill, cylinder_radius_normalized, fmin_normalized, fmax_normalized, i_sub_defect=0, k_sub_defect=1)[source]

To prepare a BFDTD simulation with an RCD/FRD structure.

Warning

FRD currently broken! + 2 backfills are created in the case of FRD. DO NOT USE AS IS!!!

BFDTD export WIP

  • a : unit cube size
  • c0 : speed of light
  • Nx : number of periods in the X direction
  • Ny : number of periods in the Y direction
  • Nz : number of periods in the Z direction
  • n_defect : refractive index of the defect
  • n_crystal : refractive index of the crystal
  • n_backfill : refractive index of the backfill
  • cylinder_radius_normalized : r/a
  • excitation_frequency_normalized : f/(c0/a)
  • fmin_normalized : fmin/(c0/a)
  • fmax_normalized : fmax/(c0/a)

working in mm, ms, kHz

crystals.RCD_CubicLattice.createIceCrystal_GWL_TopDown(DSTDIR)[source]

layer by layer

crystals.RCD_CubicLattice.createIceCrystal_GWL_TopDownFlatLines(DSTDIR)[source]

layer by layer

crystals.RCD_CubicLattice.createIceCrystal_GWL_WithCylinders(DSTDIR)[source]

unit cell by unit cell

crystals.RCD_CubicLattice.createIceCrystal_GWL_singleLine_UnitcellByUnitcell(DSTDIR)[source]

unit cell by unit cell

crystals.RCD_CubicLattice.test_RCD_BFDTD_0()[source]
crystals.RCD_CubicLattice.test_RCD_BFDTD_1()[source]
crystals.RCD_CubicLattice.test_RCD_BFDTD_2()[source]
crystals.RCD_CubicLattice.test_RCD_BFDTD_unitcell()[source]
crystals.RCD_CubicLattice.test_RCD_GWL()[source]

Module contents