forked from materialsproject/pymatgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pymatgen.io.abinit.utils.html
604 lines (539 loc) · 41.7 KB
/
pymatgen.io.abinit.utils.html
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>pymatgen.io.abinit.utils module — pymatgen 2019.5.1 documentation</title>
<link rel="stylesheet" href="_static/proBlue.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-33990148-1']);
_gaq.push(['_trackPageview']);
</script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pymatgen 2019.5.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-pymatgen.io.abinit.utils">
<span id="pymatgen-io-abinit-utils-module"></span><h1>pymatgen.io.abinit.utils module<a class="headerlink" href="#module-pymatgen.io.abinit.utils" title="Permalink to this headline">¶</a></h1>
<p>Tools and helper functions for abinit calculations</p>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.Condition">
<em class="property">class </em><code class="descname">Condition</code><span class="sig-paren">(</span><em>cmap=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Condition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Condition" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This object receives a dictionary that defines a boolean condition whose syntax is similar
to the one used in mongodb (albeit not all the operators available in mongodb are supported here).</p>
<p>Example:</p>
<p>$gt: {field: {$gt: value} }</p>
<p>$gt selects those documents where the value of the field is greater than (i.e. >) the specified value.</p>
<p>$and performs a logical AND operation on an array of two or more expressions (e.g. <expression1>, <expression2>, etc.)
and selects the documents that satisfy all the expressions in the array.</p>
<p>{ $and: [ { <expression1> }, { <expression2> } , … , { <expressionN> } ] }</p>
<p>Consider the following example:</p>
<p>db.inventory.find( { qty: { $gt: 20 } } )
This query will select all documents in the inventory collection where the qty field value is greater than 20.
Consider the following example:</p>
<p>db.inventory.find( { qty: { $gt: 20 } } )
db.inventory.find({ $and: [ { price: 1.99 }, { qty: { $lt: 20 } }, { sale: true } ] } )</p>
<dl class="classmethod">
<dt id="pymatgen.io.abinit.utils.Condition.as_condition">
<em class="property">classmethod </em><code class="descname">as_condition</code><span class="sig-paren">(</span><em>obj</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Condition.as_condition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Condition.as_condition" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert obj into <a class="reference internal" href="#pymatgen.io.abinit.utils.Condition" title="pymatgen.io.abinit.utils.Condition"><code class="xref py py-class docutils literal notranslate"><span class="pre">Condition</span></code></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.Directory">
<em class="property">class </em><code class="descname">Directory</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Very simple class that provides helper functions
wrapping the most commonly used functions defined in os.path.</p>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.Directory.basename">
<code class="descname">basename</code><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.basename" title="Permalink to this definition">¶</a></dt>
<dd><p>Directory basename.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.clean">
<code class="descname">clean</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.clean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.clean" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove all files in the directory tree while preserving the directory</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.copy_abiext">
<code class="descname">copy_abiext</code><span class="sig-paren">(</span><em>inext</em>, <em>outext</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.copy_abiext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.copy_abiext" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy the Abinit file with extension inext to a new file withw extension outext</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.copy_r">
<code class="descname">copy_r</code><span class="sig-paren">(</span><em>dst</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.copy_r"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.copy_r" title="Permalink to this definition">¶</a></dt>
<dd><p>Implements a recursive copy function similar to Unix’s “cp -r” command.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.Directory.exists">
<code class="descname">exists</code><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.exists" title="Permalink to this definition">¶</a></dt>
<dd><p>True if file exists.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.find_1den_files">
<code class="descname">find_1den_files</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.find_1den_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.find_1den_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Abinit adds the idir-ipert index at the end of the 1DEN file and this breaks the extension
e.g. out_DEN1. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the <cite>path</cite> of the 1DEN file and the <cite>pertcase</cite> index.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.find_1wf_files">
<code class="descname">find_1wf_files</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.find_1wf_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.find_1wf_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Abinit adds the idir-ipert index at the end of the 1WF file and this breaks the extension
e.g. out_1WF4. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the <cite>path</cite> of the 1FK file and the <cite>pertcase</cite> index.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.find_last_timden_file">
<code class="descname">find_last_timden_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.find_last_timden_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.find_last_timden_file" title="Permalink to this definition">¶</a></dt>
<dd><p>ABINIT produces lots of out_TIM1_DEN files for each step and we need to find the lat
one in order to prepare the restart or to connect other tasks to the structural relaxation.</p>
<p>This function finds all the TIM?_DEN files in self and return a namedtuple (path, step)
where <cite>path</cite> is the path of the last TIM?_DEN file and step is the iteration number.
Returns None if the directory does not contain TIM?_DEN files.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.has_abiext">
<code class="descname">has_abiext</code><span class="sig-paren">(</span><em>ext</em>, <em>single_file=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.has_abiext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.has_abiext" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the absolute path of the ABINIT file with extension ext.
Support both Fortran files and netcdf files. In the later case,
we check whether a file with extension ext + “.nc” is present
in the directory. Returns empty string is file is not present.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ValueError</strong> – </p></li>
<li><p><strong>This implies that this method is not compatible with multiple datasets.</strong> – </p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.list_filepaths">
<code class="descname">list_filepaths</code><span class="sig-paren">(</span><em>wildcard=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.list_filepaths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.list_filepaths" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the list of absolute filepaths in the directory.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>wildcard</strong> – <p>String of tokens separated by “|”. Each token represents a pattern.
If wildcard is not None, we return only those files that match the given shell pattern (uses fnmatch).
.. rubric:: Example</p>
<p>wildcard=”<em>.nc|</em>.pdf” selects only those files that end with .nc or .pdf</p>
</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.makedirs">
<code class="descname">makedirs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.makedirs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.makedirs" title="Permalink to this definition">¶</a></dt>
<dd><p>Super-mkdir; create a leaf directory and all intermediate ones.
Works like mkdir, except that any intermediate path segment (not
just the rightmost) will be created if it does not exist.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.Directory.path">
<code class="descname">path</code><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.path" title="Permalink to this definition">¶</a></dt>
<dd><p>Absolute path of the directory.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.path_in">
<code class="descname">path_in</code><span class="sig-paren">(</span><em>file_basename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.path_in"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.path_in" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the absolute path of filename in the directory.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.path_join">
<code class="descname">path_join</code><span class="sig-paren">(</span><em>*p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.path_join"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.path_join" title="Permalink to this definition">¶</a></dt>
<dd><p>Join two or more pathname components, inserting ‘/’ as needed.
If any component is an absolute path, all previous path components will be discarded.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.Directory.relpath">
<code class="descname">relpath</code><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.relpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Relative path.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.remove_exts">
<code class="descname">remove_exts</code><span class="sig-paren">(</span><em>exts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.remove_exts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.remove_exts" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the files with the given extensions. Unlike rmtree, this function preserves the directory path.
Return list with the absolute paths of the files that have been removed.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.rename_abiext">
<code class="descname">rename_abiext</code><span class="sig-paren">(</span><em>inext</em>, <em>outext</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.rename_abiext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.rename_abiext" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename the Abinit file with extension inext with the new extension outext</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.rmtree">
<code class="descname">rmtree</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.rmtree"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.rmtree" title="Permalink to this definition">¶</a></dt>
<dd><p>Recursively delete the directory tree</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Directory.symlink_abiext">
<code class="descname">symlink_abiext</code><span class="sig-paren">(</span><em>inext</em>, <em>outext</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Directory.symlink_abiext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Directory.symlink_abiext" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a simbolic link (outext –> inext). The file names are implicitly
given by the ABINIT file extension.</p>
<p class="rubric">Example</p>
<p>outdir.symlink_abiext(‘1WF’, ‘DDK’)</p>
<p>creates the link out_DDK that points to out_1WF</p>
<p>Return: 0 if success.</p>
<p>Raise: RuntimeError</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.Dirviz">
<em class="property">class </em><code class="descname">Dirviz</code><span class="sig-paren">(</span><em>top</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Dirviz"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Dirviz" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Dirviz.get_cluster_graph">
<code class="descname">get_cluster_graph</code><span class="sig-paren">(</span><em>engine='fdp'</em>, <em>graph_attr=None</em>, <em>node_attr=None</em>, <em>edge_attr=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Dirviz.get_cluster_graph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Dirviz.get_cluster_graph" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate directory graph in the DOT language. Directories are shown as clusters</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This function scans the entire directory tree starting from top so the resulting
graph can be really big.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>engine</strong> – Layout command used. [‘dot’, ‘neato’, ‘twopi’, ‘circo’, ‘fdp’, ‘sfdp’, ‘patchwork’, ‘osage’]</p></li>
<li><p><strong>graph_attr</strong> – Mapping of (attribute, value) pairs for the graph.</p></li>
<li><p><strong>node_attr</strong> – Mapping of (attribute, value) pairs set for all nodes.</p></li>
<li><p><strong>edge_attr</strong> – Mapping of (attribute, value) pairs set for all edges.</p></li>
</ul>
</dd>
</dl>
<p>Returns: graphviz.Digraph <<a class="reference external" href="https://graphviz.readthedocs.io/en/stable/api.html#digraph">https://graphviz.readthedocs.io/en/stable/api.html#digraph</a>></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.Editor">
<em class="property">class </em><code class="descname">Editor</code><span class="sig-paren">(</span><em>editor=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Editor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Editor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Wrapper class that calls the editor specified by the user
or the one specified in the $EDITOR env variable.</p>
<p>If editor is None, $EDITOR is used.</p>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Editor.edit_file">
<code class="descname">edit_file</code><span class="sig-paren">(</span><em>fname</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Editor.edit_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Editor.edit_file" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.Editor.edit_files">
<code class="descname">edit_files</code><span class="sig-paren">(</span><em>fnames</em>, <em>ask_for_exit=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Editor.edit_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Editor.edit_files" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="pymatgen.io.abinit.utils.Editor.user_wants_to_exit">
<em class="property">static </em><code class="descname">user_wants_to_exit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#Editor.user_wants_to_exit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.Editor.user_wants_to_exit" title="Permalink to this definition">¶</a></dt>
<dd><p>Show an interactive prompt asking if exit is wanted.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.File">
<em class="property">class </em><code class="descname">File</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Very simple class used to store file basenames, absolute paths and directory names.
Provides wrappers for the most commonly used functions defined in os.path.</p>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.basename">
<code class="descname">basename</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.basename" title="Permalink to this definition">¶</a></dt>
<dd><p>File basename.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.chmod">
<code class="descname">chmod</code><span class="sig-paren">(</span><em>mode</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.chmod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.chmod" title="Permalink to this definition">¶</a></dt>
<dd><p>Change the access permissions of a file.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.dirname">
<code class="descname">dirname</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.dirname" title="Permalink to this definition">¶</a></dt>
<dd><p>Absolute path of the directory where the file is located.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.exists">
<code class="descname">exists</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.exists" title="Permalink to this definition">¶</a></dt>
<dd><p>True if file exists.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.get_stat">
<code class="descname">get_stat</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.get_stat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.get_stat" title="Permalink to this definition">¶</a></dt>
<dd><p>Results from os.stat</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.getsize">
<code class="descname">getsize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.getsize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.getsize" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size, in bytes, of path.
Return 0 if the file is empty or it does not exist.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.isncfile">
<code class="descname">isncfile</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.isncfile" title="Permalink to this definition">¶</a></dt>
<dd><p>True if self is a NetCDF file</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.make_dir">
<code class="descname">make_dir</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.make_dir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.make_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>Make the directory where the file is located.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.move">
<code class="descname">move</code><span class="sig-paren">(</span><em>dst</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.move"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.move" title="Permalink to this definition">¶</a></dt>
<dd><p>Recursively move a file or directory to another location. This is
similar to the Unix “mv” command.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.path">
<code class="descname">path</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.path" title="Permalink to this definition">¶</a></dt>
<dd><p>Absolute path of the file.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.read">
<code class="descname">read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.read"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read data from file.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.readlines">
<code class="descname">readlines</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.readlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.readlines" title="Permalink to this definition">¶</a></dt>
<dd><p>Read lines from files.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymatgen.io.abinit.utils.File.relpath">
<code class="descname">relpath</code><a class="headerlink" href="#pymatgen.io.abinit.utils.File.relpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Relative path.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the file.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write string to file.</p>
</dd></dl>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.File.writelines">
<code class="descname">writelines</code><span class="sig-paren">(</span><em>lines</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#File.writelines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.File.writelines" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a list of strings to file.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.FilepathFixer">
<em class="property">class </em><code class="descname">FilepathFixer</code><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#FilepathFixer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.FilepathFixer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This object modifies the names of particular output files
produced by ABINIT so that the file extension is preserved.
Having a one-to-one mapping between file extension and data format
is indeed fundamental for the correct behaviour of abinit since:</p>
<blockquote>
<div><ul class="simple">
<li><p>We locate the output file by just inspecting the extension</p></li>
<li><p>We select the variables that must be added to the input file
on the basis of the extension specified by the user during
the initialization of the <cite>AbinitFlow</cite>.</p></li>
</ul>
</div></blockquote>
<p>Unfortunately, ABINIT developers like to append extra stuff
to the initial extension and therefore we have to call
<cite>FilepathFixer</cite> to fix the output files produced by the run.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">fixer</span> <span class="o">=</span> <span class="n">FilepathFixer</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">fixer</span><span class="o">.</span><span class="n">fix_paths</span><span class="p">(</span><span class="s1">'/foo/out_1WF17'</span><span class="p">)</span> <span class="o">==</span> <span class="p">{</span><span class="s1">'/foo/out_1WF17'</span><span class="p">:</span> <span class="s1">'/foo/out_1WF'</span><span class="p">}</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">fixer</span><span class="o">.</span><span class="n">fix_paths</span><span class="p">(</span><span class="s1">'/foo/out_1WF5.nc'</span><span class="p">)</span> <span class="o">==</span> <span class="p">{</span><span class="s1">'/foo/out_1WF5.nc'</span><span class="p">:</span> <span class="s1">'/foo/out_1WF.nc'</span><span class="p">}</span>
</pre></div>
</div>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.FilepathFixer.fix_paths">
<code class="descname">fix_paths</code><span class="sig-paren">(</span><em>paths</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#FilepathFixer.fix_paths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.FilepathFixer.fix_paths" title="Permalink to this definition">¶</a></dt>
<dd><p>Fix the filenames in the iterable paths</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Mapping old_path –> new_path</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>old2new</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pymatgen.io.abinit.utils.SparseHistogram">
<em class="property">class </em><code class="descname">SparseHistogram</code><span class="sig-paren">(</span><em>items</em>, <em>key=None</em>, <em>num=None</em>, <em>step=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#SparseHistogram"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.SparseHistogram" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="pymatgen.io.abinit.utils.SparseHistogram.plot">
<code class="descname">plot</code><span class="sig-paren">(</span><em>ax=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#SparseHistogram.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.SparseHistogram.plot" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot the histogram with matplotlib, returns <cite>matplotlib</cite> figure.</p>
<p>Keyword arguments controlling the display of the figure:</p>
<table class="docutils align-center">
<colgroup>
<col style="width: 23%" />
<col style="width: 77%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>kwargs</p></th>
<th class="head"><p>Meaning</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>title</p></td>
<td><p>Title of the plot (Default: None).</p></td>
</tr>
<tr class="row-odd"><td><p>show</p></td>
<td><p>True to show the figure (default: True).</p></td>
</tr>
<tr class="row-even"><td><p>savefig</p></td>
<td><p>“abc.png” or “abc.eps” to save the figure to a file.</p></td>
</tr>
<tr class="row-odd"><td><p>size_kwargs</p></td>
<td><p>Dictionary with options passed to fig.set_size_inches
e.g. size_kwargs=dict(w=3, h=4)</p></td>
</tr>
<tr class="row-even"><td><p>tight_layout</p></td>
<td><p>True to call fig.tight_layout (default: False)</p></td>
</tr>
<tr class="row-odd"><td><p>ax_grid</p></td>
<td><p>True (False) to add (remove) grid from all axes in fig.
Default: None i.e. fig is left unchanged.</p></td>
</tr>
<tr class="row-even"><td><p>ax_annotate</p></td>
<td><p>Add labels to subplots e.g. (a), (b).
Default: False</p></td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.abi_extensions">
<code class="descname">abi_extensions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#abi_extensions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.abi_extensions" title="Permalink to this definition">¶</a></dt>
<dd><p>List with all the ABINIT extensions that are registered.</p>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.abi_splitext">
<code class="descname">abi_splitext</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#abi_splitext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.abi_splitext" title="Permalink to this definition">¶</a></dt>
<dd><p>Split the ABINIT extension from a filename.
“Extension” are found by searching in an internal database.</p>
<p>Returns “(root, ext)” where ext is the registered ABINIT extension
The final “.nc” is included (if any)</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">assert</span> <span class="n">abi_splitext</span><span class="p">(</span><span class="s2">"foo_WFK"</span><span class="p">)</span> <span class="o">==</span> <span class="p">(</span><span class="s1">'foo_'</span><span class="p">,</span> <span class="s1">'WFK'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">abi_splitext</span><span class="p">(</span><span class="s2">"/home/guido/foo_bar_WFK.nc"</span><span class="p">)</span> <span class="o">==</span> <span class="p">(</span><span class="s1">'foo_bar_'</span><span class="p">,</span> <span class="s1">'WFK.nc'</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.as_bool">
<code class="descname">as_bool</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#as_bool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.as_bool" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a string into a boolean.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">assert</span> <span class="n">as_bool</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">True</span> <span class="ow">and</span> <span class="n">as_bool</span><span class="p">(</span><span class="s2">"Yes"</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">True</span> <span class="ow">and</span> <span class="n">as_bool</span><span class="p">(</span><span class="s2">"false"</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">False</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.evaluate_rpn">
<code class="descname">evaluate_rpn</code><span class="sig-paren">(</span><em>rpn</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#evaluate_rpn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.evaluate_rpn" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluates the RPN form produced my map2rpn.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>bool</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.irdvars_for_ext">
<code class="descname">irdvars_for_ext</code><span class="sig-paren">(</span><em>ext</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#irdvars_for_ext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.irdvars_for_ext" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a dictionary with the ABINIT variables
that must be used to read the file with extension ext.</p>
</dd></dl>
<dl class="function">
<dt id="pymatgen.io.abinit.utils.map2rpn">
<code class="descname">map2rpn</code><span class="sig-paren">(</span><em>map</em>, <em>obj</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/abinit/utils.html#map2rpn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.abinit.utils.map2rpn" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a Mongodb-like dictionary to a RPN list of operands and operators.</p>
<p>Reverse Polish notation (RPN) is a mathematical notation in which every
operator follows all of its operands, e.g.</p>
<p>3 - 4 + 5 –> 3 4 - 5 +</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="mf">2.0</span><span class="p">:</span> <span class="p">{</span><span class="s1">'$eq'</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}}</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">map2rpn</span><span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="o">==</span> <span class="p">[</span><span class="mf">2.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="s1">'$eq'</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pymatgen.io.abinit.utils.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pymatgen 2019.5.1 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2011, Pymatgen Development Team.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.0.1.
</div>
<div class="footer">This page uses <a href="http://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.
<script type="text/javascript">
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
</script>
</div>
</body>
</html>