open_viewmin.nematic.nematic#

Create plotter classes specific to nematic liquid crystals visualization

Module Contents#

Classes#

NematicPlot

Plotter class for nematic liquid crystals visualization, with the

NematicPlotNoQt

Plotter class for nematic liquid crystals visualization, with the

class open_viewmin.nematic.nematic.NematicPlot(filenames=None, q0=0.0, user_settings=None, data_format='open-Qmin', sep='\t', reader=None, theme=None, dims=None, data_stride=1, **kwargs)#

Bases: open_viewmin.filter_tree_plot_Qt.filter_tree_plot_Qt.FilterTreePlotQt, NematicPlotNoQt

Plotter class for nematic liquid crystals visualization, with the filters tree but without Qt.

Parameters:
  • filenames (list[str], str, or None, optional) – Files to import.

  • q0 (float, optional) – Chiral wavenumber for cholesteric (chiral nematic) ground state, used in free energy calculations.

  • user_settings (dict or None, optional) – Customizations to default plotter settings.

  • data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.

  • sep (str, optional) – Column delimiter for imported text file(s)

  • reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.

  • theme (['dark' | 'document' | 'paraview' | None], optional) – PyVista plot theme

  • off_screen (bool, optional) – Whether to render off-screen

  • notebook (bool, optional) – Whether to display inside of a Jupyter notebook

  • **kwargs – Keyword arguments to open_viewmin.FilterTreePlot

auto_setup(notebook=False)#

Routines to run after first importing data.

finish_setup_calculate_menu()#

Add nematic-specific items to the “Calculate” menu

setup_defects()#

Add single-value isosurface of uniaxial order to visualize defects

setup_director()#

Add glyphs to visualize nematic director on a plane controlled by a plane widget

show_jones(**kwargs)#

Display optical transmission, calculated from Jones matrices, on three planes.

Parameters:

kwargs (dict, optional) –

Returns:

callback that refreshes Jones planes by re-applying the control slider widgets

Return type:

callable()

class open_viewmin.nematic.nematic.NematicPlotNoQt(filenames=None, q0=0.0, user_settings=None, data_format='open-Qmin', sep='\t', reader=None, theme=None, off_screen=False, notebook=True, **kwargs)#

Bases: open_viewmin.filter_tree_plot.filter_tree_plot.FilterTreePlot

Plotter class for nematic liquid crystals visualization, with the filters tree but without Qt.

Parameters:
  • filenames (list[str], str, or None, optional) – Files to import.

  • q0 (float, optional) – Chiral wavenumber for cholesteric (chiral nematic) ground state, used in free energy calculations.

  • user_settings (dict or None, optional) – Customizations to default plotter settings.

  • data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.

  • sep (str, optional) – Column delimiter for imported text file(s)

  • reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.

  • theme (['dark' | 'document' | 'paraview' | None], optional) – PyVista plot theme

  • off_screen (bool, optional) – Whether to render off-screen

  • notebook (bool, optional) – Whether to display inside of a Jupyter notebook

  • **kwargs – Keyword arguments to open_viewmin.FilterTreePlot

property num_boundaries#

returns: Number of boundary objects :rtype: int

static Q33_from_Q5(q5)#

Convert 5-component Q-tensor information to 3x3 matrix

static Q_from_n(director_data)#

Create Q-tensor array from director data assuming S_0=1

_legacy_qmin_import(qtensor_filename)#

Reader for output from older Qmin (a.k.a. nematicvXX) code.

Note that while only the “Qtensor_…” files are supplied directly, this routine expects the associated “Qmatrix_…” files to be in the same directory.

Parameters:

qtensor_filename (str) – Filenames of “Qtensor_…”

Returns:

Imported data

Return type:

list[numpy.ndarray]

_pre_init(q0, data_format, reader, sep)#

Portion of initialization to run before open_viewmin.FilterTreePlot.__init__()

Parameters:
  • q0 (float) – Chiral wavenumber

  • data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.

  • reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.

  • sep (str, optional) – Column delimiter for imported text file(s)

Returns:

Reader

Return type:

callable()

add_circuits_around_points(points_mesh_name, normals_name, radius=3, n_samples=16, use_ints=False)#
analyze_disclination_at_picked_point(**kwargs)#
analyze_disclinations(defects_mesh_name='defects', n_centroids=50, tangents_glyph_name=None, **kwargs)#
analyze_disclinations_at_points(points_mesh_name, radius=3, n_samples=16, use_ints=False)#
auto_setup(notebook=True)#

Routines to run after first importing data.

calculate_Chi_tensor(refresh=True)#

Calculate Efrati-Irvine handedness pseudotensor.

Creates the tensor array “Chi”, the symmetric tensor arrays “Chi^T Chi” and “Chi Chi^T”, and the vector array “Omega from Chi”. Note that this calculation extends Efrati and Irvine’s construction to the Q-tensor rather than relying on the director field.

calculate_D_tensor(refresh=True)#

Calculate Schimming-Viñals tensor.

Creates the tensor array “D_tensor”, and the symmetric tensor arrays “D^T D” and “D D^T”.

calculate_Westin_metrics()#

Calculate Westin scalars measures from the Q-tensor.

Creates the scalar arrays “Westin_l”, “Westin_p”, “Westin_s”.

calculate_and_show_defect_tangent(glyph_stride=2, field_name=None, scale='nematic_sites', mesh_name='defects', threshold=0.4)#

Display disclination line tangent vectors as glyphs

Parameters:
  • glyph_stride (int, optional) – Typical spacing between glyphs

  • field_name (str or None, optional) – Proposed name for new tangent vector field array

  • scale (str, optional) – Name of scalar array to use for glyph size scale.

  • mesh_name (str, optional) – Name of defects mesh

  • threshold (float or None, optional) – Minimum value of 1/S for deciding which points to include in tangent calculation.

Returns:

Name of new glyphs mesh

Return type:

str

calculate_defect_tangent(threshold=0.4, mesh_name='defects', field_name=None)#

Calculate the unit tangent field to defect lines.

Parameters:
  • threshold (float or None, optional) – Minimum value of 1/S for deciding which points to include in tangent calculation.

  • mesh_name (str, optional) – Name of defects mesh

  • field_name (str or None, optional) – Proposed name for new tangent vector field array

Returns:

Name of new tangent vector field array

Return type:

str

calculate_frank_energy_comps()#

Calculate splay, twist, and bend Frank free energy densities and related quantities.

calculate_n_gradients(refresh=True)#
calculate_rotation_vector_n()#
create_fullmesh(dat=None, mesh_name='fullmesh', frame_num=None)#
static director_data_import(filename, sep='\t')#

Import nematic director data and convert it into Q-tensor data in the open-Qmin data_format.

Parameters:
  • filename (str) –

  • sep (str, optional) –

Returns:

Q-tensor data in the open-Qmin data_format.

Return type:

numpy.ndarray

load(filenames, **kwargs)#
max_re_eigval(a)#

Maximum real part of eigenvalue for eigenvalues in an array of 3x3 matrices

Parameters:

a (numpy.ndarray | pyvista.pyvista_ndarray) – Array of 3x3 matrices

Returns:

Maximum real part of eigenvalues

Return type:

numpy.ndarray

static n_from_Q(q_matrix)#

Get director from 3x3-matrix Q-tensor data

nematic_calculations(dat, mesh)#

Assign Q-tensor and director field data to a mesh, and conduct calculations based on them.

Parameters:
  • dat (numpy.ndarray) – Data array of floats in the open-Qmin data_format: x y z Qxx Qxy Qxz Qyy Qyz site_type S

  • mesh (pyvista.DataSet) –

pick_point_analyze_disclination(**kwargs)#
plot_director_glyphs_on_circuits(points_mesh_name, circuits_formula, result_name='director_on_circuits', defects_mesh_name='defects')#
post_init()#

Portion of initialization to run after open_viewmin.FilterTreePlot.__init__()

set_director(director_data, mesh_name=None)#

Set director orientation data directly from an array.

Parameters:
  • director_data (numpy.ndarray) –

  • mesh_name (str or None, optional) – Name of mesh on which to define director

set_q0(q0)#

Set energetically preferred cholesteric wavenumber.

(Re)calculates arrays that depend on q0.

Parameters:

q0 (float) – Chiral wavenumber

set_qtensor(q_data, mesh)#

Set Q-tensor data directly from an array.

Parameters:
  • q_data (numpy.ndarray) – Q-tensor data with each row formatted as [Qxx, Qxy, Qxz, Qyy, Qyz]

  • mesh (pyvista.DataSet) –

Returns:

Q-tensor data reformatted such that each row contains the nine elements of the symmetric Q-tensor matrix, flattened.

Return type:

numpy.ndarray

setup_boundaries(separate_meshes=False)#

Add isosurface or isosurfaces for boundaries.

Parameters:

separate_meshes (bool, optional) – Whether to create a separate isosurface mesh for each boundary.

setup_defects()#

Add single-value isosurface of uniaxial order to visualize defects

setup_director()#

Add glyphs to visualize nematic director on a plane controlled by a plane widget

show_jones(**kwargs)#