0
# File I/O & Format Support
1
2
Extensive I/O support for electronic structure codes (VASP, Quantum ESPRESSO, Gaussian, etc.), structure formats (CIF, XYZ, POSCAR), and materials databases. These capabilities enable seamless integration with computational workflows and data exchange between different software packages in materials science.
3
4
## Capabilities
5
6
### VASP I/O
7
8
Comprehensive support for Vienna Ab initio Simulation Package (VASP) input and output files.
9
10
```python { .api }
11
class Poscar:
12
"""
13
VASP POSCAR file handling for structure input/output.
14
15
Parameters:
16
- structure: Structure object
17
- comment: Comment line for POSCAR
18
- selective_dynamics: Selective dynamics array
19
- true_names: Whether to use true element names
20
- velocities: Atomic velocities for MD
21
- predictor_corrector: Predictor-corrector data
22
- predictor_corrector_preamble: PC preamble text
23
"""
24
def __init__(self, structure, comment=None, selective_dynamics=None,
25
true_names=True, velocities=None, predictor_corrector=None,
26
predictor_corrector_preamble=None): ...
27
28
@classmethod
29
def from_file(cls, filename, check_for_potcar=True, read_velocities=True):
30
"""
31
Read POSCAR from file.
32
33
Parameters:
34
filename: Path to POSCAR file
35
check_for_potcar: Whether to check for POTCAR consistency
36
read_velocities: Whether to read velocity data
37
38
Returns:
39
Poscar: POSCAR object
40
"""
41
42
@classmethod
43
def from_string(cls, data, default_names=None, read_velocities=True):
44
"""
45
Read POSCAR from string.
46
47
Parameters:
48
data: POSCAR string data
49
default_names: Default element names if not specified
50
read_velocities: Whether to read velocities
51
52
Returns:
53
Poscar: POSCAR object
54
"""
55
56
def write_file(self, filename, **kwargs):
57
"""
58
Write POSCAR to file.
59
60
Parameters:
61
filename: Output filename
62
"""
63
64
def get_string(self, direct=True, vasp4_compatible=False,
65
significant_figures=6):
66
"""
67
Get POSCAR string representation.
68
69
Parameters:
70
direct: Whether to use direct coordinates
71
vasp4_compatible: Whether to use VASP4 format
72
significant_figures: Number of significant figures
73
74
Returns:
75
str: POSCAR string
76
"""
77
78
@property
79
def structure(self):
80
"""Structure object."""
81
82
@property
83
def comment(self):
84
"""Comment string."""
85
86
@property
87
def natoms(self):
88
"""Number of atoms by species."""
89
90
@property
91
def site_symbols(self):
92
"""Site symbols array."""
93
```
94
95
```python { .api }
96
class Incar:
97
"""
98
VASP INCAR file handling for calculation parameters.
99
100
Parameters:
101
- params: Dictionary of INCAR parameters
102
"""
103
def __init__(self, params=None): ...
104
105
@classmethod
106
def from_file(cls, filename):
107
"""
108
Read INCAR from file.
109
110
Parameters:
111
filename: Path to INCAR file
112
113
Returns:
114
Incar: INCAR object
115
"""
116
117
@classmethod
118
def from_string(cls, string):
119
"""
120
Read INCAR from string.
121
122
Parameters:
123
string: INCAR string data
124
125
Returns:
126
Incar: INCAR object
127
"""
128
129
def write_file(self, filename):
130
"""
131
Write INCAR to file.
132
133
Parameters:
134
filename: Output filename
135
"""
136
137
def get_string(self, sort_keys=False, pretty=False):
138
"""
139
Get INCAR string representation.
140
141
Parameters:
142
sort_keys: Whether to sort parameter keys
143
pretty: Whether to format for readability
144
145
Returns:
146
str: INCAR string
147
"""
148
149
def __getitem__(self, key): ...
150
def __setitem__(self, key, val): ...
151
def __delitem__(self, key): ...
152
def __contains__(self, key): ...
153
154
def check_params(self):
155
"""
156
Check INCAR parameters for common issues.
157
158
Returns:
159
list: List of warnings/errors found
160
"""
161
162
def diff(self, other):
163
"""
164
Compare with another INCAR.
165
166
Parameters:
167
other: Another Incar object
168
169
Returns:
170
dict: Differences between INCARs
171
"""
172
```
173
174
```python { .api }
175
class Kpoints:
176
"""
177
VASP KPOINTS file handling for k-point mesh specifications.
178
179
Parameters:
180
- comment: Comment line
181
- num_kpts: Number of k-points
182
- style: K-points style (Gamma, Monkhorst-Pack, etc.)
183
- kpts: K-points array
184
- kpts_weights: K-point weights
185
- coord_type: Coordinate type (Reciprocal, Cartesian)
186
- kpts_shift: K-point shift
187
- tet_number: Tetrahedron method number
188
- tet_weight: Tetrahedron weights
189
- tet_connections: Tetrahedron connections
190
"""
191
def __init__(self, comment="Default gamma", num_kpts=0,
192
style=Kpoints_supported_modes.Gamma,
193
kpts=((1, 1, 1),), kpts_weights=None,
194
coord_type=None, kpts_shift=(0, 0, 0),
195
tet_number=0, tet_weight=0, tet_connections=None): ...
196
197
@classmethod
198
def gamma_automatic(cls, kpts=(1, 1, 1), shift=(0, 0, 0)):
199
"""
200
Create Gamma-centered automatic k-point mesh.
201
202
Parameters:
203
kpts: K-point mesh dimensions
204
shift: K-point shift
205
206
Returns:
207
Kpoints: Gamma automatic k-points
208
"""
209
210
@classmethod
211
def monkhorst_automatic(cls, kpts=(2, 2, 2), shift=(0, 0, 0)):
212
"""
213
Create Monkhorst-Pack automatic k-point mesh.
214
215
Parameters:
216
kpts: K-point mesh dimensions
217
shift: K-point shift
218
219
Returns:
220
Kpoints: Monkhorst-Pack k-points
221
"""
222
223
@classmethod
224
def automatic_density(cls, structure, kppa, force_gamma=False):
225
"""
226
Create automatic k-point mesh based on density.
227
228
Parameters:
229
structure: Structure object
230
kppa: K-points per atom
231
force_gamma: Whether to force Gamma-centered mesh
232
233
Returns:
234
Kpoints: Automatic density k-points
235
"""
236
237
@classmethod
238
def automatic_linemode(cls, divisions, ibz):
239
"""
240
Create automatic line-mode k-points for band structure.
241
242
Parameters:
243
divisions: Number of divisions between k-points
244
ibz: Irreducible Brillouin zone object
245
246
Returns:
247
Kpoints: Line-mode k-points
248
"""
249
250
@classmethod
251
def from_file(cls, filename):
252
"""Read KPOINTS from file."""
253
254
@classmethod
255
def from_string(cls, string):
256
"""Read KPOINTS from string."""
257
258
def write_file(self, filename):
259
"""Write KPOINTS to file."""
260
261
def get_string(self):
262
"""Get KPOINTS string representation."""
263
```
264
265
```python { .api }
266
class Vasprun:
267
"""
268
VASP vasprun.xml output file parsing and analysis.
269
270
Parameters:
271
- filename: Path to vasprun.xml file
272
- ionic_step_skip: Number of ionic steps to skip
273
- ionic_step_offset: Ionic step offset
274
- parse_dos: Whether to parse DOS data
275
- parse_eigen: Whether to parse eigenvalue data
276
- parse_projected_eigen: Whether to parse projected eigenvalues
277
- parse_potcar_file: Whether to parse POTCAR info
278
- occu_tol: Occupation tolerance for metallic systems
279
- exception_on_bad_xml: Whether to raise exception on bad XML
280
"""
281
def __init__(self, filename, ionic_step_skip=None, ionic_step_offset=0,
282
parse_dos=True, parse_eigen=True, parse_projected_eigen=True,
283
parse_potcar_file=True, occu_tol=1e-8, exception_on_bad_xml=True): ...
284
285
def get_band_structure(self, kpoints_filename=None, efermi=None,
286
line_mode=False, force_hybrid_mode=False):
287
"""
288
Get band structure from calculation.
289
290
Parameters:
291
kpoints_filename: Path to KPOINTS file for labeling
292
efermi: Fermi energy override
293
line_mode: Whether calculation was in line mode
294
force_hybrid_mode: Force hybrid functional mode
295
296
Returns:
297
BandStructure or BandStructureSymmLine: Band structure object
298
"""
299
300
def get_dos(self):
301
"""
302
Get density of states.
303
304
Returns:
305
CompleteDos: Complete DOS object with projections
306
"""
307
308
def get_trajectories(self):
309
"""
310
Get MD trajectories.
311
312
Returns:
313
list: List of trajectory data
314
"""
315
316
def get_computed_entry(self, inc_structure=True, parameters=None,
317
data=None):
318
"""
319
Get computed entry for the calculation.
320
321
Parameters:
322
inc_structure: Whether to include structure
323
parameters: Additional parameters to include
324
data: Additional data to include
325
326
Returns:
327
ComputedEntry or ComputedStructureEntry: Entry object
328
"""
329
330
@property
331
def final_structure(self):
332
"""Final optimized structure."""
333
334
@property
335
def initial_structure(self):
336
"""Initial structure."""
337
338
@property
339
def final_energy(self):
340
"""Final total energy."""
341
342
@property
343
def structures(self):
344
"""All structures from ionic steps."""
345
346
@property
347
def ionic_steps(self):
348
"""Ionic step data."""
349
350
@property
351
def electronic_steps(self):
352
"""Electronic step data."""
353
354
@property
355
def dielectric(self):
356
"""Dielectric tensor data."""
357
358
@property
359
def optical_absorption_coeff(self):
360
"""Optical absorption coefficient."""
361
362
@property
363
def epsilon_static(self):
364
"""Static dielectric constant."""
365
366
@property
367
def epsilon_ionic(self):
368
"""Ionic contribution to dielectric constant."""
369
370
@property
371
def nionic_steps(self):
372
"""Number of ionic steps."""
373
374
@property
375
def md_data(self):
376
"""Molecular dynamics data."""
377
378
@property
379
def converged_electronic(self):
380
"""Whether electronic steps converged."""
381
382
@property
383
def converged_ionic(self):
384
"""Whether ionic steps converged."""
385
386
@property
387
def converged(self):
388
"""Whether calculation converged."""
389
```
390
391
```python { .api }
392
class Outcar:
393
"""
394
VASP OUTCAR file parsing.
395
396
Parameters:
397
- filename: Path to OUTCAR file
398
"""
399
def __init__(self, filename): ...
400
401
@property
402
def magnetization(self):
403
"""Atomic magnetizations."""
404
405
@property
406
def chemical_shielding(self):
407
"""NMR chemical shielding tensors."""
408
409
@property
410
def unsym_cs_tensor(self):
411
"""Unsymmetrized chemical shielding tensor."""
412
413
@property
414
def cs_g0_contribution(self):
415
"""G=0 contribution to chemical shielding."""
416
417
@property
418
def cs_core_contribution(self):
419
"""Core contribution to chemical shielding."""
420
421
@property
422
def efg(self):
423
"""Electric field gradient tensors."""
424
425
@property
426
def charge(self):
427
"""Atomic charges."""
428
429
@property
430
def is_stopped(self):
431
"""Whether calculation was stopped."""
432
433
@property
434
def run_stats(self):
435
"""Runtime statistics."""
436
437
@property
438
def elastic_tensor(self):
439
"""Elastic tensor."""
440
441
@property
442
def piezo_tensor(self):
443
"""Piezoelectric tensor."""
444
445
@property
446
def dielectric_tensor(self):
447
"""Dielectric tensor."""
448
449
@property
450
def born(self):
451
"""Born effective charges."""
452
453
@property
454
def total_mag(self):
455
"""Total magnetization."""
456
457
@property
458
def nelect(self):
459
"""Number of electrons."""
460
461
@property
462
def efermi(self):
463
"""Fermi energy."""
464
465
@property
466
def lepsilon(self):
467
"""Whether LEPSILON was set."""
468
469
@property
470
def lcalcpol(self):
471
"""Whether LCALCPOL was set."""
472
```
473
474
### Quantum ESPRESSO I/O
475
476
Support for Quantum ESPRESSO plane-wave DFT code input and output.
477
478
```python { .api }
479
class PWInput:
480
"""
481
Quantum ESPRESSO PWscf input file handling.
482
483
Parameters:
484
- structure: Structure object
485
- control: Control parameters dict
486
- system: System parameters dict
487
- electrons: Electrons parameters dict
488
- ions: Ions parameters dict
489
- cell: Cell parameters dict
490
- kpoints_mode: K-points specification mode
491
- kpoints_grid: K-points grid
492
- kpoints_shift: K-points shift
493
"""
494
def __init__(self, structure, control=None, system=None, electrons=None,
495
ions=None, cell=None, kpoints_mode="automatic",
496
kpoints_grid=(1, 1, 1), kpoints_shift=(0, 0, 0)): ...
497
498
@classmethod
499
def from_file(cls, filename):
500
"""
501
Read PWInput from file.
502
503
Parameters:
504
filename: Path to input file
505
506
Returns:
507
PWInput: PWInput object
508
"""
509
510
@classmethod
511
def from_string(cls, string):
512
"""Read PWInput from string."""
513
514
def write_file(self, filename):
515
"""Write PWInput to file."""
516
517
def get_string(self):
518
"""Get input file string representation."""
519
520
@property
521
def structure(self):
522
"""Structure object."""
523
```
524
525
```python { .api }
526
class PWOutput:
527
"""
528
Quantum ESPRESSO PWscf output file parsing.
529
530
Parameters:
531
- filename: Path to output file
532
"""
533
def __init__(self, filename): ...
534
535
@property
536
def final_structure(self):
537
"""Final optimized structure."""
538
539
@property
540
def final_energy(self):
541
"""Final total energy."""
542
543
@property
544
def structures(self):
545
"""All structures from optimization."""
546
547
@property
548
def lattice_type(self):
549
"""Lattice type."""
550
551
@property
552
def stress(self):
553
"""Stress tensor."""
554
555
@property
556
def convergence_data(self):
557
"""SCF convergence data."""
558
```
559
560
### Gaussian I/O
561
562
Support for Gaussian quantum chemistry package input and output.
563
564
```python { .api }
565
class GaussianInput:
566
"""
567
Gaussian input file generation.
568
569
Parameters:
570
- mol: Molecule object
571
- charge: Molecular charge
572
- spin_multiplicity: Spin multiplicity
573
- title: Job title
574
- functional: DFT functional
575
- basis_set: Basis set
576
- route_parameters: Route section parameters
577
- input_parameters: Additional input parameters
578
- link0_parameters: Link 0 parameters
579
- dieze_tag: Dieze tag for job type
580
"""
581
def __init__(self, mol, charge=0, spin_multiplicity=None, title="",
582
functional="HF", basis_set="6-31G(d)", route_parameters=None,
583
input_parameters=None, link0_parameters=None, dieze_tag="#P"): ...
584
585
@classmethod
586
def from_file(cls, filename):
587
"""Read GaussianInput from file."""
588
589
@classmethod
590
def from_string(cls, contents):
591
"""Read GaussianInput from string."""
592
593
def write_file(self, filename, cart_coords=False):
594
"""
595
Write Gaussian input file.
596
597
Parameters:
598
filename: Output filename
599
cart_coords: Whether to use Cartesian coordinates
600
"""
601
602
def get_string(self, cart_coords=False):
603
"""Get input file string representation."""
604
605
@property
606
def molecule(self):
607
"""Molecule object."""
608
```
609
610
```python { .api }
611
class GaussianOutput:
612
"""
613
Gaussian output file parsing.
614
615
Parameters:
616
- filename: Path to output file
617
"""
618
def __init__(self, filename): ...
619
620
@property
621
def structures(self):
622
"""All molecular structures from output."""
623
624
@property
625
def final_structure(self):
626
"""Final optimized structure."""
627
628
@property
629
def final_energy(self):
630
"""Final energy."""
631
632
@property
633
def energies(self):
634
"""All energies from optimization/scan."""
635
636
@property
637
def eigenvalues(self):
638
"""Orbital eigenvalues."""
639
640
@property
641
def molecular_orbital(self):
642
"""Molecular orbital data."""
643
644
@property
645
def basis_set(self):
646
"""Basis set information."""
647
648
@property
649
def bond_orders(self):
650
"""Mayer bond orders."""
651
652
@property
653
def cartesian_forces(self):
654
"""Cartesian forces."""
655
656
@property
657
def frequencies(self):
658
"""Vibrational frequencies."""
659
660
@property
661
def frequency_modes(self):
662
"""Vibrational modes."""
663
664
@property
665
def hessian(self):
666
"""Hessian matrix."""
667
668
@property
669
def properly_terminated(self):
670
"""Whether calculation terminated properly."""
671
672
@property
673
def is_pcm(self):
674
"""Whether PCM solvation was used."""
675
676
@property
677
def errors(self):
678
"""Errors encountered during calculation."""
679
680
@property
681
def num_basis_func(self):
682
"""Number of basis functions."""
683
```
684
685
### Structure File Formats
686
687
Support for common crystallographic and molecular file formats.
688
689
```python { .api }
690
class CifParser:
691
"""
692
Crystallographic Information File (CIF) parser.
693
694
Parameters:
695
- filename: Path to CIF file
696
- occupancy_tolerance: Tolerance for occupancy checking
697
- site_tolerance: Site tolerance for structure generation
698
"""
699
def __init__(self, filename, occupancy_tolerance=1.0, site_tolerance=1e-4): ...
700
701
def get_structures(self, primitive=True, symmetrized=False,
702
conventional_unit_cell=False):
703
"""
704
Get structures from CIF file.
705
706
Parameters:
707
primitive: Whether to return primitive cell
708
symmetrized: Whether to return symmetrized structure
709
conventional_unit_cell: Whether to return conventional unit cell
710
711
Returns:
712
list: List of Structure objects
713
"""
714
715
def get_bibtex_string(self):
716
"""
717
Get BibTeX citation string.
718
719
Returns:
720
str: BibTeX citation
721
"""
722
723
@property
724
def has_errors(self):
725
"""Whether parser encountered errors."""
726
727
@property
728
def errors(self):
729
"""List of parsing errors."""
730
```
731
732
```python { .api }
733
class CifWriter:
734
"""
735
CIF file writer.
736
737
Parameters:
738
- struct: Structure object to write
739
- symprec: Symmetry precision for space group detection
740
"""
741
def __init__(self, struct, symprec=None): ...
742
743
def write_file(self, filename):
744
"""
745
Write structure to CIF file.
746
747
Parameters:
748
filename: Output filename
749
"""
750
751
def __str__(self):
752
"""Get CIF string representation."""
753
```
754
755
```python { .api }
756
class XYZ:
757
"""
758
XYZ format file handling for molecular structures.
759
760
Parameters:
761
- mol: Molecule object
762
- coord_precision: Coordinate precision for output
763
"""
764
def __init__(self, mol, coord_precision=6): ...
765
766
@classmethod
767
def from_file(cls, filename):
768
"""
769
Read XYZ from file.
770
771
Parameters:
772
filename: Path to XYZ file
773
774
Returns:
775
XYZ: XYZ object
776
"""
777
778
@classmethod
779
def from_string(cls, contents):
780
"""Read XYZ from string."""
781
782
def write_file(self, filename):
783
"""Write XYZ to file."""
784
785
def get_string(self):
786
"""Get XYZ string representation."""
787
788
@property
789
def molecule(self):
790
"""Molecule object."""
791
792
def all_molecules(self):
793
"""
794
Get all molecules if multi-molecule XYZ.
795
796
Returns:
797
list: List of Molecule objects
798
"""
799
```
800
801
### Materials Database Interfaces
802
803
Interfaces for accessing materials databases and repositories.
804
805
```python { .api }
806
class MPRester:
807
"""
808
Materials Project REST interface for accessing MP database.
809
810
Parameters:
811
- api_key: Materials Project API key
812
- endpoint: API endpoint URL
813
"""
814
def __init__(self, api_key=None, endpoint=None): ...
815
816
def get_structure_by_material_id(self, material_id, final=True):
817
"""
818
Get structure by Materials Project ID.
819
820
Parameters:
821
material_id: MP material ID (e.g., "mp-149")
822
final: Whether to get final relaxed structure
823
824
Returns:
825
Structure: Structure object
826
"""
827
828
def get_structures(self, chemsys_formula_id_criteria, final=True):
829
"""
830
Get structures matching criteria.
831
832
Parameters:
833
chemsys_formula_id_criteria: Search criteria
834
final: Whether to get final structures
835
836
Returns:
837
list: List of Structure objects
838
"""
839
840
def get_entries(self, chemsys_formula_id_criteria, compatible_only=True,
841
inc_structure=None, property_data=None, conventional_unit_cell=False):
842
"""
843
Get computed entries matching criteria.
844
845
Parameters:
846
chemsys_formula_id_criteria: Search criteria
847
compatible_only: Whether to apply compatibility corrections
848
inc_structure: Whether to include structure data
849
property_data: Additional properties to include
850
conventional_unit_cell: Whether to use conventional unit cell
851
852
Returns:
853
list: List of ComputedEntry objects
854
"""
855
856
def get_entries_in_chemsys(self, elements, compatible_only=True,
857
inc_structure=None, property_data=None,
858
conventional_unit_cell=False):
859
"""
860
Get entries in chemical system.
861
862
Parameters:
863
elements: List of elements in chemical system
864
865
Returns:
866
list: List of entries in the chemical system
867
"""
868
869
def get_exp_entry(self, formula):
870
"""
871
Get experimental entry for formula.
872
873
Parameters:
874
formula: Chemical formula
875
876
Returns:
877
ExpEntry: Experimental entry object
878
"""
879
880
def get_pourbaix_entries(self, chemsys, solid_compat="MaterialsProjectAqueousCompatibility"):
881
"""
882
Get Pourbaix entries for chemical system.
883
884
Parameters:
885
chemsys: Chemical system
886
solid_compat: Solid compatibility scheme
887
888
Returns:
889
list: List of PourbaixEntry objects
890
"""
891
892
def get_phase_diagram_by_elements(self, elements, **kwargs):
893
"""
894
Get phase diagram for elements.
895
896
Parameters:
897
elements: List of Element objects or symbols
898
899
Returns:
900
PhaseDiagram: Phase diagram object
901
"""
902
903
def get_cohp_by_material_id(self, material_id, path_type="coop",
904
summed_spin_channels=False):
905
"""
906
Get COHP data by material ID.
907
908
Parameters:
909
material_id: MP material ID
910
path_type: Type of COHP data ("cohp", "coop", "cobiop")
911
summed_spin_channels: Whether to sum spin channels
912
913
Returns:
914
CompleteCohp: COHP analysis object
915
"""
916
917
def get_bandstructure_by_material_id(self, material_id, line_mode=True):
918
"""
919
Get band structure by material ID.
920
921
Parameters:
922
material_id: MP material ID
923
line_mode: Whether to get line-mode band structure
924
925
Returns:
926
BandStructure: Band structure object
927
"""
928
929
def get_dos_by_material_id(self, material_id):
930
"""
931
Get DOS by material ID.
932
933
Parameters:
934
material_id: MP material ID
935
936
Returns:
937
CompleteDos: Complete DOS object
938
"""
939
```
940
941
### Advanced I/O Classes
942
943
Specialized I/O classes for complex file formats and workflows.
944
945
```python { .api }
946
class InputSet:
947
"""
948
Abstract base class for input file sets.
949
"""
950
951
def write_input(self, output_dir, make_dir_if_not_present=True,
952
overwrite=True, zip_output=False):
953
"""
954
Write input set to directory.
955
956
Parameters:
957
output_dir: Output directory path
958
make_dir_if_not_present: Whether to create directory
959
overwrite: Whether to overwrite existing files
960
zip_output: Whether to create ZIP archive
961
"""
962
963
def validate(self):
964
"""
965
Validate input set parameters.
966
967
Returns:
968
bool: Whether input set is valid
969
"""
970
971
def get_string(self):
972
"""Get string representation of input set."""
973
974
class VaspInputSet:
975
"""
976
Abstract base class for VASP input sets with standard parameters.
977
978
Parameters:
979
- structure: Structure for calculation
980
- kpoints_density: K-points density per reciprocal atom
981
- user_incar_settings: User INCAR parameter overrides
982
- user_kpoints_settings: User KPOINTS settings
983
- user_potcar_settings: User POTCAR settings
984
- constrain_total_magmom: Whether to constrain total magnetic moment
985
- sort_structure: Whether to sort structure
986
- user_potcar_functional: POTCAR functional to use
987
- force_gamma: Whether to force Gamma-centered k-mesh
988
- reduce_structure: Whether to reduce to primitive structure
989
- vdw: Van der Waals correction method
990
- use_structure_charge: Whether to use structure charge
991
- standardize: Whether to standardize structure
992
- sym_prec: Symmetry precision
993
- international_monoclinic: Whether to use international monoclinic
994
"""
995
def __init__(self, structure, kpoints_density=1000,
996
user_incar_settings=None, user_kpoints_settings=None,
997
user_potcar_settings=None, constrain_total_magmom=False,
998
sort_structure=True, user_potcar_functional=None,
999
force_gamma=False, reduce_structure=None, vdw=None,
1000
use_structure_charge=False, standardize=False,
1001
sym_prec=0.1, international_monoclinic=True): ...
1002
1003
@property
1004
def incar(self):
1005
"""INCAR object for the input set."""
1006
1007
@property
1008
def kpoints(self):
1009
"""KPOINTS object for the input set."""
1010
1011
@property
1012
def poscar(self):
1013
"""POSCAR object for the input set."""
1014
1015
@property
1016
def potcar(self):
1017
"""POTCAR object for the input set."""
1018
1019
def write_input(self, output_dir, make_dir_if_not_present=True,
1020
overwrite=True, zip_output=False): ...
1021
```
1022
1023
### Utility Functions
1024
1025
Helper functions for file I/O operations and format conversion.
1026
1027
```python { .api }
1028
def zopen(filename, mode="rt", *args, **kwargs):
1029
"""
1030
Open files with automatic compression detection.
1031
1032
Parameters:
1033
filename: File path (supports .gz, .bz2, .xz compression)
1034
mode: File open mode
1035
1036
Returns:
1037
file object: Opened file handle
1038
"""
1039
1040
def reverse_readfile(m_file):
1041
"""
1042
Read file in reverse line order.
1043
1044
Parameters:
1045
m_file: File path or file object
1046
1047
Yields:
1048
str: Lines in reverse order
1049
"""
1050
1051
def micro_pyawk(filename, search, results=None, debug=None, postdebug=None):
1052
"""
1053
Micro AWK-like text processing utility.
1054
1055
Parameters:
1056
filename: File to process
1057
search: Search patterns and actions
1058
results: Results storage
1059
debug: Debug function
1060
postdebug: Post-debug function
1061
1062
Returns:
1063
Results from text processing
1064
"""
1065
1066
def clean_json(d, strict=False):
1067
"""
1068
Clean dictionary for JSON serialization.
1069
1070
Parameters:
1071
d: Dictionary to clean
1072
strict: Whether to use strict cleaning
1073
1074
Returns:
1075
dict: JSON-serializable dictionary
1076
"""
1077
```