Skip to content

Add mnp plasmon port#50431

Closed
galihru wants to merge 5 commits intomicrosoft:masterfrom
galihru:add-mnp-plasmon-port
Closed

Add mnp plasmon port#50431
galihru wants to merge 5 commits intomicrosoft:masterfrom
galihru:add-mnp-plasmon-port

Conversation

@galihru
Copy link

@galihru galihru commented Mar 12, 2026

No description provided.

@galihru galihru force-pushed the add-mnp-plasmon-port branch from 9fe965b to 1575dd9 Compare March 12, 2026 20:59
Comment on lines +1 to +33
mnp-plasmon-cxx provides modern C++17 library for metallic nanoparticle optical response calculations.

CMake usage:
find_package(mnp_plasmon_cxx CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE mnp_plasmon_cxx::mnp_plasmon_cxx)

C++ usage example:
#include "mnp_plasmon.hpp"
#include <iostream>

using namespace mnp;

SphereResponse response = MnpPlasmon::simulate_sphere_response(
"Au", // material (Au, Ag, Al)
550.0, // wavelength in nm
20.0, // radius in nm
1.33 // medium refractive index (water)
);

MnpPlasmon::print_response(response);

std::cout << "Extinction: " << response.c_ext << " nm²\n";

Features:
- Modern C++17 with std::complex<double>
- Object-oriented design
- STL containers and algorithms
- Professional error handling
- Drude model for metallic dielectric function
- Rayleigh polarizability calculations
- Optical cross-sections (extinction, scattering, absorption)
- Material database (Au, Ag, Al)
- No external dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Install time hint, not another README.

Suggested change
mnp-plasmon-cxx provides modern C++17 library for metallic nanoparticle optical response calculations.
CMake usage:
find_package(mnp_plasmon_cxx CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE mnp_plasmon_cxx::mnp_plasmon_cxx)
C++ usage example:
#include "mnp_plasmon.hpp"
#include <iostream>
using namespace mnp;
SphereResponse response = MnpPlasmon::simulate_sphere_response(
"Au", // material (Au, Ag, Al)
550.0, // wavelength in nm
20.0, // radius in nm
1.33 // medium refractive index (water)
);
MnpPlasmon::print_response(response);
std::cout << "Extinction: " << response.c_ext << " nm²\n";
Features:
- Modern C++17 with std::complex<double>
- Object-oriented design
- STL containers and algorithms
- Professional error handling
- Drude model for metallic dielectric function
- Rayleigh polarizability calculations
- Optical cross-sections (extinction, scattering, absorption)
- Material database (Au, Ag, Al)
- No external dependencies
mnp-plasmon-cxx provides CMake targets:
find_package(mnp_plasmon_cxx CONFIG REQUIRED)
target_link_libraries(main PRIVATE mnp_plasmon_cxx::mnp_plasmon_cxx)

Or remove it completely if the install command creates the same output heuristically.

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO galihru/mnpbem
REF v0.1.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
REF v0.1.2
REF v${VERSION}

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO galihru/mnpbem
REF v0.1.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
REF v0.1.2
REF v${VERSION}

Comment on lines +1 to +26
mnp-plasmon provides C library for metallic nanoparticle optical response calculations.

CMake usage:
find_package(mnp_plasmon CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE mnp_plasmon::mnp_plasmon)

C usage example:
#include "mnp_plasmon.h"

sphere_response_t response = mnp_simulate_sphere_response(
"Au", // material (Au, Ag, Al)
550.0, // wavelength in nm
20.0, // radius in nm
1.33 // medium refractive index (water)
);

mnp_print_response(&response);
printf("Extinction cross-section: %.6e nm²\n", response.c_ext);

Features:
- Drude model for metallic dielectric function
- Rayleigh polarizability calculations
- Optical cross-sections (extinction, scattering, absorption)
- Material database (Au, Ag, Al)
- MSVC/GCC compatible
- No external dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mnp-plasmon provides C library for metallic nanoparticle optical response calculations.
CMake usage:
find_package(mnp_plasmon CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE mnp_plasmon::mnp_plasmon)
C usage example:
#include "mnp_plasmon.h"
sphere_response_t response = mnp_simulate_sphere_response(
"Au", // material (Au, Ag, Al)
550.0, // wavelength in nm
20.0, // radius in nm
1.33 // medium refractive index (water)
);
mnp_print_response(&response);
printf("Extinction cross-section: %.6e nm²\n", response.c_ext);
Features:
- Drude model for metallic dielectric function
- Rayleigh polarizability calculations
- Optical cross-sections (extinction, scattering, absorption)
- Material database (Au, Ag, Al)
- MSVC/GCC compatible
- No external dependencies
mnp-plasmon provides CMake targets:
find_package(mnp_plasmon CONFIG REQUIRED)
target_link_libraries(main PRIVATE mnp_plasmon::mnp_plasmon)

"documentation": "https://github.com/galihru/mnpbem/tree/main/cxx-mnp-plasmon",
"license": "GPL-3.0-only",
"dependencies": [
"vcpkg-cmake",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"vcpkg-cmake",
{
"name": "vcpkg-cmake",
"host": true
},

"documentation": "https://github.com/galihru/mnpbem/tree/main/c-mnp-plasmon",
"license": "GPL-3.0-only",
"dependencies": [
"vcpkg-cmake",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"vcpkg-cmake",
{
"name": "vcpkg-cmake",
"host": true
},

Comment on lines +7 to +16
},
{
"git-tree": "773c722dbdc261fa3d8538ae17235fbf65c2aee0",
"version": "0.1.1",
"port-version": 0
},
{
"git-tree": "925c740e6744d788c9b261481f8b338546d2d1ca",
"version": "0.1.0",
"port-version": 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One PR can add only one entry per port here here.

Suggested change
},
{
"git-tree": "773c722dbdc261fa3d8538ae17235fbf65c2aee0",
"version": "0.1.1",
"port-version": 0
},
{
"git-tree": "925c740e6744d788c9b261481f8b338546d2d1ca",
"version": "0.1.0",
"port-version": 0

Comment on lines +7 to +16
},
{
"git-tree": "5052bc76a4d0ff611e400498f99a6c6454705044",
"version": "0.1.1",
"port-version": 0
},
{
"git-tree": "282d0fb3ef38d4446189b4cfbf4d095a77f8685c",
"version": "0.1.0",
"port-version": 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
},
{
"git-tree": "5052bc76a4d0ff611e400498f99a6c6454705044",
"version": "0.1.1",
"port-version": 0
},
{
"git-tree": "282d0fb3ef38d4446189b4cfbf4d095a77f8685c",
"version": "0.1.0",
"port-version": 0

@vicroms
Copy link
Member

vicroms commented Mar 13, 2026

Hi @galihru,

Thanks for your contribution! Unfortunately, this port doesn't yet meet our minimum project maturity requirement.

But don't worry, you can still use vcpkg to install this library! Here are some alternatives you can try:

Publish a collection of overlay ports

Set up a repository to hold your port(s):

mkdir my-vcpkg-ports
cd my-vcpkg-ports
git init

Follow the registry structure and create a ports folder to store all your ports.

You don’t need to create a versions folder since you’re not making a full registry. This setup makes it easier if you want to turn your repository into a full registry later.

mkdir ports
# Put all your ports inside the "ports" folder
git add .
git commit -m "Add ports"

Publish your repository somewhere public like https://github.com:

git remote add origin [https://github.com/<my](https://github.com/%3Cmy) username>/my-vcpkg-ports
git push origin HEAD

Add instructions for users in your repository’s README:

To use these ports with vcpkg:

```bash
git clone [https://github.com/<my](https://github.com/%3Cmy) username>/my-vcpkg-ports my-vcpkg-ports
vcpkg install <ports> --overlay-ports=<path/to>/my-vcpkg-ports/ports
```

Check out vcpkg’s docs on [using overlay ports](https://learn.microsoft.com/vcpkg/concepts/overlay-ports#using-an-overlay-port).

Publish your port alongside your project

This is great for library authors who want to include a vcpkg port within their project.

Place your port somewhere in your repository, like:

# Place ports in <repo root>/vcpkg/ports
mkdir -p vcpkg/ports
cp <path/to/my port> ./vcpkg/ports/
git add ./vcpkg/ports/.
git commit -m "Add vcpkg port files"
git push

Add usage instructions in your repository’s README:

To install this library with vcpkg:

```bash
git clone [https://github.com/<my](https://github.com/%3Cmy) username>/<my repository> <local repository>
vcpkg install <port> --overlay-ports=<path/to/local repository>/vcpkg/ports
```

See vcpkg’s docs on [using overlay ports](https://learn.microsoft.com/vcpkg/concepts/overlay-ports#using-an-overlay-port).

NOTE: If you want the port to stay in sync with your project’s sources, instead of using the vcpkg_from_* portfile functions, try something like set(SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}/../..) and set SOURCE_PATH to the relative path to your sources from portfile.cmake.

Publish a Git registry

If you want your users to fully benefit from vcpkg’s versioning features, create a Git registry.

Check out our full guide on how to create a custom registry.

Then add instructions for users in your repository’s README:

To use this registry, add it to your `vcpkg-configuration.json`:

`vcpkg-configuration.json`

```json
{
  "registries": [{
    "kind": "git",
    "repository": "https://github.com/<my username>/<my repository>",
    "baseline": "<latest commit SHA>",
    "packages": [ /* list of packages you want to consume from this registry */ ]
  }]
}
```

Read more about [consuming packages from custom registries](https://learn.microsoft.com/vcpkg/consume/git-registries).

Let us know if any of these options sound good to you or if you want help setting them up. You can still publish your port in the curated registry once it meets our maturity guidelines!

@vicroms vicroms closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants