victorliu / S4

Stanford Stratified Structure Solver - Electromagnetic simulator for layered periodic structures
http://www.stanford.edu/group/fan/S4/
GNU General Public License v2.0
131 stars 149 forks source link

how to install?!?! #45

Closed schenlucky closed 7 years ago

schenlucky commented 7 years ago

since the configure file is missing, as a full beginner I even cannt install S4 in my mac osx. Is there a detailed guide? or someone help me?

myungjoon commented 7 years ago

You can follow the documentation. https://web.stanford.edu/group/fan/S4/install.html#binary-packages

Although some packages are said to be optional, you need to install them for compiling.

My OS is Ubuntu. For the lua fronted one,

$ git clone https://github.com/victorliu/S4.git $ sudo apt-get install lua5.2 $ sudo apt-get install liblua5.2-dev $ sudo apt-get install libfftw3-dev $ sudo apt-get install libsuitesparse-dev $ git clone https://github.com/xianyi/OpenBLAS.git $ cd OpenBLAS $ make $ cd ../S4 $ make

Now you can executable file S4 in 'build' directory. Check Makefile.common for more information.

I hope it works.

-MJ-

schenlucky commented 7 years ago

@myungjoon

Hi, myungjoon, much thanks for your help! After install all the required packages, I did: $ cd ../S4 $ make and it seems compiled successfully, no error turns up. Then, I try the example file in the 'build' directory, like: $ lua fig4.lua > fig4.txt it turn out: "attempt to index global 'S4' (a nil value)" Am I missed something?

schenlucky commented 7 years ago

I also tryed add the folowing to fig4.lua file: local S4 = require("RCWA") "attempt to index global 'S4' (a nil value)" disappears, but got: "Segmentation fault: 11" PS: the os is mac osx 10.11, using gcc.

myungjoon commented 7 years ago

@schenlucky You can first try to follow the tutorial https://web.stanford.edu/group/fan/S4/tutorial.html

See if it works. In the build directory, $./S4 'No input file given, running in interactive mode' message shows up. S = S4.NewSimulation() ...

and also, you can use .lua file

$./S4 ../examples/simple/simple.lua

Basically S4 read lua language + S4 APIs, as far as I know.

-MJ-

schenlucky commented 7 years ago

@myungjoon Much appreciated !!! It works so far. --S.Chen

dorianherle commented 6 years ago

I followed the exact same steps as described here. However when I try to run the "simple.lua" file by typing: "lua simple.lua" when I am in the directory $./S4 ../examples/simple/simple.lua, I get:

lua: simple.lua:3: attempt to index global 'S4' (a nil value)
stack traceback:
    simple.lua:3: in main chunk
    [C]: in ?
kwrobert commented 6 years ago

You need to use the custom S4 lua interpreter to run the examples. Binary should be located in the build folder

dorianherle commented 6 years ago

Thanks for your answer. I am very new to this. What do you mean by custom S4 lua intepreter ? I don't understand what I should do to solve my problem.

kirandhope commented 4 years ago

Thanks for your answer. I am very new to this. What do you mean by custom S4 lua intepreter ? I don't understand what I should do to solve my problem.

Can you please let me know how this issue was solved, I am experiencing the same.