Please handle this error

Hi, I tried to simulate with Vgs = 2V, Vds = 2V, but the error occurred.


File C:\devsim\lib\devsim\python_packages\ramp.py:45 in rampbias
ds.solve(type=“dc”, absolute_error=abs_error, relative_error=rel_error, maximum_iterations=max_iter)

error: Convergence failure!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File C:\devsim\examples\mobility\gmsh_mos2d.py:93 in
rampbias(device, “drain”, 2, 2, 0.001, 30, 1e-10, 1e30, printAllCurrents)

File C:\devsim\lib\devsim\python_packages\ramp.py:53 in rampbias
raise RuntimeError(“Minimum step size too small”)

RuntimeError: Minimum step size too small

And I trired with Vgs = 1V, Vds = 1V.
Then it worked properly…
What’s the problem???

Each bias point needs a good initial guess. Using too large of bias steps will result in convergence difficulties. Please experiment with the parameters for the rampbias command. A 0.1 step in bias is probably a good start.

Hi Juan. I saw your reply but I cannot solve this problem yet…
I wanna see the result with higher than 1V Drain Voltage,
but if I set the end bias of Vd as 2V and step size = 0.1V, then it occurs same error.
I set the minimum step size bigger than 0.001, but it didn’t work.
So I’d like to know whtere is ds.solve(I don’t know what it is, maybe it is function or lib) located to check something.

  • Please check my rampbias code, and if there is any problem, please let me know.
# Copyright 2013 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import devsim as ds
from .simple_physics import *

def rampbias(device, contact, end_bias, step_size, min_step, max_iter, rel_error, abs_error, callback):
    '''
      Ramps bias with assignable callback function
    '''
    start_bias = ds.get_parameter(device=device, name=GetContactBiasName(contact))
    if (start_bias < end_bias):
        step_sign=1
    else:
        step_sign=-1
    step_size=abs(step_size)

    last_bias=start_bias
    while(abs(last_bias - end_bias) > min_step):
        print(("%s last end %e %e") % (contact, last_bias, end_bias))
        next_bias=last_bias + step_sign * step_size
        if next_bias < end_bias:
            next_step_sign=1
        else:
            next_step_sign=-1

        if next_step_sign != step_sign:
            next_bias=end_bias
            print("setting to last bias %e" % (end_bias))
            print("setting next bias %e" % (next_bias))
        ds.set_parameter(device=device, name=GetContactBiasName(contact), value=next_bias)
        try:
            ds.solve(type="dc", absolute_error=abs_error, relative_error=rel_error, maximum_iterations=max_iter)
        except ds.error as msg:
            if str(msg).find("Convergence failure") != 0:
                raise0
            ds.set_parameter(device=device, name=GetContactBiasName(contact), value=last_bias)
            step_size *= 0.5
            print("setting new step size %e" % (step_size))
            if step_size < min_step:
                raise RuntimeError("Minimum step size too small")
            continue
        print("Succeeded")
        last_bias=next_bias
        callback(device)

def printAllCurrents(device):
    '''
      Prints all contact currents on device
    '''
    for c in ds.get_contact_list(device=device):
        PrintCurrents(device, c)
    StoreCurrents_csv(device)

def StoreCurrents_csv(device):
    '''
       store contact currents in array
    '''
    for c in ['drain']:
        #PrintCurrents(device, c)
        # TODO add charge
        contact_bias_name = GetContactBiasName(c)
        electron_current  = get_contact_current(device=device, contact=c, equation=ece_name)
        hole_current      = get_contact_current(device=device, contact=c, equation=hce_name)
        total_current     = electron_current + hole_current
        Drain_voltage     = get_parameter(device=device, name=GetContactBiasName(c))
        Gate_voltage      =  get_parameter(device=device, name=GetContactBiasName('gate'))
        data = (Gate_voltage,Drain_voltage, electron_current, hole_current, total_current)
        print(data)
        with open("id_vds.csv", "a", encoding="utf-8") as ofh:
                ofh.write('%s,%s,%s,%s\n' % (c,Gate_voltage,Drain_voltage,electron_current))

Hi Hyeok
I meet this problem, too. But there is a topic about it. It seems that the convergence of the results is related to the settings of parameters such as doping conditions. For more information, you can see this topic:
I want to see Id- Vgs Curve - scripting - DEVSIM TCAD
The GS in his results is bigger than 1 V. I don’t have time to verify it. And I hope it works.

1 Like

Hi @Hyeok

As @ghost suggested, it would be good to review the other posts on the subject.

Not all bias conditions may result in a full sweep, and it may be good to handle the nonconvergence and move on to the next bias sweep. For example, please see these script for an example:
https://github.com/devsim/devsim_3dmos/blob/main/ieee/sweeps.py#L109
https://github.com/devsim/devsim_3dmos/blob/main/ieee/idvd.py#L97

Note the error handling required to terminate the sweep early in the first script.