diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index aa68ee129..2e5076cff 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -405,7 +405,7 @@ extern int PZpost(CKTcircuit *); extern int PZaskQuest(CKTcircuit *, JOB *, int , IFvalue *); extern int PZsetParm(CKTcircuit *, JOB *, int , IFvalue *); -extern int OPtran(CKTcircuit *); +extern int OPtran(CKTcircuit *, int); #ifdef WANT_SENSE2 extern int SENaskQuest(CKTcircuit *, JOB *, int , IFvalue *); diff --git a/src/spicelib/analysis/cktop.c b/src/spicelib/analysis/cktop.c index a9d2e8e08..4c77f40fb 100644 --- a/src/spicelib/analysis/cktop.c +++ b/src/spicelib/analysis/cktop.c @@ -89,7 +89,9 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode, return converged; } - converged = OPtran(ckt); + /* If command 'optran' is not given, the function + returns immediately with the previous 'converged' */ + converged = OPtran(ckt, converged); #ifdef XSPICE /* gtri - wbk - add convergence problem reporting flags */ diff --git a/src/spicelib/analysis/optran.c b/src/spicelib/analysis/optran.c index 418bde123..7925692f2 100644 --- a/src/spicelib/analysis/optran.c +++ b/src/spicelib/analysis/optran.c @@ -220,7 +220,7 @@ int OPsetBreak(CKTcircuit *ckt, double time) Thus this algorithm creates an operating point to start other simulations. The code is derived from dctran.c by removing all un-needed parts.*/ int -OPtran(CKTcircuit *ckt) +OPtran(CKTcircuit *ckt, int oldconverged) { int i; double olddelta; @@ -243,10 +243,10 @@ OPtran(CKTcircuit *ckt) int redostep; #endif - /* if optran command has not been given (in .spiceinit or in .control section, + /* if optran command has not been given (in .spiceinit or in .control section), we don' use optran */ if (nooptran) - return 1; + return oldconverged; /* ACAN *acjob = (ACAN *) ckt->CKTcurJob; TRANan *trjob = (TRANan *) ckt->CKTcurJob;