johnaparker / miepy Goto Github PK
View Code? Open in Web Editor NEWPython module to solve Maxwell's equations for a cluster of particles using the generalized multiparticle Mie theory (GMMT)
License: GNU General Public License v3.0
Python module to solve Maxwell's equations for a cluster of particles using the generalized multiparticle Mie theory (GMMT)
License: GNU General Public License v3.0
Type annotations should be added: https://docs.python.org/3/library/typing.html
200 nm diameter Si particles have electric and magnetic dipole modes. This comparison will ensure the electric and magnetic coupling are correct.
The current OpenMP implementation is not optimal (2x performance for 8 threads). There are two parts to OpenMP acceleration: building the interaction matrix (A), and solving the linear system Ax = b.
The issue for building A is probably load-balancing: the A/B vsh translation coefficients involve recursion relations that depend on inter-particle separation. Some threads will finish before others.
The issue for solving Ax = b is less obvious. Since this is a widely famous problem, it's worth looking into existing software solutions.
There are a few things that can easily be parallelized: source decomposition, cross-section evaluation, force/torque evaluation, E/H field evaluation
Lastly, there are two algorithm optimizations not being used:
Currently, MiePy utilizes the normal incidence approximation (NIA) for dealing with a substrate. The exact solution is outlined in [1].
miepy.interface
, add a bool parameter nia = True
to toggle NIA (default True until exact solution is implemented)Note
If the following bug occurs:
auditwheel: error: cannot repair "/io/.build_wheels/wheelhouse/miepy-0.5.0-cp38-cp38-linux_x86_64.whl" to "manylinux2010_x86_64" ABI because of the presence of too-recent versioned symbols. You'll need to compile the wheel on an older toolchain
it may be due to lingering .o
or .mod
files in the nfmds folder. Running make clean
will remove all build files.
Implement all of the symmetry
options to miepy.cluster
i try to install the module of meep_ext but not exist, could you tell me where it is? thank you
The cluster T-matrix can be computed from a solved miepy.cluster
or miepy.sphere_cluster
https://github.com/johnaparker/miepy/blob/issue_2/miepy/tmatrix/cluster_tmatrix.py
miepy.sphere_cluster_particle
is currently implemented using NFMDS, but would be more general implemented in this wayXu.-.2003.-.Radiative.scattering.properties.of.an.ensemble.of.pdf
Eqs. (49-53) for the cluster T-matrix
For a system of dipoles and nanoparticles, the expansion coefficients of the source and system can be calculated with this:
def get_p_src(cluster, origin=[0,0,0]):
"""get the p_src expansion coefficients; assumes all sources are dipoles
Arguments:
cluster miepy.cluster or miepy.sphere_cluster
origin origin around which to obtain expansion
"""
if isinstance(cluster.source, miepy.sources.combined_source):
p_src = []
positions = []
for dipole in cluster.source.sources:
p_src_d = np.zeros([2,3], dtype=complex)
p_src_d[0] = (dipole.weight[-1], dipole.weight[0], dipole.weight[1])
p_src.append(p_src_d)
positions.append(dipole.position)
p_src = np.asarray(p_src)
positions = np.asarray(positions)
else:
dipole = cluster.source
p_src = np.zeros([2,3], dtype=complex)
p_src[0] = (dipole.weight[-1], dipole.weight[0], dipole.weight[1])
positions = np.array([dipole.position])
p_src = np.array([p_src])
return miepy.cluster_coefficients(positions, p_src,
cluster.material_data.k_b, origin, lmax=cluster.lmax)
def get_p_scat(cluster, origin=[0,0,0]):
"""get the p_scat expansion coefficients of the nanoparticles
Arguments:
cluster miepy.cluster or miepy.sphere_cluster
origin origin around which to obtain expansion
"""
return miepy.cluster_coefficients(cluster.position, cluster.p_scat,
cluster.material_data.k_b, origin=origin, lmax=cluster.lmax)
Then the flux of the source (P0) and system (P) is:
Z0 = miepy.constants.Z0
k = 2*np.pi/wavelength
p_src = get_p_src(cluster)
p_scat = get_p_scat(cluster)
P0 = 0.5/Z0*np.pi/k**2*np.sum(np.abs(p_src)**2) # power source
P = 0.5/Z0*np.pi/k**2*np.sum(np.abs(p_scat + p_src)**2) # power system
enhance = P/P0
These functions should be added to MiePy in some way to make this type of calculation straightforward.
Hi John,
I've been having trouble with installing on midway2.
Any suggestions?
Thank you,
Tyler
PS:
I saw you recommended this, by the way, but it fails even the first of those commands.
conda install -c conda-forge quaternion
conda install -c moble spherical_functions
pip install miepy
Dear authors,
Please help to check whether we can install miepy normally?
I tried to type
pip install miepy
but it took me so long for waiting...(more than one day) without any progess.
I used Spyder on the environment of Anaconda Navigator.
Thank you!
Student
Le
a369031.pdf, Pages 11-13
1.480229.pdf
Implement a many-layered core-shell particle. Along with the core-shell particle, these particles are Mie-like and can be used inside miepy.sphere_cluster
rather than going to the T-matrix approach. Additionally, the interior field calculations would need to be specialized.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.