blob: feccc6076bad438962f62cf5a0eaad0bf2afbe4a [file] [log] [blame]
Tim Edwards113b0832021-01-13 11:27:52 -05001#!/usr/bin/env python3
2# SPDX-FileCopyrightText: 2020 Efabless Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# SPDX-License-Identifier: Apache-2.0
16
17#
18# check_density.py ---
19#
20# Run density checks on a design (from GDS, after running fill generation).
21#
22
23import sys
24import os
25import re
26import select
27import subprocess
28
29def usage():
30 print("Usage:")
31 print("check_density.py [<gds_file_name>] [-keep]")
32 print("")
33 print("where:")
34 print(" <gds_file_name> is the path to the .gds file to be checked.")
35 print("")
36 print(" If '-keep' is specified, then keep the check script.")
37 return 0
38
39
40if __name__ == '__main__':
41
42 optionlist = []
43 arguments = []
44
45 debugmode = False
46 keepmode = False
47
48 for option in sys.argv[1:]:
49 if option.find('-', 0) == 0:
50 optionlist.append(option)
51 else:
52 arguments.append(option)
53
54 if len(arguments) != 1:
55 print("Wrong number of arguments given to check_density.py.")
56 usage()
57 sys.exit(0)
58
59 gds_filepath = arguments[0]
60
61 gdspath = os.path.split(gds_filepath)[0]
62 if gdspath == '':
63 gdspath = os.getcwd()
64
65 if os.path.splitext(gds_filepath)[1] != '.gds':
66 if os.path.splitext(gds_filepath)[1] == '':
67 gds_filepath += '.gds'
68 else:
69 print('Error: Project is not a GDS file!')
70 sys.exit(1)
71
72 # Check for valid path to the GDS file
73
74 if not os.path.isdir(gdspath):
75 print('Error: Project path "' + gds_filepath + '" does not exist or is not readable.')
76 sys.exit(1)
77
78 # Check for valid path to the layout directory (NOTE: Should check for
79 # additional argument or open_pdks install if not in a standard project space;
80 # this needs to be done.)
81
82 gdsroot = os.path.split(gdspath)[0]
83 magpath = gdsroot + '/mag'
84 if not os.path.isdir(magpath):
85 print('Error: Layout path "' + magpath + '" does not exist or is not readable.')
86 sys.exit(1)
87
88 if '-debug' in optionlist:
89 debugmode = True
90 if '-keep' in optionlist:
91 keepmode = True
92
93 # NOTE: There should be some attempt to find the installed PDK magicrc file
94 # if there is no mag/ directory.
95 rcfile = magpath + '/.magicrc'
96
97 with open(magpath + '/check_density.tcl', 'w') as ofile:
98 print('#!/bin/env wish', file=ofile)
99 print('crashbackups stop', file=ofile)
100 print('drc off', file=ofile)
101 print('snap internal', file=ofile)
102
103 print('set starttime [orig_clock format [orig_clock seconds] -format "%D %T"]', file=ofile)
104 print('puts stdout "Started reading GDS: $starttime"', file=ofile)
105 print('', file=ofile)
106 print('flush stdout', file=ofile)
107 print('update idletasks', file=ofile)
108
109 # Read GDS file
110 print('gds readonly true', file=ofile)
111 print('gds rescale false', file=ofile)
112 print('gds read ' + gds_filepath, file=ofile)
113 print('', file=ofile)
114
115 print('set midtime [orig_clock format [orig_clock seconds] -format "%D %T"]', file=ofile)
116 print('puts stdout "Starting density checks: $midtime"', file=ofile)
117 print('', file=ofile)
118 print('flush stdout', file=ofile)
119 print('update idletasks', file=ofile)
120
121 # Get step box dimensions (700um for size and 70um for step)
122 print('box values 0 0 0 0', file=ofile)
123 # print('box size 700um 700um', file=ofile)
124 # print('set stepbox [box values]', file=ofile)
125 # print('set stepwidth [lindex $stepbox 2]', file=ofile)
126 # print('set stepheight [lindex $stepbox 3]', file=ofile)
127
128 print('box size 70um 70um', file=ofile)
129 print('set stepbox [box values]', file=ofile)
130 print('set stepsizex [lindex $stepbox 2]', file=ofile)
131 print('set stepsizey [lindex $stepbox 3]', file=ofile)
132
133 print('select top cell', file=ofile)
134 print('expand', file=ofile)
135 print('set fullbox [box values]', file=ofile)
136 print('set xmax [lindex $fullbox 2]', file=ofile)
137 print('set xmin [lindex $fullbox 0]', file=ofile)
138 print('set fullwidth [expr {$xmax - $xmin}]', file=ofile)
139 print('set xtiles [expr {int(ceil(($fullwidth + 0.0) / $stepsizex))}]', file=ofile)
140 print('set ymax [lindex $fullbox 3]', file=ofile)
141 print('set ymin [lindex $fullbox 1]', file=ofile)
142 print('set fullheight [expr {$ymax - $ymin}]', file=ofile)
143 print('set ytiles [expr {int(ceil(($fullheight + 0.0) / $stepsizey))}]', file=ofile)
144 print('box size $stepsizex $stepsizey', file=ofile)
145 print('set xbase [lindex $fullbox 0]', file=ofile)
146 print('set ybase [lindex $fullbox 1]', file=ofile)
147 print('', file=ofile)
148
149 print('puts stdout "XTILES: $xtiles"', file=ofile)
150 print('puts stdout "YTILES: $ytiles"', file=ofile)
151 print('', file=ofile)
152
153 # Need to know what fraction of a full tile is the last row and column
154 print('set xfrac [expr {($xtiles * $stepsizex - $fullwidth + 0.0) / $stepsizex}]', file=ofile)
155 print('set yfrac [expr {($ytiles * $stepsizey - $fullheight + 0.0) / $stepsizey}]', file=ofile)
156 print('puts stdout "XFRAC: $xfrac"', file=ofile)
157 print('puts stdout "YFRAC: $yfrac"', file=ofile)
158
159 print('cif ostyle density', file=ofile)
160
161 # Process density at steps. For efficiency, this is done in 70x70 um
162 # areas, dumped to a file, and then aggregated into the 700x700 areas.
163
164 print('for {set y 0} {$y < $ytiles} {incr y} {', file=ofile)
165 print(' for {set x 0} {$x < $xtiles} {incr x} {', file=ofile)
166 print(' set xlo [expr $xbase + $x * $stepsizex]', file=ofile)
167 print(' set ylo [expr $ybase + $y * $stepsizey]', file=ofile)
168 print(' set xhi [expr $xlo + $stepsizex]', file=ofile)
169 print(' set yhi [expr $ylo + $stepsizey]', file=ofile)
170 print(' box values $xlo $ylo $xhi $yhi', file=ofile)
171
172 # Flatten this area
173 print(' flatten -dobbox -nolabels tile', file=ofile)
174 print(' load tile', file=ofile)
175 print(' select top cell', file=ofile)
176
177 # Run density check for each layer
178 print(' puts stdout "Density results for tile x=$x y=$y"', file=ofile)
179
180 print(' set fdens [cif list cover fom_all]', file=ofile)
181 print(' set pdens [cif list cover poly_all]', file=ofile)
182 print(' set ldens [cif list cover li_all]', file=ofile)
183 print(' set m1dens [cif list cover m1_all]', file=ofile)
184 print(' set m2dens [cif list cover m2_all]', file=ofile)
185 print(' set m3dens [cif list cover m3_all]', file=ofile)
186 print(' set m4dens [cif list cover m4_all]', file=ofile)
187 print(' set m5dens [cif list cover m5_all]', file=ofile)
188 print(' puts stdout "FOM: $fdens"', file=ofile)
189 print(' puts stdout "POLY: $pdens"', file=ofile)
190 print(' puts stdout "LI1: $ldens"', file=ofile)
191 print(' puts stdout "MET1: $m1dens"', file=ofile)
192 print(' puts stdout "MET2: $m2dens"', file=ofile)
193 print(' puts stdout "MET3: $m3dens"', file=ofile)
194 print(' puts stdout "MET4: $m4dens"', file=ofile)
195 print(' puts stdout "MET5: $m5dens"', file=ofile)
196 print(' flush stdout', file=ofile)
197 print(' update idletasks', file=ofile)
198
199 print(' load ' + project_with_id, file=ofile)
200 print(' cellname delete tile', file=ofile)
201
202 print(' }', file=ofile)
203 print('}', file=ofile)
204
205 print('set endtime [orig_clock format [orig_clock seconds] -format "%D %T"]', file=ofile)
206 print('puts stdout "Ended: $endtime"', file=ofile)
207 print('', file=ofile)
208
209
210 myenv = os.environ.copy()
211 myenv['MAGTYPE'] = 'mag'
212
213 print('Running density checks on file ' + gds_filepath, flush=True)
214
215 mproc = subprocess.Popen(['magic', '-dnull', '-noconsole',
216 '-rcfile', rcfile, magpath + '/check_density.tcl'],
217 stdin = subprocess.DEVNULL,
218 stdout = subprocess.PIPE,
219 stderr = subprocess.PIPE,
220 cwd = magpath,
221 env = myenv,
222 universal_newlines = True)
223
224 # Use signal to poll the process and generate any output as it arrives
225
Tim Edwardse4947402021-01-15 13:56:56 -0500226 dlines = []
Tim Edwards113b0832021-01-13 11:27:52 -0500227
228 while mproc:
229 status = mproc.poll()
230 if status != None:
231 try:
232 output = mproc.communicate(timeout=1)
233 except ValueError:
234 print('Magic forced stop, status ' + str(status))
235 sys.exit(1)
236 else:
237 outlines = output[0]
238 errlines = output[1]
239 for line in outlines.splitlines():
Tim Edwardse4947402021-01-15 13:56:56 -0500240 dlines.append(line)
Tim Edwards113b0832021-01-13 11:27:52 -0500241 print(line)
Tim Edwards113b0832021-01-13 11:27:52 -0500242 for line in errlines.splitlines():
243 print(line)
244 print('Magic exited with status ' + str(status))
245 if int(status) != 0:
246 sys.exit(int(status))
247 else:
248 break
249 else:
250 n = 0
251 while True:
252 n += 1
253 if n > 100:
254 n = 0
255 status = mproc.poll()
256 if status != None:
257 break
258 sresult = select.select([mproc.stdout, mproc.stderr], [], [], 0)[0]
259 if mproc.stdout in sresult:
260 outstring = mproc.stdout.readline().strip()
Tim Edwardse4947402021-01-15 13:56:56 -0500261 dlines.append(outstring)
Tim Edwards113b0832021-01-13 11:27:52 -0500262 print(outstring)
263 elif mproc.stderr in sresult:
264 outstring = mproc.stderr.readline().strip()
265 print(outstring)
266 else:
267 break
268
Tim Edwardse4947402021-01-15 13:56:56 -0500269 fomfill = []
270 polyfill = []
271 lifill = []
272 met1fill = []
273 met2fill = []
274 met3fill = []
275 met4fill = []
276 met5fill = []
277 xtiles = 0
278 ytiles = 0
279 xfrac = 0.0
280 yfrac = 0.0
281
282 for line in dlines:
283 dpair = line.split(':')
284 if len(dpair) == 2:
285 layer = dpair[0]
286 try:
287 density = float(dpair[1].strip())
288 except:
289 continue
290 if layer == 'FOM':
291 fomfill.append(density)
292 elif layer == 'POLY':
293 polyfill.append(density)
294 elif layer == 'LI1':
295 lifill.append(density)
296 elif layer == 'MET1':
297 met1fill.append(density)
298 elif layer == 'MET2':
299 met2fill.append(density)
300 elif layer == 'MET3':
301 met3fill.append(density)
302 elif layer == 'MET4':
303 met4fill.append(density)
304 elif layer == 'MET5':
305 met5fill.append(density)
306 elif layer == 'XTILES':
307 xtiles = int(dpair[1].strip())
308 elif layer == 'YTILES':
309 ytiles = int(dpair[1].strip())
310 elif layer == 'XFRAC':
311 xfrac = float(dpair[1].strip())
312 elif layer == 'YFRAC':
313 yfrac = float(dpair[1].strip())
314
315 if ytiles == 0 or xtiles == 0:
316 print('Failed to read XTILES or YTILES from output.')
317 sys.exit(1)
318
Tim Edwards113b0832021-01-13 11:27:52 -0500319 total_tiles = (ytiles - 9) * (xtiles - 9)
320
321 print('')
322 print('Density results (total tiles = ' + str(total_tiles) + '):')
323
324 # Full areas are 10 x 10 tiles = 100. But the right and top sides are
325 # not full tiles, so the full area must be prorated.
326
327 sideadjust = 90.0 + (10.0 * xfrac)
328 topadjust = 90.0 + (10.0 * yfrac)
329 corneradjust = 81.0 + (9.0 * xfrac) + (9.0 * yfrac) + (xfrac * yfrac)
330
331 print('')
332 print('FOM Density:')
333 for y in range(0, ytiles - 9):
334 if y == ytiles - 10:
335 atotal = topadjust
336 else:
337 atotal = 100.0
338 for x in range(0, xtiles - 9):
339 if x == xtiles - 10:
340 if y == ytiles - 10:
341 atotal = corneradjust
342 else:
343 atotal = sideadjust
344 fomaccum = 0
345 for w in range(y, y + 10):
346 base = xtiles * w + x
347 fomaccum += sum(fomfill[base : base + 10])
348
Tim Edwardse4947402021-01-15 13:56:56 -0500349 fomaccum /= atotal
350 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(fomaccum))
351 if fomaccum < 0.33:
Tim Edwards113b0832021-01-13 11:27:52 -0500352 print('***Error: FOM Density < 33%')
Tim Edwardse4947402021-01-15 13:56:56 -0500353 elif fomaccum > 0.57:
Tim Edwards113b0832021-01-13 11:27:52 -0500354 print('***Error: FOM Density > 57%')
355
356 print('')
357 print('POLY Density:')
358 for y in range(0, ytiles - 9):
359 if y == ytiles - 10:
360 atotal = topadjust
361 else:
362 atotal = 100.0
363 for x in range(0, xtiles - 9):
364 if x == xtiles - 10:
365 if y == ytiles - 10:
366 atotal = corneradjust
367 else:
368 atotal = sideadjust
369 polyaccum = 0
370 for w in range(y, y + 10):
371 base = xtiles * w + x
372 polyaccum += sum(polyfill[base : base + 10])
373
Tim Edwardse4947402021-01-15 13:56:56 -0500374 polyaccum /= atotal
375 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(polyaccum))
Tim Edwards113b0832021-01-13 11:27:52 -0500376
377 print('')
378 print('LI Density:')
379 for y in range(0, ytiles - 9):
380 if y == ytiles - 10:
381 atotal = topadjust
382 else:
383 atotal = 100.0
384 for x in range(0, xtiles - 9):
385 if x == xtiles - 10:
386 if y == ytiles - 10:
387 atotal = corneradjust
388 else:
389 atotal = sideadjust
390 liaccum = 0
391 for w in range(y, y + 10):
392 base = xtiles * w + x
393 liaccum += sum(lifill[base : base + 10])
394
Tim Edwardse4947402021-01-15 13:56:56 -0500395 liaccum /= atotal
396 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(liaccum))
397 if liaccum < 0.35:
Tim Edwards113b0832021-01-13 11:27:52 -0500398 print('***Error: LI Density < 35%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500399 elif liaccum > 0.60:
400 print('***Error: LI Density > 60%')
Tim Edwards113b0832021-01-13 11:27:52 -0500401
402 print('')
403 print('MET1 Density:')
404 for y in range(0, ytiles - 9):
405 if y == ytiles - 10:
406 atotal = topadjust
407 else:
408 atotal = 100.0
409 for x in range(0, xtiles - 9):
410 if x == xtiles - 10:
411 if y == ytiles - 10:
412 atotal = corneradjust
413 else:
414 atotal = sideadjust
415 met1accum = 0
416 for w in range(y, y + 10):
417 base = xtiles * w + x
418 met1accum += sum(met1fill[base : base + 10])
419
Tim Edwardse4947402021-01-15 13:56:56 -0500420 met1accum /= atotal
421 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(met1accum))
422 if met1accum < 0.35:
Tim Edwards113b0832021-01-13 11:27:52 -0500423 print('***Error: MET1 Density < 35%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500424 elif met1accum > 0.60:
425 print('***Error: MET1 Density > 60%')
Tim Edwards113b0832021-01-13 11:27:52 -0500426
427 print('')
428 print('MET2 Density:')
429 for y in range(0, ytiles - 9):
430 if y == ytiles - 10:
431 atotal = topadjust
432 else:
433 atotal = 100.0
434 for x in range(0, xtiles - 9):
435 if x == xtiles - 10:
436 if y == ytiles - 10:
437 atotal = corneradjust
438 else:
439 atotal = sideadjust
440 met2accum = 0
441 for w in range(y, y + 10):
442 base = xtiles * w + x
443 met2accum += sum(met2fill[base : base + 10])
444
Tim Edwardse4947402021-01-15 13:56:56 -0500445 met2accum /= atotal
446 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(met2accum))
447 if met2accum < 0.35:
Tim Edwards113b0832021-01-13 11:27:52 -0500448 print('***Error: MET2 Density < 35%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500449 elif met2accum > 0.60:
450 print('***Error: MET2 Density > 60%')
Tim Edwards113b0832021-01-13 11:27:52 -0500451
452 print('')
453 print('MET3 Density:')
454 for y in range(0, ytiles - 9):
455 if y == ytiles - 10:
456 atotal = topadjust
457 else:
458 atotal = 100.0
459 for x in range(0, xtiles - 9):
460 if x == xtiles - 10:
461 if y == ytiles - 10:
462 atotal = corneradjust
463 else:
464 atotal = sideadjust
465 met3accum = 0
466 for w in range(y, y + 10):
467 base = xtiles * w + x
468 met3accum += sum(met3fill[base : base + 10])
469
Tim Edwardse4947402021-01-15 13:56:56 -0500470 met3accum /= atotal
471 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(met3accum))
472 if met3accum < 0.35:
Tim Edwards113b0832021-01-13 11:27:52 -0500473 print('***Error: MET3 Density < 35%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500474 elif met3accum > 0.60:
475 print('***Error: MET3 Density > 60%')
Tim Edwards113b0832021-01-13 11:27:52 -0500476
477 print('')
478 print('MET4 Density:')
479 for y in range(0, ytiles - 9):
480 if y == ytiles - 10:
481 atotal = topadjust
482 else:
483 atotal = 100.0
484 for x in range(0, xtiles - 9):
485 if x == xtiles - 10:
486 if y == ytiles - 10:
487 atotal = corneradjust
488 else:
489 atotal = sideadjust
490 met4accum = 0
491 for w in range(y, y + 10):
492 base = xtiles * w + x
493 met4accum += sum(met4fill[base : base + 10])
494
Tim Edwardse4947402021-01-15 13:56:56 -0500495 met4accum /= atotal
496 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(met4accum))
497 if met4accum < 0.35:
Tim Edwards113b0832021-01-13 11:27:52 -0500498 print('***Error: MET4 Density < 35%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500499 elif met4accum > 0.60:
500 print('***Error: MET4 Density > 60%')
Tim Edwards113b0832021-01-13 11:27:52 -0500501
502 print('')
503 print('MET5 Density:')
504 for y in range(0, ytiles - 9):
505 if y == ytiles - 10:
506 atotal = topadjust
507 else:
508 atotal = 100.0
509 for x in range(0, xtiles - 9):
510 if x == xtiles - 10:
511 if y == ytiles - 10:
512 atotal = corneradjust
513 else:
514 atotal = sideadjust
515 met5accum = 0
516 for w in range(y, y + 10):
517 base = xtiles * w + x
518 met5accum += sum(met5fill[base : base + 10])
519
Tim Edwardse4947402021-01-15 13:56:56 -0500520 met5accum /= atotal
521 print('Tile (' + str(x) + ', ' + str(y) + '): ' + str(met5accum))
522 if met5accum < 0.45:
Tim Edwards113b0832021-01-13 11:27:52 -0500523 print('***Error: MET5 Density < 45%')
Tim Edwards4e3acd02021-02-06 10:58:50 -0500524 elif met5accum > 0.76:
525 print('***Error: MET5 Density > 76%')
Tim Edwardse4947402021-01-15 13:56:56 -0500526
527 print('')
528 print('Whole-chip density results:')
529
530 atotal = ((xtiles - 1.0) * (ytiles - 1.0)) + ((ytiles - 1.0) * xfrac) + ((xtiles - 1.0) * yfrac) + (xfrac * yfrac)
531
532 fomaccum = sum(fomfill) / atotal
533 print('')
534 print('FOM Density: ' + str(fomaccum))
535 if fomaccum < 0.33:
536 print('***Error: FOM Density < 33%')
537 elif fomaccum > 0.57:
538 print('***Error: FOM Density > 57%')
539
540 polyaccum = sum(polyfill) / atotal
541 print('')
542 print('POLY Density: ' + str(polyaccum))
543
544 liaccum = sum(lifill) / atotal
545 print('')
546 print('LI Density: ' + str(liaccum))
Tim Edwards04d1f832021-02-17 09:54:38 -0500547 if liaccum < 0.35:
Tim Edwardse4947402021-01-15 13:56:56 -0500548 print('***Error: LI Density < 35%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500549 elif liaccum > 0.60:
550 print('***Error: LI Density > 60%')
Tim Edwardse4947402021-01-15 13:56:56 -0500551
552 met1accum = sum(met1fill) / atotal
553 print('')
554 print('MET1 Density: ' + str(met1accum))
555 if met1accum < 0.35:
556 print('***Error: MET1 Density < 35%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500557 elif met1accum > 0.60:
558 print('***Error: MET1 Density > 60%')
Tim Edwardse4947402021-01-15 13:56:56 -0500559
560 met2accum = sum(met2fill) / atotal
561 print('')
562 print('MET2 Density: ' + str(met2accum))
563 if met2accum < 0.35:
564 print('***Error: MET2 Density < 35%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500565 elif met2accum > 0.60:
566 print('***Error: MET2 Density > 60%')
Tim Edwardse4947402021-01-15 13:56:56 -0500567
568 met3accum = sum(met3fill) / atotal
569 print('')
570 print('MET3 Density: ' + str(met3accum))
571 if met3accum < 0.35:
572 print('***Error: MET3 Density < 35%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500573 elif met3accum > 0.60:
574 print('***Error: MET3 Density > 60%')
Tim Edwardse4947402021-01-15 13:56:56 -0500575
576 met4accum = sum(met4fill) / atotal
577 print('')
578 print('MET4 Density: ' + str(met4accum))
579 if met4accum < 0.35:
580 print('***Error: MET4 Density < 35%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500581 elif met4accum > 0.60:
582 print('***Error: MET4 Density > 60%')
Tim Edwardse4947402021-01-15 13:56:56 -0500583
584 met5accum = sum(met5fill) / atotal
585 print('')
586 print('MET5 Density: ' + str(met5accum))
587 if met5accum < 0.45:
588 print('***Error: MET5 Density < 45%')
Tim Edwardsc5c73792021-02-05 20:42:04 -0500589 elif met5accum > 0.76:
590 print('***Error: MET5 Density > 76%')
Tim Edwards113b0832021-01-13 11:27:52 -0500591
592 if not keepmode:
Tim Edwards9dce9de2021-02-17 09:37:37 -0500593 if os.path.isfile(magpath + '/check_density.tcl'):
594 os.remove(magpath + '/check_density.tcl')
Tim Edwards113b0832021-01-13 11:27:52 -0500595
596 print('')
597 print('Done!')
598 sys.exit(0)
599