@galihru/mnp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/examples/basic-simulation.js +11 -0
- package/package.json +32 -0
- package/src/index.js +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @galihru/mnp
|
|
2
|
+
|
|
3
|
+
Main integrated package that composes:
|
|
4
|
+
|
|
5
|
+
- `@galihru/mnp-material`
|
|
6
|
+
- `@galihru/mnp-mie`
|
|
7
|
+
|
|
8
|
+
This package provides a unified scientific API for fast nanoparticle-response estimates.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @galihru/mnp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { simulateSphereResponse } from "@galihru/mnp";
|
|
20
|
+
|
|
21
|
+
const result = simulateSphereResponse({
|
|
22
|
+
material: "Au",
|
|
23
|
+
wavelengthNm: 548.1,
|
|
24
|
+
radiusNm: 50,
|
|
25
|
+
mediumRefractiveIndex: 1.33
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
console.log(result.crossSection);
|
|
29
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { simulateSphereResponse } from "../src/index.js";
|
|
2
|
+
|
|
3
|
+
const result = simulateSphereResponse({
|
|
4
|
+
material: "Au",
|
|
5
|
+
wavelengthNm: 548.1,
|
|
6
|
+
radiusNm: 50,
|
|
7
|
+
mediumRefractiveIndex: 1.33
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
console.log("MNP simulation snapshot");
|
|
11
|
+
console.log(JSON.stringify(result, null, 2));
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@galihru/mnp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Main integrated scientific package for MNP material and Mie formulations.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"examples",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"author": "GALIH RIDHO UTOMO <g4lihru@students.unnes.ac.id>",
|
|
16
|
+
"license": "GPL-2.0-only",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@galihru/mnp-material": "0.1.0",
|
|
19
|
+
"@galihru/mnp-mie": "0.1.0"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/galihru/mnpbem.git"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"registry": "https://registry.npmjs.org/",
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "node --test"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { constantEpsilon, drudeEpsilon } from "@galihru/mnp-material";
|
|
2
|
+
import { rayleighCrossSections, rayleighPolarizability } from "@galihru/mnp-mie";
|
|
3
|
+
|
|
4
|
+
export { EV_TO_NM, HARTREE_EV, constantEpsilon, drudeEpsilon, makeDrudeMaterial, wavenumberInMedium } from "@galihru/mnp-material";
|
|
5
|
+
export { complex, rayleighCrossSections, rayleighPolarizability } from "@galihru/mnp-mie";
|
|
6
|
+
|
|
7
|
+
export function simulateSphereResponse({
|
|
8
|
+
material = "Au",
|
|
9
|
+
wavelengthNm = 548.1,
|
|
10
|
+
radiusNm = 50,
|
|
11
|
+
mediumRefractiveIndex = 1.33
|
|
12
|
+
} = {}) {
|
|
13
|
+
const epsParticle = drudeEpsilon(material, wavelengthNm);
|
|
14
|
+
const epsMedium = constantEpsilon(mediumRefractiveIndex ** 2, wavelengthNm);
|
|
15
|
+
const alpha = rayleighPolarizability(radiusNm, epsParticle, epsMedium);
|
|
16
|
+
const crossSection = rayleighCrossSections(wavelengthNm, radiusNm, epsParticle, epsMedium);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
inputs: { material, wavelengthNm, radiusNm, mediumRefractiveIndex },
|
|
20
|
+
epsParticle,
|
|
21
|
+
epsMedium,
|
|
22
|
+
alpha,
|
|
23
|
+
crossSection
|
|
24
|
+
};
|
|
25
|
+
}
|