ovidiopr / scattnlay

Near- and far-field Mie scattering by a multilayered sphere
GNU General Public License v3.0
59 stars 25 forks source link

Compilation problem #18

Open inzhevatkin opened 5 years ago

inzhevatkin commented 5 years ago

Hello. I want to compile code for using in python project in Windows 10. I work in msys command shell. 1) I downloaded scattnlay project. 2) Run python -m pip install numpy command. Output is 'Successfully installed numpy-1.17.2'. 3) Run make ext command. Output: _'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py buildext --inplace Traceback (most recent call last): File "setup.py", line 44, in import pybind11 as pb ModuleNotFoundError: No module named 'pybind11' make: *** [ext] Error 1 4) Run pip install pybind11 command. Output is 'Successfully installed pybind11-2.4.2'. 5) Run make ext command. Output: _'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace running build_ext building 'scattnlaydp' extension error: Unable to find vcvarsall.bat make: *** [ext] Error 1

Could you help me. Maybe I made mistakes in the earlier steps. And I have no idea about installing python-all-dev and python-numpy-dev. Is it enough to call a command python -m pip install numpy?

I also tried to install packege python-scattnlay (v. 2.2) in Pycharm project. But error occured (error: Microsoft Visual C++ 14.0 is required). Is it possible to avoid installation Microsoft Visual C++ 14.0 if I have gcc compiler.

Thank you in advance.

kostyfisik commented 5 years ago

I have no Windows box to check, may be @ovidiopr can comment on this.

ovidiopr commented 5 years ago

Sorry, I don't have either experience compiling in windows. Clearly your error is that you need a supported C++ compiler. Maybe you can find information about your problem here:

https://wiki.python.org/moin/WindowsCompilers

Best regards,

Ovidio

On Tue, Oct 1, 2019 at 1:34 PM Konstantin Ladutenko < notifications@github.com> wrote:

I have no Windows box to check, may be @ovidiopr https://github.com/ovidiopr can comment on this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2IRSRKQKXUCJVH7QPLQMMYTFA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAA6K4Y#issuecomment-536995187, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2OW4YZUGJR7NCVLFBLQMMYTFANCNFSM4I4H4UIQ .

kostyfisik commented 5 years ago

Or you can check online Mie calculator based on Scattnlay (I have exposed only small part of API, however, it can be handy for simple computations) https://physics.ifmo.ru/mie/

kostyfisik commented 5 years ago

Or you can also try MinGW http://www.mingw.org/ I have no experience with it, but I know that it is a popular alternative to Visual C++. You may also check https://kezunlin.me/post/8b9c051d/ (it is about building with pybind11 on windows, and we use pybind11 to interface C++ and Python code).

inzhevatkin commented 5 years ago

Thanks for the quick response. Thanks for the valuable advices.

I did not write right away, but I am using MinGw and plan to compile it using the gcc or g++ built-in compiler.

I want to find electrical field in space with Scattnlay project and I understood that API https://physics.ifmo.ru/mie/ has not this such an opportunity or functionality. But this advice is very valuable for future tasks.

I understand that the Makefie in the project is not intended for assembly in Windows. Is it so?

I will try to read in more detail the links that you advised.

kostyfisik commented 5 years ago

I would like to add near-field computations to the web version of scattnlay, however, just has not enough free time for this. All the code is in js branch at github, so you can join if you want, I will provide more instructions.

As for MinGw - it has a Makefile compatibility as soon as I can get it from https://stackoverflow.com/questions/11772602/how-to-compile-makefile-using-mingw and https://bigcode.wordpress.com/2016/12/20/compiling-a-very-basic-mingw-windows-hello-world-executable-in-c-with-a-makefile/

On Wed, 2 Oct 2019 at 06:29, inzhevatkin notifications@github.com wrote:

Thanks for the quick response. Thanks for the valuable advices.

I did not write right away, but I am using MinGw and plan to compile it using the gcc or g++ built-in compiler.

I want to find electrical field in space with Scattnlay project and I understood that API https://physics.ifmo.ru/mie/ http://url has not this such an opportunity or functionality. But this advice is very valuable for future tasks.

I understand that the Makefie in the project is not intended for assembly in Windows. Is it so?

I will try to read in more detail the links that you advised.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ABH7JPNG4XX36POZB2YUXD3QMQIQTA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEADNTDQ#issuecomment-537319822, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH7JPJXFN7WRGFPW5AD4TDQMQIQTANCNFSM4I4H4UIQ .

inzhevatkin commented 5 years ago

Hello.

I have not yet succeeded with the make ext command. My latest achievement is the following: 1) Run make ext command. Output: _'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace running build_ext Traceback (most recent call last): File "setup.py", line 81, in extra_compile_args=['-std=c++11', '-DMULTI_PRECISION=100'])] File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup dist.run_commands() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build_ext.py", line 309, in run force=self.force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\ccompiler.py", line 1031, in new_compiler return klass(None, dry_run, force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 282, in init CygwinCCompiler.init (self, verbose, dry_run, force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 157, in init self.dll_libraries = get_msvcr() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr raise ValueError("Unknown MS Compiler version %s " % mscver) ValueError: Unknown MS Compiler version 1916 make: *** [ext] Error 1

I can't tell python distutils to use mingw.

I also wanted to inform you that I use code from master branch and I tried to compile project on my laptop with make standalone command and I found some problems: 1) Makefile has line PYTHON='which python3'. In my case I have to use exact path to python.exe. 2) I run make standalone command. Output: make: *** No rule to make target /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie-impl.hpp', needed byscattnlay'. Stop. There is no file (nmie-impl.hpp) in the project. 3) I deleted $(SRCDIR)/nmie-impl.hpp in Makefile and compiled with make standalone command. Output: g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc:43: c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc:48: c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. make: * [fieldnlay] Error 1_ 4) I deleted scattnlay-mp fieldnlay-mp in Makefile and #include <boost/math/constants/constants.hpp> in nmie.hpp. At the moment I will deal with the project without a library if possible. No errors occurred. Output: g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/farfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o scattnlay g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In project folder I have fieldnlay.exe and scattnlay.exe**.

Can I use this file to calculate the electrical field? In the examples I saw only scattnlay functions from python library. I apologize for the long comment.

kostyfisik commented 5 years ago

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

How it looks like when you run fieldnlay.exe? In linux it is something like

tig@tig-laptop4:~/s/scattnlay$ ./fieldnlay Invalid argument: Insufficient parameters. Usage: ./fieldnlay -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment]

If you have something similar you should probably be able to do computaitons (just provide needed parameters to defining layers size parameter and refractive index, and also points where you want to calculate the field (initial and finial coordinate and total number of points in each dimension).

On Fri, 4 Oct 2019 at 09:19, inzhevatkin notifications@github.com wrote:

Hello.

I have not yet succeeded with the make ext command. My latest achievement is the following:

  1. Run make ext command. Output:

*'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace running build_ext Traceback (most recent call last): File "setup.py", line 81, in extra_compile_args=['-std=c++11', '-DMULTI_PRECISION=100'])] File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup dist.run_commands() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build_ext.py", line 309, in run force=self.force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\ccompiler.py", line 1031, in new_compiler return klass(None, dry_run, force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 282, in init CygwinCCompiler.init (self, verbose, dry_run, force) File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 157, in init self.dll_libraries = get_msvcr() File "c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr raise ValueError("Unknown MS Compiler version %s " % msc_ver) ValueError: Unknown MS Compiler version 1916 make: ** [ext] Error 1

I can't tell python distutils to use mingw.

I also wanted to inform you that I use code from master branch and I tried to compile project on my laptop with make standalone command and I found some problems:

  1. Makefile has line PYTHON='which python3'. In my case I have to use exact path to python.exe.
  2. I run make standalone command. Output: *make: ** No rule to make target /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie-impl.hpp', needed by scattnlay'. Stop. There is no file (nmie-impl.hpp) in the project.
  3. I deleted $(SRCDIR)/nmie-impl.hpp in Makefile and compiled with make standalone command. Output: g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc:43: c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

    include <boost/math/constants/constants.hpp>

    ^~~~~~~~ compilation terminated. In file included from c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc:48: c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

    include <boost/math/constants/constants.hpp>

    ^~~~~~~~ compilation terminated. make: *** [fieldnlay] Error 1_

  4. I deleted scattnlay-mp fieldnlay-mp in Makefile and #include <boost/math/constants/constants.hpp> in nmie.hpp. At the moment I will deal with the project without a library if possible. No errors occurred. Output:

g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/farfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o scattnlay g++ -DNDEBUG -O2 -Wall -std=c++11 /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc /c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In project folder I have fieldnlay.exe and scattnlay.exe.

Can I use this file to calculate the electrical field? In the examples I saw only scattnlay functions from python library. I apologize for the long comment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ABH7JPPHFACGAU7WLHABDVDQM3N6ZA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKSIAI#issuecomment-538256385, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH7JPJTGMFCYVRNGFMGLJ3QM3N6ZANCNFSM4I4H4UIQ .

inzhevatkin commented 5 years ago

Yes, I have the same output: Invalid argument: Insufficient parameters. Usage: fieldnlay.exe -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment].

For test I tried to run command fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1. Error occurred in line L = std::stoi(arg); in nearfield.cc, arg was "Layers" and it threw an exception. I deleted this line and manually defined L = 1. It outputs field values to consol. Perfect! Thank you!

Logically, the variable L should store the number of layers, but I did not understand how this is implemented programmatically. Maybe I didn’t understand something. In my case, I need a homogeneous sphere without layers.

I just still did not catch how to do it:

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

ovidiopr commented 5 years ago

Hi,

I have been conducting some tests and after some tries i was able to compile the code for Python 3 (64 bits) in Windows 10. The only way that worked for me was with the Community Version of Visual Studio 19. The steps that worked for me were the following:

  1. Install Python 3 64 bits ( https://www.python.org/ftp/python/3.0/python-3.0.amd64.msi).
  2. Install all the additional packages needed to build scattnlay (python -m pip install numpy scipy pybind11 setuptools)
  3. Install Visual Studio 2019 ( https://visualstudio.microsoft.com/downloads/) and selecting in the installation options "C++ Development".
  4. Installed (i.e., downloaded and uncompressed) Boost in "C:\Program Files\boost\boost_1_66_0" (https://www.boost.org/users/download/).
  5. Used pip to download and compile scattnlay (python -m pip install --global-option=build_ext --global-option="-IC:\Program Files\boost\boost_1_66_0" python-scattnlay).

I hope that this can help you.

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 9:02 AM Konstantin Ladutenko < notifications@github.com> wrote:

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

How it looks like when you run fieldnlay.exe? In linux it is something like

tig@tig-laptop4:~/s/scattnlay$ ./fieldnlay Invalid argument: Insufficient parameters. Usage: ./fieldnlay -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment]

If you have something similar you should probably be able to do computaitons (just provide needed parameters to defining layers size parameter and refractive index, and also points where you want to calculate the field (initial and finial coordinate and total number of points in each dimension).

On Fri, 4 Oct 2019 at 09:19, inzhevatkin notifications@github.com wrote:

Hello.

I have not yet succeeded with the make ext command. My latest achievement is the following:

  1. Run make ext command. Output:

*'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace running build_ext Traceback (most recent call last): File "setup.py", line 81, in extra_compile_args=['-std=c++11', '-DMULTI_PRECISION=100'])] File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup dist.run_commands() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build_ext.py", line 309, in run force=self.force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\ccompiler.py", line 1031, in new_compiler return klass(None, dry_run, force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 282, in init CygwinCCompiler.init (self, verbose, dry_run, force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 157, in init self.dll_libraries = get_msvcr() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr raise ValueError("Unknown MS Compiler version %s " % msc_ver) ValueError: Unknown MS Compiler version 1916 make: ** [ext] Error 1

I can't tell python distutils to use mingw.

I also wanted to inform you that I use code from master branch and I tried to compile project on my laptop with make standalone command and I found some problems:

  1. Makefile has line PYTHON='which python3'. In my case I have to use exact path to python.exe.
  2. I run make standalone command. Output: *make: *** No rule to make target

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie-impl.hpp', needed by scattnlay'. Stop.* There is no file (nmie-impl.hpp) in the project.

  1. I deleted $(SRCDIR)/nmie-impl.hpp in Makefile and compiled with make standalone command. Output: g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In file included from

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc:43:

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

^~~~~~~~ compilation terminated. In file included from

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc:48:

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

^~~~~~~~ compilation terminated. make: *** [fieldnlay] Error 1_

  1. I deleted scattnlay-mp fieldnlay-mp in Makefile and #include <boost/math/constants/constants.hpp> in nmie.hpp. At the moment I will deal with the project without a library if possible. No errors occurred. Output:

*g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/farfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o scattnlay g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In project folder I have fieldnlay.exe and scattnlay.exe*.

Can I use this file to calculate the electrical field? In the examples I saw only scattnlay functions from python library. I apologize for the long comment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ABH7JPPHFACGAU7WLHABDVDQM3N6ZA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKSIAI#issuecomment-538256385 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABH7JPJTGMFCYVRNGFMGLJ3QM3N6ZANCNFSM4I4H4UIQ

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2KZ4ZGWZ3LIGLBDA63QM3TATA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKV2YA#issuecomment-538271072, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2PW4IG5ZZ3E2KKMC6LQM3TATANCNFSM4I4H4UIQ .

ovidiopr commented 5 years ago

You are just calling it with the wrong parameters, it should be:

fieldnlay.exe -l 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

not

fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 12:02 PM inzhevatkin notifications@github.com wrote:

Yes, I have the same output:

Invalid argument: Insufficient parameters. Usage: fieldnlay.exe -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment].

For test I tried to run command fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1. Error occurred in line L = std::stoi(arg); in nearfield.cc, arg was "Layers" and it threw an exception. I deleted this line and manually defined L = 1. It outputs field values to consol. Perfect! Thank you!

Logically, the variable L should store the number of layers, but I did not understand how this is implemented programmatically. Maybe I didn’t understand something. In my case, I need a homogeneous sphere without layers.

I just still did not catch how to do it:

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2O74VCCBT2TGV45VT3QM4IFFA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALFQYQ#issuecomment-538335330, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2OPMJFWVFQREDULELLQM4IFFANCNFSM4I4H4UIQ .

ovidiopr commented 5 years ago

One more thing. I made some small changes to the source code in GitHub. Maybe you will need to update it.

On Fri, Oct 4, 2019 at 12:05 PM Ovidio Peña Rodríguez ovidio@bytesfall.com wrote:

Hi,

I have been conducting some tests and after some tries i was able to compile the code for Python 3 (64 bits) in Windows 10. The only way that worked for me was with the Community Version of Visual Studio 19. The steps that worked for me were the following:

  1. Install Python 3 64 bits ( https://www.python.org/ftp/python/3.0/python-3.0.amd64.msi).
  2. Install all the additional packages needed to build scattnlay (python -m pip install numpy scipy pybind11 setuptools)
  3. Install Visual Studio 2019 ( https://visualstudio.microsoft.com/downloads/) and selecting in the installation options "C++ Development".
  4. Installed (i.e., downloaded and uncompressed) Boost in "C:\Program Files\boost\boost_1_66_0" (https://www.boost.org/users/download/).
  5. Used pip to download and compile scattnlay (python -m pip install --global-option=build_ext --global-option="-IC:\Program Files\boost\boost_1_66_0" python-scattnlay).

I hope that this can help you.

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 9:02 AM Konstantin Ladutenko < notifications@github.com> wrote:

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

How it looks like when you run fieldnlay.exe? In linux it is something like

tig@tig-laptop4:~/s/scattnlay$ ./fieldnlay Invalid argument: Insufficient parameters. Usage: ./fieldnlay -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment]

If you have something similar you should probably be able to do computaitons (just provide needed parameters to defining layers size parameter and refractive index, and also points where you want to calculate the field (initial and finial coordinate and total number of points in each dimension).

On Fri, 4 Oct 2019 at 09:19, inzhevatkin notifications@github.com wrote:

Hello.

I have not yet succeeded with the make ext command. My latest achievement is the following:

  1. Run make ext command. Output:

*'/c/Users/konstantin/AppData/Local/Programs/Python/Python37-32/python.exe' setup.py build_ext --inplace running build_ext Traceback (most recent call last): File "setup.py", line 81, in extra_compile_args=['-std=c++11', '-DMULTI_PRECISION=100'])] File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup dist.run_commands() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build_ext.py", line 309, in run force=self.force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\ccompiler.py", line 1031, in new_compiler return klass(None, dry_run, force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 282, in init CygwinCCompiler.init (self, verbose, dry_run, force) File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 157, in init self.dll_libraries = get_msvcr() File

"c:\Users\konstantin\AppData\Local\Programs\Python\Python37-32\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr raise ValueError("Unknown MS Compiler version %s " % msc_ver) ValueError: Unknown MS Compiler version 1916 make: ** [ext] Error 1

I can't tell python distutils to use mingw.

I also wanted to inform you that I use code from master branch and I tried to compile project on my laptop with make standalone command and I found some problems:

  1. Makefile has line PYTHON='which python3'. In my case I have to use exact path to python.exe.
  2. I run make standalone command. Output: *make: *** No rule to make target

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie-impl.hpp', needed by scattnlay'. Stop.* There is no file (nmie-impl.hpp) in the project.

  1. I deleted $(SRCDIR)/nmie-impl.hpp in Makefile and compiled with make standalone command. Output: g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In file included from

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc:43:

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

^~~~~~~~ compilation terminated. In file included from

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc:48:

c:/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.hpp:40:10: fatal error: boost/math/constants/constants.hpp: No such file or directory

include <boost/math/constants/constants.hpp>

^~~~~~~~ compilation terminated. make: *** [fieldnlay] Error 1_

  1. I deleted scattnlay-mp fieldnlay-mp in Makefile and #include <boost/math/constants/constants.hpp> in nmie.hpp. At the moment I will deal with the project without a library if possible. No errors occurred. Output:

*g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/farfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o scattnlay g++ -DNDEBUG -O2 -Wall -std=c++11

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nearfield.cc

/c/Users/konstantin/YandexDisk/Mie/scattnlay-master/scattnlay-master-original/src/nmie.cc -lm -o fieldnlay In project folder I have fieldnlay.exe and scattnlay.exe*.

Can I use this file to calculate the electrical field? In the examples I saw only scattnlay functions from python library. I apologize for the long comment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ABH7JPPHFACGAU7WLHABDVDQM3N6ZA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKSIAI#issuecomment-538256385 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABH7JPJTGMFCYVRNGFMGLJ3QM3N6ZANCNFSM4I4H4UIQ

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2KZ4ZGWZ3LIGLBDA63QM3TATA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKV2YA#issuecomment-538271072, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2PW4IG5ZZ3E2KKMC6LQM3TATANCNFSM4I4H4UIQ .

ovidiopr commented 5 years ago

One more thing. I made some small changes to the source code in GitHub. Maybe you will need to update it.

On Fri, Oct 4, 2019 at 12:07 PM Ovidio Peña Rodríguez ovidio@bytesfall.com wrote:

You are just calling it with the wrong parameters, it should be:

fieldnlay.exe -l 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

not

fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 12:02 PM inzhevatkin notifications@github.com wrote:

Yes, I have the same output:

Invalid argument: Insufficient parameters. Usage: fieldnlay.exe -l Layers x1 m1.r m1.i [x2 m2.r m2.i ...] -p xi xf nx yi yf ny zi zf nz [-c comment].

For test I tried to run command fieldnlay.exe -l Layers 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1. Error occurred in line L = std::stoi(arg); in nearfield.cc, arg was "Layers" and it threw an exception. I deleted this line and manually defined L = 1. It outputs field values to consol. Perfect! Thank you!

Logically, the variable L should store the number of layers, but I did not understand how this is implemented programmatically. Maybe I didn’t understand something. In my case, I need a homogeneous sphere without layers.

I just still did not catch how to do it:

I would propose to try to install python package (python-scattnlay), as soon as it is much more convenient to calculate near-field using python interface. At least calling scattnlay from python is a default way I use it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2O74VCCBT2TGV45VT3QM4IFFA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALFQYQ#issuecomment-538335330, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2OPMJFWVFQREDULELLQM4IFFANCNFSM4I4H4UIQ .

inzhevatkin commented 5 years ago

Thank you very much I will try to do what you advised.

ovidiopr commented 5 years ago

One more thing, building the extension in place also works. I just downloaded the code from GitHub and made two changes to the Makefile: Line 1: PYTHON=python.exe Line 24: $(PYTHON) setup.py build_ext --inplace --include-dirs="C:\Program Files\boost\boost_1_66_0"

and it compiles just fine with 'make ext'.

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 12:28 PM inzhevatkin notifications@github.com wrote:

Thank you very much I will try to do what you advised.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2IA6K37PITITHTPULDQM4LEVA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALHLLA#issuecomment-538342828, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2MHFHTMR7FPLHU4G3TQM4LEVANCNFSM4I4H4UIQ .

inzhevatkin commented 5 years ago

I tried this:

fieldnlay.exe -l 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

It doesn't work in my case. It returns: Invalid argument: Unfinished layer! Insufficient parameters.

ovidiopr commented 5 years ago

Ok, I see. The problem is that the parameter '-l 10' indicates that you have 10 layers and the program expects 10 pairs of "m.real m.imag" values and you are passing just one. If you only have one layer, then use:

fieldnlay.exe -l 1 1.01 0 -p -5 5 1 -5 5 1 -5 5

or add more values for the refractive index.

Best regards,

Ovidio

On Fri, Oct 4, 2019 at 12:58 PM inzhevatkin notifications@github.com wrote:

I tried this:

fieldnlay.exe -l 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

It doesn't work in my case. It returns:

Invalid argument: Unfinished layer! Insufficient parameters.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2KPPV2ET65QQIINOLLQM4OXBA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALJNUI#issuecomment-538351313, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2P6LHFQJ2GAL2HFXO3QM4OXBANCNFSM4I4H4UIQ .

inzhevatkin commented 5 years ago

I suspect that some parameters were missing. An example of the command line when everything is OK in the calculation fields: fieldnlay.exe -l 1 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

ovidiopr commented 5 years ago

You are right, sorry. For every layer you need three parameters: the size parameter, and the real and imaginary parts of the refractive index.

Best regards,

Ovidio

On Sat, Oct 5, 2019 at 1:46 PM inzhevatkin notifications@github.com wrote:

I suspect that some parameters were missing. An example of the command line when everything is OK in the calculation fields: fieldnlay.exe -l 1 10 1.01 0 -p -5 5 1 -5 5 1 -5 5 1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ovidiopr/scattnlay/issues/18?email_source=notifications&email_token=ACNOR2IEFGYZEZIIIFBTUR3QNB5ABA5CNFSM4I4H4UI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEANQTBI#issuecomment-538642821, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNOR2KNWTNHUCI6SHCJFXDQNB5ABANCNFSM4I4H4UIQ .

kostyfisik commented 2 years ago

@ovidiopr May be we need provide a copy of needed boost files, as soon as we really need just a tiny part of boostlib...