For design purposes one needs to relate the structure of proposed materials to their NLO (nonlinear optical) and other properties, which is a situation where theoretical approaches can be very helpful in providing suggestions for candidate systems that subsequently can be synthesized and studied experimentally. This brief describes the quantum-mechanical treatment of the response to one or more external oscillating electric fields for molecular and macroscopic, crystalline systems. To calculate NLO properties of large systems, a linear scaling generalized elongation method for the efficient and accurate calculation is introduced. The reader should be aware that this treatment is particularly feasible for complicated three-dimensional and/or delocalized systems that are intractable when applied to conventional or other linear scaling methods.