This file is indexed.

/usr/share/nrn/lib/hoc/varmeth1.hoc is in neuron 7.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
using_cvode_ = 0

begintemplate NumericalMethodPanel
public dae, ode, fixed, atoltool_, atoltool, refresh, rescale, restore
public details, save, map, b1, varstep, localstep, prdetails
public varstep, localstep // for backward compatibility with cvode_active and cvode_local
external using_cvode_
objref b, b1, this, cvode, atoltool_
strdef smodel, smeth, smx, tstr
proc init() {
	dtsav = dt
	if (dtsav < 1e-6) { dtsav = 0.025 }
	saved = 0
	cvode = CVode[0]
	atol_ = cvode.atol()
	variable_domain(&atol_, 1e-15, 1000)
	b1 = this
	refresh()
}

proc dae() {
	isdaspk_ = $1
	isdaspk()
}

proc ode() {
	varstep(1)
}

proc fixed() {
	varstep(0)
}

proc varstep() {
	refresh()
	isvar_ = $1  isvar()
}

proc localstep() {
	if ($1 == 1) {
		islocal_ = 1  islocal()
	}else{
		isvar_=0 isvar()
	}
}

proc details() {
	b = new VBox()
	b.save("")
	b.ref(this)
	b.intercept(1)
	xpanel("")
	xbutton("Refresh", "refresh()")
	xvarlabel(smodel)
	xlabel("ODE model allows any method")
	xlabel("DAE model allows implicit fixed step or daspk")
	xcheckbox("Implicit Fixed Step", &isfixed_, "isfixed()")
	xcheckbox("C-N Fixed Step", &iscn_, "iscn()")
	xcheckbox("Cvode", &iscvode_, "iscvode()")
	xcheckbox("Daspk", &isdaspk_, "isdaspk()")
	xcheckbox("Local step", &islocal_, "islocal()")
	xlabel("DAE and daspk require sparse solver, cvode requires tree solver")
	xcheckbox("Mx=b tree solver", &istree_, "istree()")
	xcheckbox("Mx=b sparse solver", &issparse_, "issparse()")
	xlabel("")
	xcheckbox("2nd order threshold (for variable step)", &isco2_, "isco2()")
	xpanel()
	b.intercept(0)
	b.map("Numerical Method Selection")
}
proc map() {
	// unusual logic because we don't want this to be the first window
	if (b1 == this) {
		buildsmall()
		refresh()
	}
	b1.unmap()
	doNotify()
	if (numarg() == 5) {
		b1.map("VariableTimeStep", $2, $3, $4, $5)
	}else{
		b1.map("VariableTimeStep")
	}
}

proc buildsmall() {
	b1 = new VBox()
	b1.save("save()")
	b1.ref(this)
	b1.intercept(1)
	xpanel("")
	xcheckbox("Use variable dt", &isvar_, "varstep(isvar_)")
	xpvalue("Absolute Tolerance", &atol_, 1, "CVode[0].atol(atol_)")
	xpanel()
	xpanel("",1)
	xbutton("Atol Scale Tool", "atoltool()")
	xbutton("Details", "details()")
	xpanel()
	b1.intercept(0)
}

proc atoltool1() {
	if (object_id(atoltool_) == 0) {
		atoltool_ = new AtolTool()
	}
	if (!CVode[0].active) {
		varstep(1)
	}
}

proc atoltool() {
	atoltool1()
	atoltool_.activate(1)
	execute("init()")
	atoltool_.analyse()
	atoltool_.map()
}

proc rescale() {
	atoltool1()
	atoltool_.anrun()
	atoltool_.rescale()
	atoltool_.refresh()
}

func refresh() {local x
	x = cvode.current_method()
	refresh1(x)
	return x
}

proc prdetails() {local model, gauss, method, lstep
	model = $1%10
	gauss = int($1/10)%10
	method = int($1/100)%10
	lstep = int($1/1000)%10
	if (numarg() == 2) {
		printf("%s: ", $s2)
	}
	if (model == 0) {
		printf("no model, ")
	}else if (model == 1) {
		printf("ODE type, ")
	}else{
		printf("DAE type, ")
	}
	if (method == 0) {
		printf("1st order fixed step, ")
	}else if (method == 1) {
		printf("2nd order fixed step (1st order currents), ")
	}else if (method == 2) {
		printf("2nd order fixed step and currents, ")
	}else if (method == 3) {
		printf("CVODES, ")
	}else if (method == 4) {
		printf("IDA, ")
	}
	if (lstep == 0) {
		printf("global step, ")
	}else{
		printf("local step, ")
	}
	if (gauss == 0) {
		printf("tree matrix solver\n")
	}else{
		printf("general sparse matrix solver\n")
	}
}
proc refresh1() {local x
	x = $1
	isco2_ = cvode.condition_order() - 1
	atol_ = cvode.atol()
	model = x%10
	gauss = int(x/10)%10
	method = int(x/100)%10
	lstep = int(x/1000)%10
//	printf("model=%d gauss=%d method=%d local=%d\n", model, gauss, method, lstep)
	if (model == 0) {
		sprint(smodel, "current model type: <*no model*>   ")
	}else if (model == 1) {
		sprint(smodel, "current model type: <*ODE*>   DAE  ")
	}else{
		sprint(smodel, "current model type:   ODE   <*DAE*>")
	}
	iscn_ = (method == 2)
	if (model == 2 && iscn_ == 1) {
		secondorder = 0
		iscn_ = 0
		method = 0
	}
	isfixed_ = (method == 0)
	iscvode_ = (method == 3 && lstep == 0)
	isdaspk_ = (method == 4)
	islocal_ = (lstep == 1)
	istree_ = (gauss == 0)
	issparse_ = (gauss == 1)
	isvar_ = (method > 2)
	using_cvode_ = isvar_
}

proc restore() {local i
	if (dt > .0001) {
		dtsav = dt
	}else{
		dtsav = .025
	}
	cvode.condition_order($2)
	refresh1($1)
	if (isfixed_) {isfixed()}
	if (iscn_) {iscn()}
	if (iscvode_) {iscvode()}
	if (isdaspk_) {isdaspk()}
	if (islocal_) {islocal()}
	if (istree_) {istree()}
	if (issparse_) {issparse()}
	i = refresh()
	if (i != $1) {
		printf("Method details were not completely restored\n")
		prdetails($1, "saved")
		prdetails(i, "current")
	}
}

proc sdt() {
	if ($1 == 1 && method < 3 && saved == 0) {
		dtsav = dt
		saved = 1
//print "dtsav = dt ", dt
	}
	if ($1 == 0 && method > 2) {
		dt = dtsav
		saved = 0
//print "dt = dtsav ", dt
	}
}

proc isvar() {
	if (isvar_) {
		if (!saved) { sdt(1) }
		if (model == 2) {
			isdaspk_ = 1
			isdaspk()
		}else{
			iscvode_ = 1
			iscvode()
		}
	}else{
		sdt(0)
		cvode.use_daspk(0)
		cvode.active(0)
		cvode.use_mxb(0)
		refresh()
	}
}

proc isfixed() {
	if (isfixed_ == 1) {
		secondorder = 0
		cvode.use_daspk(0)
		cvode.active(0)
		sdt(0)
	}
	refresh()
}
proc iscn() {
	if (iscn_ == 1 && model != 2) {
		secondorder = 2
		cvode.use_daspk(0)
		cvode.active(0)
		sdt(0)
	}
	refresh()
}
proc iscvode() {
	if (iscvode_ == 1 && model != 2) {
		sdt(1)
		cvode.use_local_dt(0)
		cvode.use_daspk(0)
		cvode.use_mxb(0)
		cvode.active(1)
		dt = dtsav
	}
	refresh()
}
proc isdaspk() {
	if (isdaspk_ == 1) {
		sdt(1)
		cvode.use_daspk(1)
		cvode.active(1)
		dt = dtsav
	}
	refresh()
}
proc islocal() {
	if (islocal_ == 1 && model != 2) {
		sdt(1)
		cvode.use_daspk(0)
		cvode.use_mxb(0)
		cvode.use_local_dt(1)
		cvode.active(1)
		dt = dtsav
	}
	refresh()
}
proc istree() {
	if (istree_ == 1 && model != 2) {
		if (method < 3) {
			cvode.use_daspk(0)
			cvode.use_mxb(0)
		}
	}
	refresh()
}
proc issparse() {
	if (issparse_ == 1) {
		if (method < 3) {
			cvode.use_mxb(1)
		}
	}
	refresh()
}

proc isco2() {
	cvode.condition_order(isco2_ + 1)
}

proc ats() {
	if ($2 > 0) {
		CVode[0].atolscale($s1, $2)
	}
}

proc save() {local i
	b1.save("ocbox_ = NumericalMethodPanel[0]\n}")
	b1.save("{object_push(ocbox_)}\n{")
	sprint(tstr, "atol_ = %g  CVode[0].atol(atol_)", atol_)
	b1.save(tstr)
	sprint(tstr, "restore(%d, %d)", refresh(), cvode.condition_order())
	b1.save(tstr)
	if (object_id(atoltool_) != 0) {
		b1.save(" atoltool_ = new AtolTool()")
		atoltool_.save(b1)
		b1.save(" atoltool_.scales()")
	}
	b1.save("}\n{object_pop()}\n{")
}

endtemplate NumericalMethodPanel