diff --git a/src/frontend/runcoms2.c b/src/frontend/runcoms2.c index 7229749e1..a275b3148 100644 --- a/src/frontend/runcoms2.c +++ b/src/frontend/runcoms2.c @@ -26,6 +26,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "numparam/numpaif.h" #include "ngspice/inpdefs.h" +#include "ngspice/evtproto.h" extern void line_free_x(struct card *deck, bool recurse); extern INPmodel *modtab; @@ -237,6 +238,9 @@ com_remcirc(wordlist *wl) /* The next lines stem from com_rset */ INPkillMods(); + /* remove event queues */ + EVTunsetup(ft_curckt->ci_ckt); + if_cktfree(ft_curckt->ci_ckt, ft_curckt->ci_symtab); for (v = ft_curckt->ci_vars; v; v = next) { next = v->va_next; diff --git a/src/include/ngspice/evtproto.h b/src/include/ngspice/evtproto.h index d1569061b..a961db1da 100644 --- a/src/include/ngspice/evtproto.h +++ b/src/include/ngspice/evtproto.h @@ -65,6 +65,7 @@ void EVTtermInsert( char **err_msg); int EVTsetup(CKTcircuit *ckt); +int EVTunsetup(CKTcircuit* ckt); int EVTdest(Evt_Ckt_Data_t *evt); diff --git a/src/xspice/evt/evtsetup.c b/src/xspice/evt/evtsetup.c index d078ad549..4414b66bc 100644 --- a/src/xspice/evt/evtsetup.c +++ b/src/xspice/evt/evtsetup.c @@ -135,6 +135,29 @@ int EVTsetup( } +int EVTunsetup( + CKTcircuit* ckt) /* The circuit structure */ +{ + int err; + + /* Exit immediately if no event-driven instances in circuit */ + if (ckt->evt->counts.num_insts == 0) + return(OK); + + /* Clear the inst, node, and output queues, and initialize the to_call */ + /* elements in the instance queue to call all event-driven instances */ + err = EVTsetup_queues(ckt); + if (err) + return(err); + + /* Initialize additional event data */ + g_mif_info.circuit.evt_step = 0.0; + + /* Return OK */ + return(OK); +} + + /*