Table Of Contents

Previous topic

The ScatPy API

Next topic

ScatPy.fileio

This Page

ScatPy.core

A set of tools for setting up and working with the program DDScat.

Class Summary

Settings([folder]) DDSCAT execution parameters
DDscat([folder, settings, target]) A class for managing a DDSCAT run.

Class Definitions

A set of tools for setting up and working with the program DDScat.

class ScatPy.core.DDscat(folder=None, settings=None, target=None)[source]

Bases: object

A class for managing a DDSCAT run.

Loosely a DDscat object includes two parts: a settings file and a target.

All parameters are optional. If they are not specified, DDscat defaults to the settings found in the file default.par. :param folder: The subfolder in which to store files. :param settings: The Settings object for this run. :param target: The targets.Target for this run. Defaults to a Au sphere.

Example:

# Build a target
t=CYLNDRCAP(0.100, 0.030):        

# Initialize a DDscat run
d=DDscat(target=t)

# Modify run parameters as desired
d.settings.NAMBIEND=1.5
d.settings.Epol=np.array([0, 1j, 1])

# Write the output and run the simulation
d.calculate()

# Load the results
r=results.FolderCollection()

# Plot them
r.plot()
VTRconvert(outfile=None)[source]

Convert the target shape into a form viewable in Paraview

alpha[source]

Calculate the alpha parameter (Userguide Eqn 8, p8).

beta[source]

Calculateth beta parameter (Userguide Eqn 8, p8).

calculate(silent=False)[source]

Start local calculation of this run.

This assumes that `ddscat` is in the path.

Parameters:silent – If true suppresses output to the screen
calltarget()[source]

Executes `calltarget` to generate a target.out file for builtin target geometries.

check()[source]

Perform simple self consistency checks on the job.

Raises an exception if it finds a problem.

copy()[source]

Make a copy of this run.

folder[source]

This run’s home folder

classmethod fromfile(fname)[source]

Create new DDscat object with values loaded from the specified file.

info()[source]

Print some basic run info

mkd[source]

Calculate m*k*d (Userguide p8).

target[source]

The run’s target

write(*args, **kwargs)[source]

Write the .par file and target definitions to file.

Parameters:
  • args – Optional arguments and kwargs are passed to the profile_script
  • submit_script – Use True to write a .sge file for submitting the job to an SGE cluster via `qsub`.

If the current profile defines a function `write_script` then this is run after the ddscat.par has been written, and is called with any addition arguments to write.

x[source]

Calculate the x-parameter (Userguide p8).

class ScatPy.core.Settings(folder=None, **kwargs)[source]

Bases: object

DDSCAT execution parameters

Most of the field names correspond to their definitions in the ddscat.par file. Details of the target are stored in the `Target` definition, not here.

CALPHA = 'GKDLDR'

Prescription for polarizabilities (GKDLDR, LATTDR)

CBINFLAG = 'NOTBIN'

Specify binary output

CMDFFT = 'GPFAFT'

FFT method (GPFAFT, FFTMKL)

CMDFRM = 'LFRAME'

Specify reference frame for scattering (‘LFRAME’, ‘TFRAME’)

CMDSOL = 'PBCGS2'

= CMDSOL*6 (PBCGS2, PBCGST, GPBICG, PETRKP, QMRCCG) –

CMDTRQ = False

Either do or skip torque calculations (True:’DOTORQ’, False:’NOTORQ’)

ETASCA = 0.5

Angular resolution for calculation of <cos>, etc. (number of angles is proportional to [(3+x)/ETASCA]^2 )

Epol = array([ 0.+0.j, 0.+0.j, 1.+0.j])

Define Incident Polarizations (Polarization state e01 (k along x axis)

GAMMA = 0.01

Interaction cutoff parameter for PBC calculations (1e-2 is normal, 3e-3 for greater accuracy)

IORTH = True

Specify whether to calculate orthogonal polarization state (True, False)

IWRKSC = True

Specify which output files to write (True: write ”.sca” file for each target orient. False: suppress)

InitialMalloc = None

Initial Memory Allocation. None will attempt to automatically size the initial malloc

MXITER = 600

Maximum number of iterations

NAMBIENT = 1.0

Refractive index of ambient medium

NRFLD = False

Either do or skip nearfield calculations (True, False)

NRFLD_EXT = array([ 0., 0., 0., 0., 0., 0.])

Fractional extension of calculated volume in (-x,+x,-y,+y,-z,+z)

S_INDICES = [11, 12, 13, 14, 21, 22, 31, 41, 44]

Select Elements of S_ij Matrix to Print

TOL = 1e-05

Error Tolerence.

beta = <ScatPy.ranges.Lin_Range instance at 0x10dfea6c8>

Prescribe Target Rotation beta (rotation around a1). (betamin, betamx, nbeta)

copy()[source]

Make a copy of these settings.

classmethod fromfile(fname)[source]

Create new Settings object with values loaded from the specified file.

initial = [0, 0, 0]

Specify first IWAV, IRAD, IORI (0 0 0 to begin fresh)

phi = <ScatPy.ranges.Lin_Range instance at 0x10dfea488>

Prescribe Target Rotation phi (rotation of a1 around k). (phimin, phimax, nphi)

scale_range = <ScatPy.ranges.How_Range instance at 0x10dfea7a0>

Define a range of scales for the particle geometry. A number indicates a single size calc.

scat_planes = [<ScatPy.ranges.Scat_Range instance at 0x10e7627e8>, <ScatPy.ranges.Scat_Range instance at 0x10e762830>]

Specify Scattered Directions

theta = <ScatPy.ranges.Lin_Range instance at 0x10dfea560>

Prescribe Target Rotation theta (angle between a1 and k). (thetamin, tetamx, ntheta)

wavelengths = <ScatPy.ranges.How_Range instance at 0x10dfeaa70>

Vacuum wavelengths (first,last,how many,how=LIN,INV,LOG)

ScatPy.core.config = {'profile': '/Users/andrewmark/.ScatPy/default.py', 'name': 'system_default', 'path_style': <module 'posixpath' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.pyc'>, 'ddscat_path': '/usr/local/bin/', 'os': 'unix', 'mat_library': '~/Documents/Analysis/ddscat/mp/'}

The configuration settings

ScatPy.core.pol_cL = array([ 0.+0.j, 1.+0.j, 0.+1.j])

Define polarization states using the spectroscopists’ convention

ScatPy.core.set_config(fname=None)[source]

Select which configuration profile to use for ScatPy

Parameters:fname – The name of the file that contains the configuration If None then load the default profile

Profiles are stored in Python script files.

The search scheme is to first look for the file in the CWD, followed by the folder ~/.ScatPy/ and finally the subdiretory profiles/ relative to where the config.py module resides.