pymol_functions module

pymol_functions.calc_r(theta=0.0, phi=0.0, tensor=None)

Evaluate r from the polar function

pymol_functions.checkVecs(pairs, gauge='VE')

Use gaugeComp to check given pairs

pymol_functions.convert_cartesian(polar_coords)

Convert polar coordinates to Cartesian

Expects polar_coords to be a list of (r,theta,phi) tuples.

pymol_functions.coord_axes(x_scale=1.0, y_scale=1.0, z_scale=1.0, loc=None)

Display individually scalable coordinate axes

Adapted from https://pymolwiki.org/index.php/Axes

pymol_functions.createSphere(pos, radius=1.0, color='Yellow', transparency=0.5)

Draws a sphere representative of s-tilde magnitude

Parameters
  • pos (List of floats) – Indicates the x,y,z coordinates for the sphere to be drawn at

  • radius (Float) – Radius of sphere - default 1.0

  • color (String) – Color of sphere - default yellow

  • transparency (Float) – transparency value of sphere - default .5

Return value: None

pymol_functions.elec_mag(elec_end, mag_end, elec_scale=7, mag_scale=7, elec_start=[0.0, 0.0, 0.0], mag_start=[0.0, 0.0, 0.0], use_lab=True)

Main driver function for drawing arrows in PyMol. Calls cgo_arrow function with correct parameters

Parameters
  • elec_end (List of floats) – Endpoint of electric vector

  • mag_end (List of floats) – Endpoint of magnetic vector

  • elec_scale (int, optional - defaults to 7) – Scaling factor for electric vector

  • mag_scale (int, optional - defaults to 7) – Scaling factor for magnetic vector

  • elec_start (List of floats) – Starting point for electric vector - defaults to coordinate origin [0,0,0]

  • mag_start (List of floats) – Starting point for magnetic vector - defaults to coordinate origin [0,0,0]

Returns

None

pymol_functions.elec_mag_fromAtom(elec_end, mag_end, elec_scale=7, mag_scale=7, elec_start='sele', mag_start='sele')

Similar functionality to elec_mag, but draws arrow using atom as origin point

Parameters
  • elec_end (List of floats) – Endpoint of electric vector

  • mag_end (List of floats) – Endpoint of magnetic vector

  • elec_scale (int, optional - defaults to 7) – Scaling factor for electric vector

  • mag_scaling_factor (int, optional - defaults to 7) – Scaling factor for magnetic vector

  • elec_start (List of floats) – Starting point for electric vector - defaults to selected atom xyz coordinates

  • mag_start (List of floats) – Starting point for magnetic vector - defaults to selected atom xyz coordinates

Returns

None

pymol_functions.gaugeComp(vecs, freq=0.077357, max_len=4.0, use_lab=False)

Compares stilde vectors between gauges

Receives a dict with lg,mvg-m, and mvg-e lists of vectors. Draws them after rescaling relative to the longest. MVG vectors each receive a factor of (1/freq)^(0.5).

pymol_functions.loadCSV(filename)

Loads and display a CSV file via Panda dataframe

Parameters

filename (string) – Name of the file to be opened

Returns

Dataframe of the CSV opened

Return type

Dataframe

pymol_functions.multiple_vectors(indices, df, fromAtom=False)

Similar functionality to select_vectors, but calls select_vectors in a loop for a given list of indices to draw multiple arrows

Parameters
  • indices – Indices of dataframe where vector data will be selected from

  • df (Dataframe) – Dataframe containing vector data loaded previously

  • fromAtom (Boolean) – Boolean indicating whether or not the vector will be drawn using an atom as origin, defaults to False

Returns

None

pymol_functions.newLoad(filename)

Loads a new molecule file into PyMol, setting carbons to gray and using ball and stick representation

Parameters

filename – Name of molecule file to be opened

Returns

None

pymol_functions.polar_plot(tensor=None, Ntheta=150, Nphi=150, origin=None, scale=1.0, pos_color='Blue', neg_color='Orange', style='loop')

Generate a polar plot from the passed in tensor

Ntheta/Nphi give how many increments of theta/phi to sample. origin lets you select a displacement of the polar plot. scale is a factor applied to r for all points

Can also select colors for positive/negative portion (current default matches Autschbach) as well as style of the plot (‘points’ just plots vertices,

‘lines’ draws small segments between pairs of points, ‘loops’ draws a continuous line from the first to last point)

pymol_functions.select_vectors(index, df, fromAtom=False)

Pulls vector data from dataframe based on a given index. Automatically calls elec_mag to draw arrows

Parameters
  • index (Int) – Index of dataframe where vector data will be selected from

  • df (Dataframe) – Dataframe containing vector data loaded previously

  • fromAtom (Boolean) – Boolean indicating whether or not the vector will be drawn using an atom as origin, defaults to False

Returns

List of lists containing electric vector at index 0, magnetic vector at index 1

Return type

List of ints

pymol_functions.str_to_list(string, internalType='float')
Parameters
  • string (string, float, or np.ndarray) – Object to be converted to list of floats

  • internalType (string (,optional -) defaults to float) – String indicating the type of list to be converted to

Returns

Converted list of objectss

Return type

List of floats