This file is indexed.

/usr/share/nrn/lib/hoc/atoltool.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
begintemplate AtolToolItem
public name, max, acmax, scale, rescale, original
external cvode
strdef name

proc init() {
	name = $s1
	max = -1e9
	acmax = -1e9
	scale = $2
	if (scale > 0) {
		original = cvode.atolscale(name)
	}
}

proc rescale() {
	if (scale == -1) { return }
	if (numarg() == 0) {
		if (max*1e20 <= 0) { return }
		scale = log10(max)
		if (scale < 0) { scale -= .99 }
		scale = 10^(int(scale))	
	}else{
		scale = $1
	}
	cvode.atolscale(name, scale)
}
endtemplate AtolToolItem

begintemplate AtolTool
public activate, analyse, rescale, states, anrun, refresh
public pr, map, save, scales
external cvode, hoc_sf_
objref ms, mt, states, tobj, used
strdef tstr, tstr1, mname

objref box, this

proc init() {
	used = new List()
	mkstates()
}

proc activate() {
	activate_ = $1
	cvode.state_magnitudes($1)
}

proc analyse() {local i
	cvode.state_magnitudes(2)
	for i=0, states.count-1 {
		tobj = states.object(i)
		tobj.max = cvode.state_magnitudes(tobj.name, &tobj.acmax)
	}
	activate(0)
}

proc rescale() { local i
	for i=0, states.count-1 {
		states.object(i).rescale()
	}
}

proc original() { local i
	for i=0, states.count-1 {
		tobj = states.object(i)
		tobj.rescale(tobj.original)
	}
}

proc scales() {local i
	for i=0, states.count-1 {
		tobj = states.object(i)
		if (tobj.scale != -1) {
			tobj.scale = cvode.atolscale(tobj.name)
		}
	}
}

proc mkstates() {
	states = new List()
	tobj = new AtolToolItem("v", 1) states.append(tobj)
	mkstates2(0)
	mkstates2(1)
	tobj = new AtolToolItem("Vector", -1) states.append(tobj)
	scales()
}

proc mkstates2() {local i, it
	mt = new MechanismType($1)
	for it=1, mt.count-1 {
		mt.select(it)
		mt.selected(mname)
		if (hoc_sf_.head(mname, "_ion", tstr) != -1) {
			sprint(tstr1, "%si", tstr)
			tobj = new AtolToolItem(tstr1, 1) states.append(tobj)
			sprint(tstr1, "%so", tstr)
			tobj = new AtolToolItem(tstr1, 1) states.append(tobj)
		}else{
			ms = new MechanismStandard(mname, 3)
			for i=0, ms.count-1 {
				ms.name(tstr, i)
				if ($1 == 1) {
					sprint(tstr, "%s.%s", mname, tstr)
				}
				tobj = new AtolToolItem(tstr, 1) states.append(tobj)
			}
		}
	}
}

proc pr() {local i
	for i=0, states.count-1 {
		tobj = states.object(i)
		if (tobj.max < 0) continue
		printf("%-20s %-8.2g  %-8.2g %-8.2g\n", tobj.name, tobj.acmax, tobj.max, tobj.scale)
	}
}

proc map() {
	if (object_id(box) == 0) {
		build()
	}
	box.map("Absolute Tolerance Scale Factors")
}

proc fill_used() {local i
	used.remove_all()
	for i=0, states.count-1 {
		tobj = states.object(i)
		if (tobj.max >= 0) {
			used.append(tobj)
		}
	}
	used.select(-1)
}

proc label() {
	tobj = used.object($1)
	sprint(tstr, "%-20s %-8.2g  %-8.2g %-8.2g", tobj.name, tobj.scale, tobj.max, tobj.acmax)
//	sprint(tstr, "%.2e %-20s %.2e  %.2e", tobj.scale, tobj.name, tobj.max, tobj.amax)
}

proc anrun() {
	if (!cvode.active()) {
		execute("cvode_active(1)")
	}
	execute("init()")
	activate(1)
	execute("run()")
	analyse()
	fill_used()
}

proc refresh() {
	fill_used()
}

proc scl() {local i, pos
	i = used.selected()
	if (i < 0) { return }
	pos = used.scroll_pos
	tobj = used.object(i)
	tobj.rescale(tobj.scale *= $1)
	used.remove(i)
	used.insrt(i, tobj)
	used.select(i)
	used.scroll_pos(pos)
}

proc build() {
	fill_used()
	box = new VBox()
	box.save("")
	box.ref(this)
	box.intercept(1)
	xpanel("",1)
	xbutton("Analysis Run", "anrun()")
	xbutton("Rescale", "rescale() fill_used()")
	xbutton("Original", "original() fill_used()")
	xpanel()
	xpanel("",1)
	xbutton("*10", "scl(10)")
	xbutton("/10", "scl(.1)")
	xbutton("Hints", "hints()")
	xpanel()
	used.browser("", tstr, "label(hoc_ac_)")
	box.intercept(0)
}

proc save() {local i
	for i=0, states.count-1 {
		tobj = states.object(i)
		if (tobj.scale != tobj.original) {
			sprint(tstr, "    ats(\"%s\", %g)", tobj.name, tobj.scale)
			$o1.save(tstr)
		}
	}
}

proc hints() {
xpanel("Hints for Absolute Tolerance Scale Factors")
xlabel("The absolute error tolerance for each state is the product of the")
xlabel("overall cvode.atol() and the cvode.atolscale(\"statename\"). Default")
xlabel("atolscale is 1 unless specified explicitly in its state declaration")
xlabel("in its model description. The default atolscale may be wildly")
xlabel("inappropriate for states with very small values. e.g. a calcium pump")
xlabel("may vary in the 1e-14 magnitude range and an error tolerance of 10-6")
xlabel("essentially means the variation of the state can have no effect on")
xlabel("the choice of time step. Visible symptoms of poor error control")
xlabel("are oscillations in the state with a period equal to the time step")
xlabel("and invisible symptoms are poor accuracy of the overall simulation.")
xlabel("")
xlabel("The list in the \"Absolute Tolerance Scale Factors\" panel shows the")
xlabel("generic state types, e.g.  \"v\" which represents all the voltage states")
xlabel("of all segments of all sections of all cells;")
xlabel("the present value of the absolute tolerance scale factor of each type;")
xlabel("the maximum magnitude of the states of each type (see \"Analysis Run\" below);")
xlabel("and the maximum corrector error of the states of each type.")
xlabel("")
xlabel("When the AtolTool is created, the atolscale for each state type is saved")
xlabel("and can be restored with the \"Original\" button. ")
xlabel("")
xlabel("When a state type is selected, the atolscale can be multiplied or")
xlabel("divided by 10 with the \"*10\" or \"/10\" buttons. ")
xlabel("")
xlabel("The \"Rescale\" button sets the atolscale for each state type according")
xlabel("to the order of magnitude of the maximum magnitude. ")
xlabel("")
xlabel("The \"Analysis Run\" makes cvode active (if it is not already active)")
xlabel("and executes the top level \"run()\" procedure with \"maximum state")
xlabel("recording\" activated.  At the end of the run (or when the StopRun button")
xlabel("on the RunControl is pressed) the maximum state values and corrector")
xlabel("errors are collected into columns 3 and 4 of the state type list. ")
xlabel("")
xlabel("The scale factors that differ from the default are saved in a session file")
xlabel("when the \"VariableTimeStep\" panel is saved. ")
xpanel()
}

endtemplate AtolTool