base
This module defines the base input file classes.
CardOptions
Bases: Enum
Enum type of all supported options for a PWin card.
from_string(s)
classmethod
:param s: String :return: SupportedOptions
Source code in pymatgen/io/espresso/inputs/base.py
35 36 37 38 39 40 41 42 43 44 |
|
BaseInputFile(namelists, cards)
Bases: ABC
, MSONable
Abstract Base class for input files
Source code in pymatgen/io/espresso/inputs/base.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
namelist_classes
abstractmethod
property
All supported namelists as a SupportedInputs enum
card_classes
abstractmethod
property
All supported cards as a SupportedCards enum
from_file(filename)
classmethod
Reads an inputfile from file
PARAMETER | DESCRIPTION |
---|---|
filename
|
path to file
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
BaseInputFile
|
PWin object |
Source code in pymatgen/io/espresso/inputs/base.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
validate()
Very basic validation for the input file. Currently only checks that required namelists and cards are present.
Source code in pymatgen/io/espresso/inputs/base.py
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 |
|
__str__()
Return the input file as a string
Source code in pymatgen/io/espresso/inputs/base.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
to_file(filename, indent=2)
Write the input file to a file.
PARAMETER | DESCRIPTION |
---|---|
filename
|
path to file
TYPE:
|
indent
|
number of spaces to use for indentation
TYPE:
|
Source code in pymatgen/io/espresso/inputs/base.py
207 208 209 210 211 212 213 214 215 216 217 |
|
InputNamelist(*args, **kwargs)
Bases: ABC
, OrderedDict
Abstract Base class for namelists in input files
Source code in pymatgen/io/espresso/inputs/base.py
227 228 |
|
__str__()
Convert namelist to string
Source code in pymatgen/io/espresso/inputs/base.py
230 231 232 233 234 235 236 237 |
|
InputCard(option, body)
Bases: ABC
Abstract Base class for cards in input files
PARAMETER | DESCRIPTION |
---|---|
option
|
The option for the card (e.g., "RELAX")
TYPE:
|
body
|
The body of the card
TYPE:
|
body (list): The body of the card
Source code in pymatgen/io/espresso/inputs/base.py
261 262 263 264 265 266 267 268 269 270 |
|
__str__()
Convert card to string This implementation is for generic (i.e., not fully implemented) cards
Source code in pymatgen/io/espresso/inputs/base.py
297 298 299 300 301 302 |
|
get_body(indent)
Convert card body to string This implementation is for generic (i.e., not fully implemented) cards
Source code in pymatgen/io/espresso/inputs/base.py
305 306 307 308 309 310 311 312 313 |
|
from_string(s)
classmethod
Create card object from string This implementation is for generic (i.e., not fully implemented) cards
Source code in pymatgen/io/espresso/inputs/base.py
319 320 321 322 323 324 325 326 |
|
get_option(option)
classmethod
Initializes a card's options
Source code in pymatgen/io/espresso/inputs/base.py
328 329 330 331 332 333 334 335 336 337 |
|
split_card_string(s)
classmethod
Splits a card into an option and a list of values of the correct type.
:param s: String containing a card (as it would appear in a PWin file)
:return: option: string for the card's option or None
values: list of lists of values for the card
Example:
>>> s = "ATOMIC_SPECIES
H 1.00794 H.UPF O 15.9994 O.UPF" >>> option, values = InputCard.split_card_string_string(s) >>> option, values >>> (None, [["H", 1.00794, "H.UPF"], ["O", 15.9994, "O.UPF"]])
Source code in pymatgen/io/espresso/inputs/base.py
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 |
|
get_header()
Gets a card's header as a string
Source code in pymatgen/io/espresso/inputs/base.py
365 366 367 368 369 370 371 372 |
|
SupportedInputs
Bases: Enum
Enum type of all supported input cards and namelists.
from_string(s)
classmethod
:param s: String :return: InputCard or InputNamelist
Source code in pymatgen/io/espresso/inputs/base.py
378 379 380 381 382 383 384 385 386 387 |
|
EspressoInputWarning
Bases: UserWarning
Warning class for PWin parsing.