S4 (Stanford Stratified Structure Solver) is a frequency domain code to solve layered periodic structures. Internally, it uses Rigorous Coupled Wave Analysis (RCWA; also called the Fourier Modal Method (FMM)) and the S-matrix algorithm. S4 was developed by Victor Liu of the Fan Group in the Stanford Electrical Engineering Department.
S4: Stanford Stratified Structure Solver website
S4 nanoHUB Simulation Tool