How to run multiple voltage sweeps in DEVICE when you want to vary the voltages on multiple contacts?



Depending on the device under investigation, one can create multiple electrical contacts to assign different bias voltages in DEVICE. For example, a simple diode can have two electrical contacts (anode and cathode), whereas a field-effect transistor (MOSFET) can have up to four electrical contacts (source, drain, gate, and body). In most cases, we apply a bias voltage (sweep) on one of the contacts and keep the voltages at the other contact(s) fixed. This can be done easily by using the dc sweep option of the corresponding electrical contact.

However, sometimes, we may want to change the voltage at two contacts simultaneously (for example, sweep the gate and drain voltages of a MOSFET). In such cases, we can not just enable the dc sweep option on both contacts and run the simulation. Even though the solver will allow users to define dc sweeps on multiple contacts, the simulation will almost always fail. The solution to this problem lies in the script. When running voltage sweep on multiple (say two) contacts, we will have to apply a dc sweep on “contact A” and then use a “for” loop in the script to change the voltage of “contact B”. The solver will run multiple simulations sweeping the voltage of “contact A” for each of the voltage steps for “contact B” as defined by the script.

One thing to note here is that for each of the different voltage values of “contact B”, the solver will run different simulations. So the script needs to record the results at each step so that the results at all the bias points are available at the end.


Hi, Sir. I just encountered this problem, but I am not so familiar with the scripts in Lumerical. Could you show me an example of that? like how to use ‘for’ loop to change the voltage of ‘contact B’ and how to record the results.
I will appreciate your help. Thank you very much.


Hi @long_tao, Let’s say you need to apply bias to the “gate” and the “drain”. You can set up the “drain” contact to sweep the bias from (say) 0 to 1 V in 11 steps. Then you can use the following script command to sweep the “gate” bias on top of the drain bias (say from 0 to 1 V in 5 steps).

I_final = matrix(5,11); # initialize matrix to save the final voltage vg = linspace(0,1,5); # vector to define gate bias

for (i=1:5) { setbc("gate","steady state","voltage",vg(i)); # set the gate bias run("CHARGE"); # run simulation and sweep drain bias temp = getresult("CHARGE","drain"); # get the result at the drain contact I_final(i,1:11) = temp.I_drain; # save the current result in the matrix for I }