pymatgen.io namespace
Subpackages
- pymatgen.io.abinit package
- Submodules
- pymatgen.io.abinit.abiobjects module
AbivarAble
Constraints
Electrons
ElectronsAlgorithm
ExcHamiltonian
HilbertTransform
KSampling
KSamplingModes
ModelDielectricFunction
PPModel
PPModelModes
RelaxationMethod
Screening
SelfEnergy
Smearing
SpinMode
SpinModeTuple
contract()
lattice_from_abivars()
species_by_znucl()
structure_from_abivars()
structure_to_abivars()
- pymatgen.io.abinit.abitimer module
AbinitTimer
AbinitTimer.cpuwall_histogram()
AbinitTimer.get_dataframe()
AbinitTimer.get_section()
AbinitTimer.get_values()
AbinitTimer.names_and_values()
AbinitTimer.ncpus
AbinitTimer.order_sections()
AbinitTimer.pie()
AbinitTimer.scatter_hist()
AbinitTimer.sum_sections()
AbinitTimer.to_csv()
AbinitTimer.to_table()
AbinitTimer.totable()
AbinitTimerParseError
AbinitTimerParser
AbinitTimerParser.BEGIN_TAG
AbinitTimerParser.END_TAG
AbinitTimerParser.Error
AbinitTimerParser.filenames
AbinitTimerParser.get_sections()
AbinitTimerParser.parse()
AbinitTimerParser.pefficiency()
AbinitTimerParser.plot_all()
AbinitTimerParser.plot_efficiency()
AbinitTimerParser.plot_pie()
AbinitTimerParser.plot_stacked_hist()
AbinitTimerParser.section_names()
AbinitTimerParser.summarize()
AbinitTimerParser.timers()
AbinitTimerParser.walk()
AbinitTimerSection
ParallelEfficiency
alternate()
- pymatgen.io.abinit.inputs module
AbstractInput
BasicAbinitInput
BasicAbinitInput.Error
BasicAbinitInput.add_abiobjects()
BasicAbinitInput.as_dict()
BasicAbinitInput.comment
BasicAbinitInput.from_dict()
BasicAbinitInput.isnc
BasicAbinitInput.ispaw
BasicAbinitInput.new_with_vars()
BasicAbinitInput.pop_irdvars()
BasicAbinitInput.pop_tolerances()
BasicAbinitInput.pseudos
BasicAbinitInput.set_comment()
BasicAbinitInput.set_gamma_sampling()
BasicAbinitInput.set_kmesh()
BasicAbinitInput.set_kpath()
BasicAbinitInput.set_spin_mode()
BasicAbinitInput.set_structure()
BasicAbinitInput.structure
BasicAbinitInput.to_str()
BasicAbinitInput.vars
BasicAbinitInputError
BasicMultiDataset
BasicMultiDataset.Error
BasicMultiDataset.addnew_from()
BasicMultiDataset.append()
BasicMultiDataset.deepcopy()
BasicMultiDataset.extend()
BasicMultiDataset.from_inputs()
BasicMultiDataset.has_same_structures
BasicMultiDataset.isnc
BasicMultiDataset.ispaw
BasicMultiDataset.ndtset
BasicMultiDataset.pseudos
BasicMultiDataset.replicate_input()
BasicMultiDataset.split_datasets()
BasicMultiDataset.to_str()
BasicMultiDataset.write()
ShiftMode
as_structure()
calc_shiftk()
ebands_input()
gs_input()
ion_ioncell_relax_input()
num_valence_electrons()
- pymatgen.io.abinit.netcdf module
- pymatgen.io.abinit.pseudos module
AbinitHeader
AbinitPseudo
Hint
NcAbinitHeader
NcAbinitPseudo
NcPseudo
PawAbinitHeader
PawAbinitPseudo
PawPseudo
PawXmlSetup
PawXmlSetup.Z
PawXmlSetup.Z_val
PawXmlSetup.ae_core_density()
PawXmlSetup.ae_partial_waves()
PawXmlSetup.l_local
PawXmlSetup.l_max
PawXmlSetup.paw_radius
PawXmlSetup.plot_densities()
PawXmlSetup.plot_projectors()
PawXmlSetup.plot_waves()
PawXmlSetup.projector_functions()
PawXmlSetup.pseudo_core_density()
PawXmlSetup.pseudo_partial_waves
PawXmlSetup.root()
PawXmlSetup.summary
PawXmlSetup.supports_soc
PawXmlSetup.yield_figs()
Pseudo
Pseudo.Z
Pseudo.Z_val
Pseudo.as_dict()
Pseudo.as_pseudo()
Pseudo.as_tmpfile()
Pseudo.basename
Pseudo.compute_md5()
Pseudo.djrepo_path
Pseudo.element
Pseudo.filepath
Pseudo.from_dict()
Pseudo.from_file()
Pseudo.has_dojo_report
Pseudo.has_hints
Pseudo.hint_for_accuracy()
Pseudo.isnc
Pseudo.ispaw
Pseudo.l_local
Pseudo.l_max
Pseudo.md5()
Pseudo.open_pspsfile()
Pseudo.summary
Pseudo.supports_soc
Pseudo.symbol
Pseudo.to_str()
Pseudo.type
PseudoParseError
PseudoParser
PseudoTable
PseudoTable.all_combinations_for_elements()
PseudoTable.allnc
PseudoTable.allpaw
PseudoTable.as_dict()
PseudoTable.as_table()
PseudoTable.from_dict()
PseudoTable.from_dir()
PseudoTable.get_pseudos_for_structure()
PseudoTable.is_complete()
PseudoTable.print_table()
PseudoTable.pseudo_with_symbol()
PseudoTable.pseudos_with_symbols()
PseudoTable.select()
PseudoTable.select_family()
PseudoTable.select_rows()
PseudoTable.select_symbols()
PseudoTable.sort_by_z()
PseudoTable.sorted()
PseudoTable.to_table()
PseudoTable.with_dojo_report()
PseudoTable.zlist
RadialFunction
l2str()
str2l()
- pymatgen.io.abinit.variable module
- pymatgen.io.aims package
- Subpackages
- pymatgen.io.aims.sets package
- Submodules
- pymatgen.io.aims.sets.base module
AimsInputGenerator
AimsInputGenerator.user_params
AimsInputGenerator.user_kpoints_settings
AimsInputGenerator.use_structure_charge
AimsInputGenerator.d2k()
AimsInputGenerator.d2k_recip_cell()
AimsInputGenerator.get_input_set()
AimsInputGenerator.get_parameter_updates()
AimsInputGenerator.k2d()
AimsInputGenerator.use_structure_charge
AimsInputGenerator.user_kpoints_settings
AimsInputGenerator.user_params
AimsInputSet
recursive_update()
- pymatgen.io.aims.sets.bs module
- pymatgen.io.aims.sets.core module
- pymatgen.io.aims.sets.magnetism module
- pymatgen.io.aims.sets package
- Submodules
- pymatgen.io.aims.inputs module
AimsControlIn
AimsCube
AimsCube.type
AimsCube.origin
AimsCube.edges
AimsCube.points
AimsCube.spin_state
AimsCube.kpoint
AimsCube.filename
AimsCube.format
AimsCube.elf_type
AimsCube.as_dict()
AimsCube.control_block
AimsCube.edges
AimsCube.elf_type
AimsCube.filename
AimsCube.format
AimsCube.from_dict()
AimsCube.kpoint
AimsCube.origin
AimsCube.points
AimsCube.spin_state
AimsCube.type
AimsGeometryIn
AimsSpeciesFile
SpeciesDefaults
- pymatgen.io.aims.outputs module
AimsOutput
AimsOutput.aims_version
AimsOutput.all_forces
AimsOutput.as_dict()
AimsOutput.band_gap
AimsOutput.cbm
AimsOutput.completed
AimsOutput.direct_band_gap
AimsOutput.fermi_energy
AimsOutput.final_energy
AimsOutput.final_structure
AimsOutput.forces
AimsOutput.from_dict()
AimsOutput.from_outfile()
AimsOutput.from_str()
AimsOutput.get_results_for_image()
AimsOutput.initial_structure
AimsOutput.metadata
AimsOutput.n_images
AimsOutput.stress
AimsOutput.stresses
AimsOutput.structure_summary
AimsOutput.structures
AimsOutput.vbm
- pymatgen.io.aims.parsers module
AimsOutCalcChunk
AimsOutCalcChunk.E_f
AimsOutCalcChunk.cbm
AimsOutCalcChunk.converged
AimsOutCalcChunk.coords
AimsOutCalcChunk.dielectric_tensor
AimsOutCalcChunk.dipole
AimsOutCalcChunk.direct_gap
AimsOutCalcChunk.electronic_temperature
AimsOutCalcChunk.energy
AimsOutCalcChunk.forces
AimsOutCalcChunk.free_energy
AimsOutCalcChunk.gap
AimsOutCalcChunk.hirshfeld_atomic_dipoles
AimsOutCalcChunk.hirshfeld_charges
AimsOutCalcChunk.hirshfeld_dipole
AimsOutCalcChunk.hirshfeld_volumes
AimsOutCalcChunk.initial_lattice
AimsOutCalcChunk.initial_structure
AimsOutCalcChunk.is_metallic
AimsOutCalcChunk.k_point_weights
AimsOutCalcChunk.k_points
AimsOutCalcChunk.lattice
AimsOutCalcChunk.magmom
AimsOutCalcChunk.mulliken_charges
AimsOutCalcChunk.mulliken_spins
AimsOutCalcChunk.n_atoms
AimsOutCalcChunk.n_bands
AimsOutCalcChunk.n_electrons
AimsOutCalcChunk.n_iter
AimsOutCalcChunk.n_k_points
AimsOutCalcChunk.n_spins
AimsOutCalcChunk.polarization
AimsOutCalcChunk.results
AimsOutCalcChunk.species
AimsOutCalcChunk.stress
AimsOutCalcChunk.stresses
AimsOutCalcChunk.structure
AimsOutCalcChunk.vbm
AimsOutCalcChunk.velocities
AimsOutChunk
AimsOutHeaderChunk
AimsOutHeaderChunk.aims_uuid
AimsOutHeaderChunk.build_type
AimsOutHeaderChunk.c_compiler
AimsOutHeaderChunk.c_compiler_flags
AimsOutHeaderChunk.commit_hash
AimsOutHeaderChunk.electronic_temperature
AimsOutHeaderChunk.fortran_compiler
AimsOutHeaderChunk.fortran_compiler_flags
AimsOutHeaderChunk.header_summary
AimsOutHeaderChunk.initial_charges
AimsOutHeaderChunk.initial_lattice
AimsOutHeaderChunk.initial_magnetic_moments
AimsOutHeaderChunk.initial_structure
AimsOutHeaderChunk.is_md
AimsOutHeaderChunk.is_relaxation
AimsOutHeaderChunk.k_point_weights
AimsOutHeaderChunk.k_points
AimsOutHeaderChunk.lines
AimsOutHeaderChunk.linked_against
AimsOutHeaderChunk.metadata_summary
AimsOutHeaderChunk.n_atoms
AimsOutHeaderChunk.n_bands
AimsOutHeaderChunk.n_electrons
AimsOutHeaderChunk.n_k_points
AimsOutHeaderChunk.n_spins
AimsOutHeaderChunk.version_number
AimsParseError
ParseError
check_convergence()
get_aims_out_chunks()
get_header_chunk()
get_lines()
read_aims_header_info()
read_aims_header_info_from_content()
read_aims_output()
read_aims_output_from_content()
- Subpackages
- pymatgen.io.cp2k package
- Submodules
- pymatgen.io.cp2k.inputs module
AtomicMetadata
AtomicMetadata.info
AtomicMetadata.element
AtomicMetadata.potential
AtomicMetadata.name
AtomicMetadata.alias_names
AtomicMetadata.filename
AtomicMetadata.version
AtomicMetadata.alias_names
AtomicMetadata.element
AtomicMetadata.filename
AtomicMetadata.get_hash()
AtomicMetadata.get_str()
AtomicMetadata.info
AtomicMetadata.name
AtomicMetadata.potential
AtomicMetadata.softmatch()
AtomicMetadata.version
BandStructure
Band_Structure
BasisFile
BasisInfo
BasisInfo.electrons
BasisInfo.core
BasisInfo.valence
BasisInfo.polarization
BasisInfo.diffuse
BasisInfo.cc
BasisInfo.pc
BasisInfo.sr
BasisInfo.molopt
BasisInfo.admm
BasisInfo.lri
BasisInfo.contracted
BasisInfo.xc
BasisInfo.admm
BasisInfo.cc
BasisInfo.contracted
BasisInfo.core
BasisInfo.diffuse
BasisInfo.electrons
BasisInfo.from_str()
BasisInfo.lri
BasisInfo.molopt
BasisInfo.pc
BasisInfo.polarization
BasisInfo.softmatch()
BasisInfo.sr
BasisInfo.valence
BasisInfo.xc
BrokenSymmetry
Cell
Coord
Cp2kInput
DOS
DataFile
Davidson
Dft
DftPlusU
Diagonalization
EDensityCube
E_Density_Cube
ForceEval
GaussianTypeOrbitalBasisSet
GaussianTypeOrbitalBasisSet.info
GaussianTypeOrbitalBasisSet.nset
GaussianTypeOrbitalBasisSet.n
GaussianTypeOrbitalBasisSet.lmax
GaussianTypeOrbitalBasisSet.lmin
GaussianTypeOrbitalBasisSet.nshell
GaussianTypeOrbitalBasisSet.exponents
GaussianTypeOrbitalBasisSet.coefficients
GaussianTypeOrbitalBasisSet.coefficients
GaussianTypeOrbitalBasisSet.exponents
GaussianTypeOrbitalBasisSet.from_str()
GaussianTypeOrbitalBasisSet.get_keyword()
GaussianTypeOrbitalBasisSet.get_str()
GaussianTypeOrbitalBasisSet.info
GaussianTypeOrbitalBasisSet.lmax
GaussianTypeOrbitalBasisSet.lmin
GaussianTypeOrbitalBasisSet.n
GaussianTypeOrbitalBasisSet.nexp
GaussianTypeOrbitalBasisSet.nset
GaussianTypeOrbitalBasisSet.nshell
Global
GthPotential
GthPotential.info
GthPotential.n_elecs
GthPotential.r_loc
GthPotential.nexp_ppl
GthPotential.c_exp_ppl
GthPotential.radii
GthPotential.nprj
GthPotential.nprj_ppnl
GthPotential.hprj_ppnl
GthPotential.c_exp_ppl
GthPotential.from_section()
GthPotential.from_str()
GthPotential.get_keyword()
GthPotential.get_section()
GthPotential.get_str()
GthPotential.hprj_ppnl
GthPotential.n_elecs
GthPotential.nexp_ppl
GthPotential.nprj
GthPotential.nprj_ppnl
GthPotential.r_loc
GthPotential.radii
Keyword
KeywordList
Kind
KpointSet
Kpoint_Set
Kpoints
LDOS
MOCubes
MO_Cubes
Mgrid
OrbitalTransformation
PBE
PDOS
PotentialFile
PotentialInfo
QS
Scf
Section
SectionList
Smear
Subsys
VHartreeCube
V_Hartree_Cube
XCFunctional
Xc_Functional
- pymatgen.io.cp2k.outputs module
Cp2kOutput
Cp2kOutput.as_dict()
Cp2kOutput.band_structure
Cp2kOutput.calculation_type
Cp2kOutput.charge
Cp2kOutput.complete_dos
Cp2kOutput.completed
Cp2kOutput.convergence()
Cp2kOutput.cp2k_version
Cp2kOutput.is_hubbard
Cp2kOutput.is_metal
Cp2kOutput.is_molecule
Cp2kOutput.multiplicity
Cp2kOutput.num_warnings
Cp2kOutput.parse_atomic_kind_info()
Cp2kOutput.parse_bandstructure()
Cp2kOutput.parse_cell_params()
Cp2kOutput.parse_chi_tensor()
Cp2kOutput.parse_cp2k_params()
Cp2kOutput.parse_dft_params()
Cp2kOutput.parse_dos()
Cp2kOutput.parse_energies()
Cp2kOutput.parse_files()
Cp2kOutput.parse_forces()
Cp2kOutput.parse_global_params()
Cp2kOutput.parse_gtensor()
Cp2kOutput.parse_hirshfeld()
Cp2kOutput.parse_homo_lumo()
Cp2kOutput.parse_hyperfine()
Cp2kOutput.parse_initial_structure()
Cp2kOutput.parse_input()
Cp2kOutput.parse_ionic_steps()
Cp2kOutput.parse_mo_eigenvalues()
Cp2kOutput.parse_mulliken()
Cp2kOutput.parse_nmr_shift()
Cp2kOutput.parse_opt_steps()
Cp2kOutput.parse_overlap_condition()
Cp2kOutput.parse_plus_u_params()
Cp2kOutput.parse_qs_params()
Cp2kOutput.parse_raman()
Cp2kOutput.parse_scf_opt()
Cp2kOutput.parse_scf_params()
Cp2kOutput.parse_stresses()
Cp2kOutput.parse_structures()
Cp2kOutput.parse_tddfpt()
Cp2kOutput.parse_timing()
Cp2kOutput.parse_total_numbers()
Cp2kOutput.project_name
Cp2kOutput.ran_successfully()
Cp2kOutput.read_pattern()
Cp2kOutput.read_table_pattern()
Cp2kOutput.run_type
Cp2kOutput.spin_polarized
parse_dos()
parse_energy_file()
parse_pdos()
- pymatgen.io.cp2k.sets module
CellOptSet
Cp2kValidationError
DftSet
DftSet.activate_epr()
DftSet.activate_fast_minimization()
DftSet.activate_hybrid()
DftSet.activate_hyperfine()
DftSet.activate_localize()
DftSet.activate_motion()
DftSet.activate_nmr()
DftSet.activate_nonperiodic()
DftSet.activate_polar()
DftSet.activate_robust_minimization()
DftSet.activate_spinspin()
DftSet.activate_tddfpt()
DftSet.activate_vdw_potential()
DftSet.activate_very_strict_minimization()
DftSet.create_subsys()
DftSet.get_basis_and_potential()
DftSet.get_cutoff_from_basis()
DftSet.get_xc_functionals()
DftSet.modify_dft_print_iters()
DftSet.print_bandstructure()
DftSet.print_dos()
DftSet.print_e_density()
DftSet.print_forces()
DftSet.print_hirshfeld()
DftSet.print_ldos()
DftSet.print_mo()
DftSet.print_mo_cubes()
DftSet.print_mulliken()
DftSet.print_pdos()
DftSet.print_v_hartree()
DftSet.set_charge()
DftSet.validate()
DftSet.write_basis_set_file()
DftSet.write_potential_file()
HybridCellOptSet
HybridRelaxSet
HybridStaticSet
RelaxSet
StaticSet
- pymatgen.io.cp2k.utils module
- pymatgen.io.exciting package
- pymatgen.io.feff package
- Submodules
- pymatgen.io.feff.inputs module
- pymatgen.io.feff.outputs module
- pymatgen.io.feff.sets module
- pymatgen.io.lammps package
- Submodules
- pymatgen.io.lammps.data module
- pymatgen.io.lammps.generators module
BaseLammpsGenerator
BaseLammpsGenerator.template
BaseLammpsGenerator.calc_type
BaseLammpsGenerator.settings
BaseLammpsGenerator.keep_stages
BaseLammpsGenerator.calc_type
BaseLammpsGenerator.data
BaseLammpsGenerator.get_input_set()
BaseLammpsGenerator.inputfile
BaseLammpsGenerator.keep_stages
BaseLammpsGenerator.settings
BaseLammpsGenerator.template
LammpsMinimization
- pymatgen.io.lammps.inputs module
LammpsInputFile
LammpsInputFile.add_commands()
LammpsInputFile.add_stage()
LammpsInputFile.append()
LammpsInputFile.contains_command()
LammpsInputFile.from_file()
LammpsInputFile.from_str()
LammpsInputFile.get_args()
LammpsInputFile.get_str()
LammpsInputFile.merge_stages()
LammpsInputFile.ncomments
LammpsInputFile.nstages
LammpsInputFile.remove_command()
LammpsInputFile.remove_stage()
LammpsInputFile.rename_stage()
LammpsInputFile.set_args()
LammpsInputFile.stages_names
LammpsInputFile.write_file()
LammpsRun
LammpsTemplateGen
write_lammps_inputs()
- pymatgen.io.lammps.outputs module
- pymatgen.io.lammps.sets module
- pymatgen.io.lammps.utils module
- pymatgen.io.lobster package
- Submodules
- pymatgen.io.lobster.inputs module
Lobsterin
Lobsterin.AVAILABLE_KEYWORDS
Lobsterin.BOOLEAN_KEYWORDS
Lobsterin.FLOAT_KEYWORDS
Lobsterin.LIST_KEYWORDS
Lobsterin.STRING_KEYWORDS
Lobsterin.as_dict()
Lobsterin.diff()
Lobsterin.from_dict()
Lobsterin.from_file()
Lobsterin.get_all_possible_basis_functions()
Lobsterin.get_basis()
Lobsterin.standard_calculations_from_vasp_files()
Lobsterin.write_INCAR()
Lobsterin.write_KPOINTS()
Lobsterin.write_POSCAR_with_standard_primitive()
Lobsterin.write_lobsterin()
get_all_possible_basis_combinations()
- pymatgen.io.lobster.lobsterenv module
ICOHPNeighborsInfo
LobsterLightStructureEnvironments
LobsterNeighbors
LobsterNeighbors.anion_types
LobsterNeighbors.get_anion_types()
LobsterNeighbors.get_info_cohps_to_neighbors()
LobsterNeighbors.get_info_icohps_between_neighbors()
LobsterNeighbors.get_info_icohps_to_neighbors()
LobsterNeighbors.get_light_structure_environment()
LobsterNeighbors.get_nn_info()
LobsterNeighbors.molecules_allowed
LobsterNeighbors.plot_cohps_of_neighbors()
LobsterNeighbors.structures_allowed
- pymatgen.io.lobster.outputs module
Bandoverlaps
Bwdf
Charge
Cohpcar
Doscar
Fatband
Grosspop
Icohplist
LobsterMatrices
Lobsterout
Lobsterout.basis_functions
Lobsterout.basis_type
Lobsterout.charge_spilling
Lobsterout.dft_program
Lobsterout.elements
Lobsterout.has_charge
Lobsterout.has_cohpcar
Lobsterout.has_madelung
Lobsterout.has_coopcar
Lobsterout.has_cobicar
Lobsterout.has_doscar
Lobsterout.has_doscar_lso
Lobsterout.has_projection
Lobsterout.has_bandoverlaps
Lobsterout.has_density_of_energies
Lobsterout.has_fatbands
Lobsterout.has_grosspopulation
Lobsterout.has_polarization
Lobsterout.info_lines
Lobsterout.info_orthonormalization
Lobsterout.is_restart_from_projection
Lobsterout.lobster_version
Lobsterout.number_of_spins
Lobsterout.number_of_threads
Lobsterout.timing
Lobsterout.total_spilling
Lobsterout.warning_lines
Lobsterout.as_dict()
Lobsterout.get_doc()
MadelungEnergies
NciCobiList
Polarization
SitePotential
SitePotential.atomlist
SitePotential.types
SitePotential.num_atoms
SitePotential.sitepotentials_mulliken
SitePotential.sitepotentials_loewdin
SitePotential.madelungenergies_mulliken
SitePotential.madelungenergies_loewdin
SitePotential.ewald_splitting
SitePotential.get_structure_with_site_potentials()
SitePotential.madelungenergies_Loewdin
SitePotential.madelungenergies_Mulliken
SitePotential.sitepotentials_Loewdin
SitePotential.sitepotentials_Mulliken
Wavefunction
get_orb_from_str()
- pymatgen.io.pwmat package
- pymatgen.io.qchem package
- Submodules
- pymatgen.io.qchem.inputs module
QCInput
QCInput.almo_template()
QCInput.cdft_template()
QCInput.find_sections()
QCInput.from_file()
QCInput.from_multi_jobs_file()
QCInput.from_str()
QCInput.geom_opt_template()
QCInput.get_str()
QCInput.molecule_template()
QCInput.multi_job_string()
QCInput.nbo_template()
QCInput.opt_template()
QCInput.pcm_nonels_template()
QCInput.pcm_template()
QCInput.plots_template()
QCInput.read_almo()
QCInput.read_cdft()
QCInput.read_geom_opt()
QCInput.read_molecule()
QCInput.read_nbo()
QCInput.read_opt()
QCInput.read_pcm()
QCInput.read_pcm_nonels()
QCInput.read_plots()
QCInput.read_rem()
QCInput.read_scan()
QCInput.read_smx()
QCInput.read_solvent()
QCInput.read_svp()
QCInput.read_vdw()
QCInput.rem_template()
QCInput.scan_template()
QCInput.smx_template()
QCInput.solvent_template()
QCInput.svp_template()
QCInput.van_der_waals_template()
QCInput.write_multi_job_file()
- pymatgen.io.qchem.outputs module
- pymatgen.io.qchem.sets module
- pymatgen.io.qchem.utils module
- pymatgen.io.vasp package
- Submodules
- pymatgen.io.vasp.help module
- pymatgen.io.vasp.inputs module
BadIncarWarning
BadPoscarWarning
Incar
Kpoints
Kpoints.as_dict()
Kpoints.automatic()
Kpoints.automatic_density()
Kpoints.automatic_density_by_lengths()
Kpoints.automatic_density_by_vol()
Kpoints.automatic_gamma_density()
Kpoints.automatic_linemode()
Kpoints.copy()
Kpoints.from_dict()
Kpoints.from_file()
Kpoints.from_str()
Kpoints.gamma_automatic()
Kpoints.kpts
Kpoints.monkhorst_automatic()
Kpoints.style
Kpoints.supported_modes
Kpoints.write_file()
KpointsSupportedModes
Orbital
OrbitalDescription
PmgVaspPspDirError
Poscar
Poscar.structure
Poscar.comment
Poscar.true_names
Poscar.selective_dynamics
Poscar.velocities
Poscar.predictor_corrector
Poscar.predictor_corrector_preamble
Poscar.lattice_velocities
Poscar.temperature
Poscar.as_dict()
Poscar.from_dict()
Poscar.from_file()
Poscar.from_str()
Poscar.get_str()
Poscar.get_string()
Poscar.lattice_velocities
Poscar.natoms
Poscar.predictor_corrector
Poscar.predictor_corrector_preamble
Poscar.selective_dynamics
Poscar.set_temperature()
Poscar.site_symbols
Poscar.velocities
Poscar.write_file()
Potcar
PotcarSingle
PotcarSingle.data
PotcarSingle.keywords
PotcarSingle.atomic_no
PotcarSingle.copy()
PotcarSingle.electron_configuration
PotcarSingle.element
PotcarSingle.from_file()
PotcarSingle.from_symbol_and_functional()
PotcarSingle.functional
PotcarSingle.functional_class
PotcarSingle.functional_dir
PotcarSingle.functional_tags
PotcarSingle.hash_sha256_from_file
PotcarSingle.identify_potcar()
PotcarSingle.identify_potcar_hash_based()
PotcarSingle.is_valid
PotcarSingle.md5_computed_file_hash
PotcarSingle.md5_header_hash
PotcarSingle.nelectrons
PotcarSingle.parse_functions
PotcarSingle.potential_type
PotcarSingle.sha256_computed_file_hash
PotcarSingle.symbol
PotcarSingle.verify_potcar()
PotcarSingle.write_file()
UnknownPotcarWarning
VaspInput
- pymatgen.io.vasp.optics module
DielectricFunctionCalculator
DielectricFunctionCalculator.cder
DielectricFunctionCalculator.cder_imag
DielectricFunctionCalculator.cder_real
DielectricFunctionCalculator.cshift
DielectricFunctionCalculator.deltae
DielectricFunctionCalculator.efermi
DielectricFunctionCalculator.eigs
DielectricFunctionCalculator.from_directory()
DielectricFunctionCalculator.from_vasp_objects()
DielectricFunctionCalculator.get_epsilon()
DielectricFunctionCalculator.ismear
DielectricFunctionCalculator.ispin
DielectricFunctionCalculator.kweights
DielectricFunctionCalculator.nedos
DielectricFunctionCalculator.plot_weighted_transition_data()
DielectricFunctionCalculator.sigma
DielectricFunctionCalculator.volume
delta_func()
delta_methfessel_paxton()
epsilon_imag()
get_delta()
get_step()
kramers_kronig()
step_func()
step_methfessel_paxton()
- pymatgen.io.vasp.outputs module
BSVasprun
Chgcar
Dynmat
Eigenval
Elfcar
KpointOptProps
KpointOptProps.actual_kpoints
KpointOptProps.actual_kpoints_weights
KpointOptProps.dos_has_errors
KpointOptProps.efermi
KpointOptProps.eigenvalues
KpointOptProps.idos
KpointOptProps.kpoints
KpointOptProps.pdos
KpointOptProps.projected_eigenvalues
KpointOptProps.projected_magnetisation
KpointOptProps.tdos
Locpot
Oszicar
Outcar
Outcar.magnetization
Outcar.chemical_shielding
Outcar.unsym_cs_tensor
Outcar.cs_g0_contribution
Outcar.cs_core_contribution
Outcar.efg
Outcar.charge
Outcar.is_stopped
Outcar.run_stats
Outcar.elastic_tensor
Outcar.drift
Outcar.ngf
Outcar.sampling_radii
Outcar.electrostatic_potential
Outcar.final_energy_contribs
Outcar.efermi
Outcar.filename
Outcar.final_energy
Outcar.final_energy_wo_entrp
Outcar.final_fr_energy
Outcar.has_onsite_density_matrices
Outcar.lcalcpol
Outcar.lepsilon
Outcar.nelect
Outcar.spin
Outcar.total_mag
Outcar.as_dict()
Outcar.read_avg_core_poten()
Outcar.read_chemical_shielding()
Outcar.read_core_state_eigen()
Outcar.read_corrections()
Outcar.read_cs_core_contribution()
Outcar.read_cs_g0_contribution()
Outcar.read_cs_raw_symmetrized_tensors()
Outcar.read_elastic_tensor()
Outcar.read_electrostatic_potential()
Outcar.read_fermi_contact_shift()
Outcar.read_freq_dielectric()
Outcar.read_igpar()
Outcar.read_internal_strain_tensor()
Outcar.read_lcalcpol()
Outcar.read_lepsilon()
Outcar.read_lepsilon_ionic()
Outcar.read_neb()
Outcar.read_nmr_efg()
Outcar.read_nmr_efg_tensor()
Outcar.read_onsite_density_matrices()
Outcar.read_pattern()
Outcar.read_piezo_tensor()
Outcar.read_pseudo_zval()
Outcar.read_table_pattern()
Procar
UnconvergedVASPWarning
VaspParseError
Vasprun
Vasprun.ionic_steps
Vasprun.tdos
Vasprun.idos
Vasprun.pdos
Vasprun.efermi
Vasprun.eigenvalues
Vasprun.projected_eigenvalues
Vasprun.projected_magnetisation
Vasprun.dielectric_data
Vasprun.nionic_steps
Vasprun.force_constants
Vasprun.normalmode_eigenvals
Vasprun.normalmode_eigenvecs
Vasprun.md_data
Vasprun.incar
Vasprun.parameters
Vasprun.kpoints
Vasprun.actual_kpoints
Vasprun.actual_kpoints_weights
Vasprun.atomic_symbols
Vasprun.potcar_symbols
Vasprun.kpoints_opt_props
Vasprun.as_dict()
Vasprun.calculate_efermi()
Vasprun.complete_dos
Vasprun.complete_dos_normalized
Vasprun.converged
Vasprun.converged_electronic
Vasprun.converged_ionic
Vasprun.dielectric
Vasprun.eigenvalue_band_properties
Vasprun.epsilon_ionic
Vasprun.epsilonassets
Vasprun.epsilonassets_wolfe
Vasprun.final_energy
Vasprun.get_band_structure()
Vasprun.get_computed_entry()
Vasprun.get_potcars()
Vasprun.get_trajectory()
Vasprun.hubbards
Vasprun.is_hubbard
Vasprun.is_spin
Vasprun.md_n_steps
Vasprun.optical_absorption_coeff
Vasprun.run_type
Vasprun.structures
Vasprun.update_charge_from_potcar()
Vasprun.update_potcar_spec()
VolumetricData
WSWQ
Wavecar
Waveder
Xdatcar
get_adjusted_fermi_level()
get_band_structure_from_vasp_multiple_branches()
- pymatgen.io.vasp.sets module
BadInputSetWarning
DictSet
LobsterSet
MITMDSet
MITNEBSet
MITRelaxSet
MPAbsorptionSet
MPAbsorptionSet.CONFIG
MPAbsorptionSet.SUPPORTED_MODES
MPAbsorptionSet.copy_wavecar
MPAbsorptionSet.force_gamma
MPAbsorptionSet.incar_updates
MPAbsorptionSet.inherit_incar
MPAbsorptionSet.kpoints_updates
MPAbsorptionSet.mode
MPAbsorptionSet.nbands
MPAbsorptionSet.nbands_factor
MPAbsorptionSet.nedos
MPAbsorptionSet.nkred
MPAbsorptionSet.reciprocal_density
MPHSEBSSet
MPHSERelaxSet
MPMDSet
MPMetalRelaxSet
MPNMRSet
MPNonSCFSet
MPNonSCFSet.CONFIG
MPNonSCFSet.copy_chgcar
MPNonSCFSet.dedos
MPNonSCFSet.incar_updates
MPNonSCFSet.inherit_incar
MPNonSCFSet.kpoints_line_density
MPNonSCFSet.kpoints_updates
MPNonSCFSet.mode
MPNonSCFSet.nbands_factor
MPNonSCFSet.nedos
MPNonSCFSet.optics
MPNonSCFSet.reciprocal_density
MPNonSCFSet.small_gap_multiply
MPRelaxSet
MPSOCSet
MPScanRelaxSet
MPScanStaticSet
MPStaticSet
MVLElasticSet
MVLGBSet
MVLGWSet
MVLNPTMDSet
MVLRelax52Set
MVLScanRelaxSet
MVLSlabSet
MatPESStaticSet
VaspInputGenerator
VaspInputSet
VaspInputSet.as_dict()
VaspInputSet.auto_ismear
VaspInputSet.auto_ispin
VaspInputSet.auto_kspacing
VaspInputSet.auto_lreal
VaspInputSet.auto_metal_kpoints
VaspInputSet.bandgap
VaspInputSet.bandgap_tol
VaspInputSet.calculate_ng()
VaspInputSet.config_dict
VaspInputSet.constrain_total_magmom
VaspInputSet.estimate_nbands()
VaspInputSet.files_to_transfer
VaspInputSet.force_gamma
VaspInputSet.from_directory()
VaspInputSet.from_prev_calc()
VaspInputSet.get_input_set()
VaspInputSet.get_vasp_input()
VaspInputSet.incar
VaspInputSet.incar_updates
VaspInputSet.inherit_incar
VaspInputSet.international_monoclinic
VaspInputSet.kpoints
VaspInputSet.kpoints_updates
VaspInputSet.nelect
VaspInputSet.override_from_prev_calc()
VaspInputSet.poscar
VaspInputSet.potcar
VaspInputSet.potcar_functional
VaspInputSet.potcar_symbols
VaspInputSet.prev_incar
VaspInputSet.prev_kpoints
VaspInputSet.reduce_structure
VaspInputSet.sort_structure
VaspInputSet.standardize
VaspInputSet.structure
VaspInputSet.sym_prec
VaspInputSet.use_structure_charge
VaspInputSet.user_incar_settings
VaspInputSet.user_kpoints_settings
VaspInputSet.user_potcar_functional
VaspInputSet.user_potcar_settings
VaspInputSet.validate_magmom
VaspInputSet.vdw
VaspInputSet.write_input()
auto_kspacing()
batch_write_input()
get_structure_from_prev_run()
get_valid_magmom_struct()
get_vasprun_outcar()
next_num_with_prime_factors()
primes_less_than()
standardize_structure()
- pymatgen.io.xtb package
Submodules
pymatgen.io.adf module
IO for ADF files.
- class AdfInput(task)[source]
Bases:
object
A basic ADF input file writer.
Initialization method.
- Parameters:
task (AdfTask) – An ADF task.
- class AdfKey(name, options=None, subkeys=None)[source]
Bases:
MSONable
The basic input unit for ADF. A key is a string of characters that does not contain a delimiter (blank, comma or equal sign). A key may have multiple subkeys and a set of options.
Initialization method.
- Parameters:
name (str) – The name of this key.
options – Sized The options for this key. Each element can be a primitive object or a tuple/list with two elements: the first is the name and the second is a primitive object.
subkeys (Sized) – The subkeys for this key.
- Raises:
ValueError – If elements in
subkeys
are notAdfKey
objects.
- add_option(option)[source]
Add a new option to this key.
- Parameters:
option – Sized or str or int or float A new option to add. This must have the same format with existing options.
- Raises:
TypeError – If the format of the given
option
is different.
- add_subkey(subkey)[source]
Add a new subkey to this key.
- Parameters:
subkey (AdfKey) – A new subkey.
Notes
Duplicate check will not be performed if this is an ‘Atoms’ block.
- block_keys = ('SCF', 'GEOMETRY', 'XC', 'UNITS', 'ATOMS', 'CHARGE', 'BASIS', 'SYMMETRY', 'RELATIVISTIC', 'OCCUPATIONS', 'SAVE', 'A1FIT', 'INTEGRATION', 'UNRESTRICTED', 'ZLMFIT', 'TITLE', 'EXACTDENSITY', 'TOTALENERGY', 'ANALYTICALFREQ')[source]
- classmethod from_dict(dct: dict) Self [source]
Construct a MSONable AdfKey object from the JSON dict.
- Parameters:
dct (dict) – A dict of saved attributes.
- Returns:
An AdfKey object recovered from the JSON dict.
- Return type:
- classmethod from_str(string: str) Self [source]
Construct an AdfKey object from the string.
- Parameters:
string – str
- Returns:
An AdfKey object recovered from the string.
- Raises:
ValueError – Currently nested subkeys are not supported. If
subend
was found a ValueError would be raised.
Notes
Only the first block key will be returned.
- has_option(option: str) bool [source]
- Parameters:
option (str) – The option.
- Returns:
True if this AdfKey has the given option.
- Return type:
bool
- has_subkey(subkey: str | AdfKey) bool [source]
- Parameters:
subkey (str | AdfKey) – A key name or AdfKey object.
- Returns:
True if this key contains the given subkey.
- Return type:
bool
- property key: str[source]
The name of this key. If this is a block key, the name will be converted to upper cases.
- remove_option(option: str | int) None [source]
Remove an option.
- Parameters:
option (str | int) – The name or index of the option to remove.
- Raises:
TypeError – If the option has a wrong type.
- class AdfOutput(filename)[source]
Bases:
object
A basic ADF output file parser.
- is_internal_crash[source]
Whether the job crashed. Please read ‘TAPE13’ of the ADF manual for more detail.
- Type:
bool
- run_type[source]
The RunType of this ADF job. Possible options are: ‘SinglePoint’, ‘GeometryOptimization’, ‘AnalyticalFreq’ and ‘NUmericalFreq’.
- Type:
str
Initialization method.
- Parameters:
filename (str) – The ADF output file to parse.
- exception AdfOutputError[source]
Bases:
Exception
The default error class for errors raised by
AdfOutput
.
- class AdfTask(operation='energy', basis_set=None, xc=None, title='ADF_RUN', units=None, geo_subkeys=None, scf=None, other_directives=None)[source]
Bases:
MSONable
Basic task for ADF. All settings in this class are independent of molecules.
Notes
Unlike other quantum chemistry packages (NWChem, Gaussian, …), ADF does not support calculating force/gradient.
Initialization method.
- Parameters:
operation (str) – The target operation.
basis_set (AdfKey) – The basis set definitions for this task. Defaults to ‘DZ/Large’.
xc (AdfKey) – The exchange-correlation functionals. Defaults to PBE.
title (str) – The title of this ADF task.
units (AdfKey) – The units. Defaults to Angstroms/Degree.
geo_subkeys (Sized) – The subkeys for the block key ‘GEOMETRY’.
scf (AdfKey) – The scf options.
other_directives (Sized) – User-defined directives.
- classmethod from_dict(dct: dict) Self [source]
Construct a MSONable AdfTask object from the JSON dict.
- Parameters:
dct – A dict of saved attributes.
- Returns:
An AdfTask object recovered from the JSON dict
d
.
- operations: ClassVar[dict[str, str]] = {'energy': 'Evaluate the single point energy.', 'freq': 'Same as frequencies.', 'frequencies': 'Compute second derivatives and print out an analysis of molecular vibrations.', 'numerical_frequencies': 'Compute molecular frequencies using numerical method.', 'optimize': 'Minimize the energy by varying the molecular structure.'}[source]
pymatgen.io.ase module
This module provides conversion between the Atomic Simulation Environment Atoms object and pymatgen Structure objects.
- class AseAtomsAdaptor[source]
Bases:
object
Adaptor serves as a bridge between ASE Atoms and pymatgen objects.
- static get_atoms(structure: SiteCollection, msonable: bool = True, **kwargs) MSONAtoms | Atoms [source]
Get ASE Atoms object from pymatgen structure or molecule.
- Parameters:
structure (SiteCollection) – pymatgen Structure or Molecule
msonable (bool) – Whether to return an MSONAtoms object, which is MSONable.
**kwargs – passed to the ASE Atoms constructor
- Returns:
ASE Atoms object
- Return type:
- static get_molecule(atoms: ~ase.atoms.Atoms, cls: type[~pymatgen.core.structure.Molecule] = <class 'pymatgen.core.structure.Molecule'>, **cls_kwargs) Molecule [source]
Get pymatgen molecule from ASE Atoms.
- Parameters:
atoms – ASE Atoms object
cls – The Molecule class to instantiate (defaults to pymatgen molecule)
**cls_kwargs – Any additional kwargs to pass to the cls
- Returns:
Equivalent pymatgen.core.structure.Molecule
- Return type:
- static get_structure(atoms: ~ase.atoms.Atoms, cls: type[~pymatgen.core.structure.Structure] = <class 'pymatgen.core.structure.Structure'>, **cls_kwargs) Structure [source]
Get pymatgen structure from ASE Atoms.
- Parameters:
atoms – ASE Atoms object
cls – The Structure class to instantiate (defaults to pymatgen Structure)
**cls_kwargs – Any additional kwargs to pass to the cls
- Returns:
Equivalent pymatgen Structure
- Return type:
- class MSONAtoms(symbols=None, positions=None, numbers=None, tags=None, momenta=None, masses=None, magmoms=None, charges=None, scaled_positions=None, cell=None, pbc=None, celldisp=None, constraint=None, calculator=None, info=None, velocities=None)[source]
Bases:
Atoms
,MSONable
A custom subclass of ASE Atoms that is MSONable, including .as_dict() and .from_dict() methods.
pymatgen.io.atat module
Classes for reading/writing mcsqs files following the rndstr.in format.
- class Mcsqs(structure: Structure)[source]
Bases:
object
Handle input/output for the crystal definition format used by mcsqs and other ATAT codes.
- Parameters:
Structure – input Structure.
pymatgen.io.babel module
OpenBabel interface module, which opens up access to the hundreds of file formats supported by OpenBabel. Requires openbabel with python bindings to be installed. Please consult the openbabel docs https://openbabel.org.
- class BabelMolAdaptor(mol: Molecule | OBMol | Molecule)[source]
Bases:
object
Adaptor serves as a bridge between OpenBabel’s Molecule and pymatgen’s Molecule.
Initialize with pymatgen Molecule or OpenBabel’s OBMol.
- Parameters:
mol – pymatgen’s Molecule/IMolecule or OpenBabel OBMol
- confab_conformers(forcefield: str = 'mmff94', freeze_atoms: list[int] | None = None, rmsd_cutoff: float = 0.5, energy_cutoff: float = 50.0, conf_cutoff: int = 100000, verbose: bool = False) list[Molecule] [source]
Conformer generation based on Confab to generate all diverse low-energy conformers for molecules. This is different from rotor_conformer or gen3d_conformer as it aims to not simply to find a low energy conformation but to generate several different conformations.
- Parameters:
forcefield (str) – Default is mmff94. Options are ‘gaff’, ‘ghemical’, ‘mmff94’, ‘mmff94s’, and ‘uff’.
freeze_atoms ([int]) – index of atoms to be freezed when performing conformer search, default is None.
rmsd_cutoff (float) – rmsd_cufoff, default is 0.5 Angstrom.
energy_cutoff (float) – energy_cutoff, default is 50.0 kcal/mol.
conf_cutoff (int) – max number of conformers to test, default is 1 million.
verbose (bool) – whether to display information on torsions found, default is False.
- Returns:
Molecule objects for generated conformers.
- Return type:
list[Molecule]
- classmethod from_file(filename: str, file_format: str = 'xyz', return_all_molecules: bool = False) Self | list[Self] [source]
Uses OpenBabel to read a molecule from a file in all supported formats.
- Parameters:
filename – Filename of input file
file_format – String specifying any OpenBabel supported formats.
return_all_molecules – If
True
, will return a list ofBabelMolAdaptor
instances, one for each molecule found in the file. IfFalse
, will return only the first molecule.
- Returns:
BabelMolAdaptor object or list thereof
- classmethod from_molecule_graph(mol: MoleculeGraph) Self [source]
Read a molecule from a pymatgen MoleculeGraph object.
- Parameters:
mol – pymatgen MoleculeGraph object.
- Returns:
BabelMolAdaptor object
- classmethod from_str(string_data: str, file_format: str = 'xyz') Self [source]
Uses OpenBabel to read a molecule from a string in all supported formats.
- Parameters:
string_data – String containing molecule data.
file_format – String specifying any OpenBabel supported formats.
- Returns:
BabelMolAdaptor object
- gen3d_conformer() None [source]
A combined method to first generate 3D structures from 0D or 2D structures and then find the minimum energy conformer:
Use OBBuilder to create a 3D structure using rules and ring templates
Do 250 steps of a steepest descent geometry optimization with the MMFF94 forcefield
Do 200 iterations of a Weighted Rotor conformational search (optimizing each conformer with 25 steps of a steepest descent)
Do 250 steps of a conjugate gradient geometry optimization.
Warning from openbabel docs: For many applications where 100s if not 1000s of molecules need to be processed, gen3d is rather SLOW. Sometimes this function can cause a segmentation fault. A future version of Open Babel will provide options for slow/medium/fast 3D structure generation which will involve different compromises between speed and finding the global energy minimum.
- localopt(forcefield: str = 'mmff94', steps: int = 500) None [source]
A wrapper to pybel’s localopt method to optimize a Molecule.
- Parameters:
forcefield – Default is mmff94. Options are ‘gaff’, ‘ghemical’, ‘mmff94’, ‘mmff94s’, and ‘uff’.
steps – Default is 500.
- make3d(forcefield: str = 'mmff94', steps: int = 50) None [source]
A wrapper to pybel’s make3D method generate a 3D structure from a 2D or 0D structure. The 3D structure is made very quickly using a combination of rules (e.g. sp3 atoms should have four bonds arranged in a tetrahedron) and ring templates (e.g. cyclohexane is shaped like a chair). Once 3D coordinates are generated, hydrogens are added and a quick local optimization is carried out as default.
The generated 3D structure can have clashes or have high energy structures due to some strain. Please consider to use the conformer search or geometry optimization to further optimize the structure.
- Parameters:
forcefield – Default is mmff94. Options are ‘gaff’, ‘ghemical’, ‘mmff94’, ‘mmff94s’, and ‘uff’.
steps – Default is 50.
- remove_bond(idx1: int, idx2: int) None [source]
Remove a bond from an openbabel molecule.
- Parameters:
idx1 – The atom index of one of the atoms participating the in bond
idx2 – The atom index of the other atom participating in the bond
- rotor_conformer(*rotor_args, algo: str = 'WeightedRotorSearch', forcefield: str = 'mmff94') None [source]
Conformer search based on several Rotor Search algorithms of openbabel. If the input molecule is not 3D, make3d will be called (generate 3D structure, add hydrogen, a quick localopt). All hydrogen atoms need to be made explicit.
- Parameters:
rotor_args – pass args to Rotor Search in openbabel. for “WeightedRotorSearch”: (conformers, geomSteps, sampleRingBonds-default False) for “SystematicRotorSearch”: (geomSteps-default 2500, sampleRingBonds-default False) for “RandomRotorSearch”: (conformers, geomSteps-default 2500, sampleRingBonds-default False)
algo (str) – Default is “WeightedRotorSearch”. Options are “SystematicRotorSearch”, “RandomRotorSearch”, and “WeightedRotorSearch”.
forcefield (str) – Default is mmff94. Options are ‘gaff’, ‘ghemical’, ‘mmff94’, ‘mmff94s’, and ‘uff’.
pymatgen.io.cif module
Classes for Cif input and output from Structures.
- class CifBlock(data: dict, loops: list[list[str]], header: str)[source]
Bases:
object
Object for storing CIF data. All data is stored in a single dictionary. Data inside loops are stored in lists in the data dictionary, and information on which keys are grouped together are stored in the loops attribute.
- Parameters:
data – dict of data to go into the CIF. Values should be convertible to string, or lists of these if the key is in a loop
loops – list of lists of keys, grouped by which loop they should appear in
header – name of the block (appears after the data_ on the first line).
- class CifFile(data: dict[str, CifBlock], orig_string: str | None = None, comment: str | None = None)[source]
Bases:
object
Read and parse CifBlocks from a .cif file or string.
- Parameters:
data (dict) – Of CifBlock objects.
orig_string (str) – The original CIF.
comment (str) – Comment.
- class CifParser(filename: PathLike | StringIO, occupancy_tolerance: float = 1.0, site_tolerance: float = 0.0001, frac_tolerance: float = 0.0001, check_cif: bool = True, comp_tol: float = 0.01)[source]
Bases:
object
CIF file parser. Attempt to fix CIFs that are out-of-spec, but will issue warnings if corrections applied. These are also stored in the CifParser’s warnings attribute. CIF file parser. Attempt to fix CIFs that are out-of-spec, but will issue warnings if corrections applied. These are also stored in the CifParser’s errors attribute.
- Parameters:
filename (PathLike) – CIF file, gzipped or bzipped CIF files are fine too.
occupancy_tolerance (float) – If total occupancy of a site is between 1 and occupancy_tolerance, it will be scaled down to 1.
site_tolerance (float) – This tolerance is used to determine if two sites are at the same position, in which case they will be combined to a single disordered site. Defaults to 1e-4.
frac_tolerance (float) – This tolerance is used to determine is a coordinate should be rounded to an ideal value. e.g. 0.6667 is rounded to 2/3. This is desired if symmetry operations are going to be applied. However, for very large CIF files, this may need to be set to 0.
check_cif (bool) – Whether to check that stoichiometry reported in CIF matches that of resulting Structure, and whether elements are missing. Defaults to True.
comp_tol (float) – Tolerance for how closely stoichiometries of CIF file and pymatgen should match. Defaults to 0.01. Context: Experimental CIF files often don’t report hydrogens positions due to being hard-to-locate with X-rays. pymatgen warns if the stoichiometry of the CIF file and the Structure don’t match to within comp_tol.
- check(structure: Structure) str | None [source]
Check whether a Structure created from CIF passes sanity checks.
- Checks:
Composition from CIF is valid
CIF composition contains only valid elements
- CIF and structure contain the same elements (often hydrogens
are omitted from CIFs, as their positions cannot be determined from X-ray diffraction, needs more difficult neutron diffraction)
- CIF and structure have same relative stoichiometry. Thus
if CIF reports stoichiometry LiFeO, and the structure has composition (LiFeO)4, this check passes.
- Parameters:
structure (Structure) – Structure created from CIF.
- Returns:
- If any check fails, return a human-readable str for the
reason (e.g., which elements are missing). None if all checks pass.
- Return type:
str | None
- classmethod from_str(cif_string: str, **kwargs) Self [source]
Create a CifParser from a string.
- Parameters:
cif_string (str) – String representation of a CIF.
- Returns:
CifParser
- get_bibtex_string() str [source]
Get BibTeX reference from CIF file.
- Parameters:
data
- Returns:
BibTeX string.
- get_lattice(data: CifBlock, length_strings=('a', 'b', 'c'), angle_strings=('alpha', 'beta', 'gamma'), lattice_type=None) Lattice | None [source]
Generate the lattice from the provided lattice parameters. In the absence of all six lattice parameters, the crystal system and necessary parameters are parsed.
- static get_lattice_no_exception(data: CifBlock, length_strings: tuple[str, str, str] = ('a', 'b', 'c'), angle_strings: tuple[str, str, str] = ('alpha', 'beta', 'gamma'), lattice_type: str | None = None) Lattice [source]
Convert a CifBlock to a pymatgen Lattice.
- Parameters:
data – a dictionary of the CIF file
length_strings – The strings that are used to identify the length parameters in the CIF file.
angle_strings – The strings that are used to identify the angles in the CIF file.
lattice_type (str) – The type of lattice.
- Returns:
Lattice object
- get_magsymops(data: CifBlock) list[MagSymmOp] [source]
Equivalent to get_symops except for magnetic symmetry groups. Separate function since additional operation for time reversal symmetry (which changes magnetic moments on sites) needs to be returned.
- get_structures(*args, **kwargs) list[Structure] [source]
Deprecated, use parse_structures instead. Only difference between these two methods is the default primitive=False in parse_structures. So parse_structures(primitive=True) is equivalent to the default behaviour of get_structures().
- get_symops(data: CifBlock) list[SymmOp] [source]
Get the symmetry operations, in order to generate symmetry equivalent positions. If no symops are present, the space group symbol is parsed, and symops are generated.
- parse_structures(primitive: bool | None = None, symmetrized: bool = False, check_occu: bool = True, on_error: Literal['ignore', 'warn', 'raise'] = 'warn') list[Structure] [source]
Return list of structures in CIF file.
- Parameters:
primitive (bool) – Whether to return primitive unit cells. Defaults to False. With magnetic CIF files, will return primitive magnetic cell which may be larger than nuclear primitive cell.
symmetrized (bool) – Whether to return a SymmetrizedStructure which will include the equivalent indices and symmetry operations used to create the Structure as provided by the CIF (if explicit symmetry operations are included in the CIF) or generated from information in the CIF (if only space group labels are provided). Note that currently Wyckoff labels and space group labels or numbers are not included in the generated SymmetrizedStructure, these will be notated as “Not Parsed” or -1 respectively.
check_occu (bool) – Whether to check site for unphysical occupancy > 1. Useful for experimental results in which occupancy was allowed to refine to unphysical values. Warning: unphysical occupancies are incompatible with many pymatgen features. Defaults to True.
on_error ("ignore" | "warn" | "raise") – What to do in case of KeyError or ValueError while parsing CIF file. Defaults to “warn”.
- Returns:
All structures in CIF file.
- Return type:
list[Structure]
- class CifWriter(struct: Structure, symprec: float | None = None, write_magmoms: bool = False, significant_figures: int = 8, angle_tolerance: float = 5, refine_struct: bool = True, write_site_properties: bool = False)[source]
Bases:
object
A wrapper around CifFile to write CIF files from pymatgen Structure.
- Parameters:
struct (Structure) – structure to write.
symprec (float) – If not none, finds the symmetry of the structure and writes the CIF with symmetry information. Passes symprec to the SpacegroupAnalyzer. See also refine_struct.
write_magmoms (bool) – If True, will write magCIF file. Incompatible with symprec
significant_figures (int) – Specifies precision for formatting of floats. Defaults to 8.
angle_tolerance (float) – Angle tolerance for symmetry finding. Passes angle_tolerance to the SpacegroupAnalyzer. Used only if symprec is not None.
refine_struct – Used only if symprec is not None. If True, get_refined_structure is invoked to convert input structure from primitive to conventional.
write_site_properties (bool) – Whether to write the Structure.site_properties to the CIF as _atom_site_{property name}. Defaults to False.
pymatgen.io.common module
Module for defining common data used and produced by atomistic simulation packages.
- class PMGDir(dirname: str | Path)[source]
Bases:
Mapping
User-friendly class to access all files in a directory as pymatgen objects in a dict. For now, only VASP files are implemented but there is no reason why this cannot be extended to other types of files. Note that the files are lazily parsed to minimize initialization costs since not all files will be needed by all users.
Example:
` d = PMGDir(".") print(d["INCAR"]["NELM"]) print(d["vasprun.xml"].parameters) `
- Parameters:
dirname – The directory containing the VASP calculation as a string or Path.
- FILE_MAPPINGS: ClassVar = {'CHGCAR': 'pymatgen.io.vasp.Chgcar', 'CONTCAR': 'pymatgen.io.vasp.Poscar', 'DYNMAT': 'pymatgen.io.vasp.Dynmat', 'EIGENVAL': 'pymatgen.io.vasp.Eigenval', 'ELFCAR': 'pymatgen.io.vasp.Elfcar', 'IBZKPT': 'pymatgen.io.vasp.Kpoints', 'INCAR': 'pymatgen.io.vasp.Incar', 'KPOINTS': 'pymatgen.io.vasp.Kpoints', 'LOCPOT': 'pymatgen.io.vasp.Locpot', 'OSZICAR': 'pymatgen.io.vasp.Oszicar', 'OUTCAR': 'pymatgen.io.vasp.Outcar', 'POSCAR': 'pymatgen.io.vasp.Poscar', 'POTCAR': 'pymatgen.io.vasp.Potcar', 'PROCAR': 'pymatgen.io.vasp.Procar', 'WAVECAR': 'pymatgen.io.vasp.Wavecar', 'WAVEDER': 'pymatgen.io.vasp.Waveder', 'WSWQ': 'pymatgen.io.vasp.WSWQ', 'XDATCAR': 'pymatgen.io.vasp.Xdatcar', 'vasprun': 'pymatgen.io.vasp.Vasprun'}[source]
- class VolumetricData(structure: Structure, data: dict[str, ndarray], distance_matrix: ndarray | None = None, data_aug: ndarray | None = None)[source]
Bases:
MSONable
Simple volumetric object. Used to read LOCPOT/CHGCAR files produced by vasp as well as cube files produced by other codes.
- data[source]
Actual data as a dict of {string: np.array}. The string are “total” and “diff”, in accordance to the output format of Vasp LOCPOT and CHGCAR files where the total spin density is written first, followed by the difference spin density.
- Type:
dict
Typically, this constructor is not used directly and the static from_file constructor is used. This constructor is designed to allow summation and other operations between VolumetricData objects.
- Parameters:
structure (Structure) – associated with the volumetric data
data (dict[str, np.array]) – Actual volumetric data.
distance_matrix (np.array) – A pre-computed distance matrix if available. Useful so pass distance_matrices between sums, short-circuiting an otherwise expensive operation.
data_aug (np.array) – Any extra information associated with volumetric data (typically augmentation charges)
- classmethod from_cube(filename: str | Path) Self [source]
Initialize the cube object and store the data as data.
- Parameters:
filename (str) – of the cube to read
- classmethod from_hdf5(filename: str, **kwargs) Self [source]
Reads VolumetricData from HDF5 file.
- Parameters:
filename – Filename
- Returns:
VolumetricData
- get_average_along_axis(ind)[source]
Get the averaged total of the volumetric data a certain axis direction. For example, useful for visualizing Hartree Potentials from a LOCPOT file.
- Parameters:
ind (int) – Index of axis.
- Returns:
Average total along axis
- get_integrated_diff(ind, radius, nbins=1)[source]
Get integrated difference of atom index ind up to radius. This can be an extremely computationally intensive process, depending on how many grid points are in the VolumetricData.
- Parameters:
ind (int) – Index of atom.
radius (float) – Radius of integration.
nbins (int) – Number of bins. Defaults to 1. This allows one to obtain the charge integration up to a list of the cumulative charge integration values for radii for [radius/nbins, 2 * radius/nbins, ….].
- Returns:
Differential integrated charge as a np array of [[radius, value], …]. Format is for ease of plotting. e.g. plt.plot(data[:,0], data[:,1])
- linear_add(other, scale_factor=1.0)[source]
Method to do a linear sum of volumetric objects. Used by + and - operators as well. Returns a VolumetricData object containing the linear sum.
- Parameters:
other (VolumetricData) – Another VolumetricData object
scale_factor (float) – Factor to scale the other data by.
- Returns:
VolumetricData corresponding to self + scale_factor * other.
- linear_slice(p1, p2, n=100)[source]
Get a linear slice of the volumetric data with n data points from point p1 to point p2, in the form of a list.
- Parameters:
p1 (list) – 3-element list containing fractional coordinates of the first point.
p2 (list) – 3-element list containing fractional coordinates of the second point.
n (int) – Number of data points to collect, defaults to 100.
- Returns:
List of n data points (mostly interpolated) representing a linear slice of the data from point p1 to point p2.
- property spin_data[source]
data}. Essentially, this provides the actual Spin.up and Spin.down data instead of the total and diff. Note that by definition, a non-spin-polarized run would have Spin.up data == Spin.down data.
- Type:
The data decomposed into actual spin data as {spin
- to_cube(filename, comment: str = '')[source]
Write the total volumetric data to a cube file format, which consists of two comment lines, a header section defining the structure IN BOHR, and the data.
- Parameters:
filename (str) – Name of the cube file to be written.
comment (str) – If provided, this will be added to the second comment line
- to_hdf5(filename)[source]
Write the VolumetricData to a HDF5 format, which is a highly optimized format for reading storing large data. The mapping of the VolumetricData to this file format is as follows:
VolumetricData.data -> f[“vdata”] VolumetricData.structure ->
f[“Z”]: Sequence of atomic numbers f[“fcoords”]: Fractional coords f[“lattice”]: Lattice in the pymatgen.core.Lattice matrix
format
f.attrs[“structure_json”]: String of JSON representation
- Parameters:
filename (str) – Filename to output to.
- value_at(x, y, z)[source]
Get a data value from self.data at a given point (x, y, z) in terms of fractional lattice parameters. Will be interpolated using a RegularGridInterpolator on self.data if (x, y, z) is not in the original set of data points.
- Parameters:
x (float) – Fraction of lattice vector a.
y (float) – Fraction of lattice vector b.
z (float) – Fraction of lattice vector c.
- Returns:
Value from self.data (potentially interpolated) corresponding to the point (x, y, z).
pymatgen.io.core module
This module defines the abstract interface for reading and writing calculation inputs in pymatgen. The interface comprises a 3-tiered hierarchy of classes.
An InputFile object represents the contents of a single input file, e.g. the INCAR. This class standardizes file read and write operations.
An InputSet is a dict-like container that maps filenames (keys) to file contents (either strings or InputFile objects). This class provides a standard write_input() method.
InputGenerator classes implement a get_input_set method that, when provided with a structure, return an InputSet object with all parameters set correctly. Calculation input files can be written to disk with the write_inputs method.
If you want to implement a new InputGenerator, please take note of the following:
You must implement a get_input_set method that returns an InputSet
All customization of calculation parameters should be done in the __init__ method of the InputGenerator. The idea is that the generator contains the “recipe”, but nothing that is specific to a particular system. get_input_set takes system-specific information (such as structure) and applies the recipe.
All InputGenerator must save all supplied args and kwargs as instance variables. e.g. self.my_arg = my_arg and self.kwargs = kwargs in the __init__. This ensures the as_dict and from_dict work correctly.
- class InputFile[source]
Bases:
MSONable
Abstract base class to represent a single input file. Note that use of this class is optional; it is possible create an InputSet that does not rely on underlying InputFile objects.
All InputFile classes must implement a get_str method, which is called by write_file.
If InputFile classes implement an __init__ method, they must assign all arguments to __init__ as attributes.
- classmethod from_file(path: PathLike) None [source]
Creates an InputFile object from a file.
- Parameters:
path – Filename to read, including path.
- Returns:
InputFile
- class InputGenerator[source]
Bases:
MSONable
InputGenerator classes serve as generators for Input objects. They contain settings or sets of instructions for how to create Input from a set of coordinates or a previous calculation directory.
- class InputSet(inputs: dict[PathLike, str | InputFile] | None = None, **kwargs)[source]
Bases:
MSONable
,MutableMapping
Abstract base class for all InputSet classes. InputSet are dict-like containers for all calculation input data.
Since InputSet inherits dict, it can be instantiated in the same manner, or a custom __init__ can be provided. Either way, self should be populated with keys that are filenames to be written, and values that are InputFile objects or strings representing the entire contents of the file.
All InputSet must implement from_directory. Implementing the validate method is optional.
Instantiate an InputSet.
- Parameters:
inputs – The core mapping of filename: file contents that defines the InputSet data. This should be a dict where keys are filenames and values are InputFile objects or strings representing the entire contents of the file. If a value is not an InputFile object nor a str, but has a __str__ method, this str representation of the object will be written to the corresponding file. This mapping will become the .inputs attribute of the InputSet.
**kwargs – Any kwargs passed will be set as class attributes e.g. InputSet(inputs={}, foo=’bar’) will make InputSet.foo == ‘bar’.
- classmethod from_directory(directory: PathLike) None [source]
Construct an InputSet from a directory of one or more files.
- Parameters:
directory – Directory to read input files from
- validate() bool [source]
A place to implement basic checks to verify the validity of an input set. Can be as simple or as complex as desired.
Will raise a NotImplementedError unless overloaded by the inheriting class.
- write_input(directory: PathLike, make_dir: bool = True, overwrite: bool = True, zip_inputs: bool = False) None [source]
Write inputs to one or more files.
- Parameters:
directory – Directory to write input files to
make_dir – Whether to create the directory if it does not already exist.
overwrite – Whether to overwrite an input file if it already exists.
generate_inputs (Additional kwargs are passed to)
zip_inputs – If True, inputs will be zipped into a file with the same name as the InputSet (e.g., InputSet.zip)
pymatgen.io.cssr module
This module provides input and output from the CSSR file format.
- class Cssr(structure: Structure)[source]
Bases:
object
Basic object for working with Cssr file. Right now, only conversion from a Structure to a Cssr file is supported.
- Parameters:
structure (Structure | IStructure) – A structure to create the Cssr object.
- classmethod from_file(filename: str | Path) Self [source]
Reads a CSSR file to a Cssr object.
- Parameters:
filename (str) – Filename to read from.
- Returns:
Cssr object.
pymatgen.io.fiesta module
This module implements input and output for Fiesta (http://perso.neel.cnrs.fr/xavier.blase/fiesta/index.html).
Nwchem2Fiesta: create the input files needed for a Fiesta run
FiestaRun: run gw_fiesta and bse_fiesta
Localized BasisSetReader
- class BSEOutput(filename)[source]
Bases:
object
A bse output file parser. The start…
All energies are in eV.
- Parameters:
filename – Filename to read.
- class BasisSetReader(filename)[source]
Bases:
object
A basis set reader. Basis set are stored in data as a dict: :key l_zeta_ng for each nl orbitals which contain list of tuple (alpha, coef) for each of the ng gaussians in l_zeta orbital.
- Parameters:
filename – Filename to read.
- class FiestaInput(mol, correlation_grid: dict[str, str] | None = None, exc_dft_option: dict[str, str] | None = None, cohsex_options: dict[str, str] | None = None, gw_options: dict[str, str] | None = None, bse_tddft_options: dict[str, str] | None = None)[source]
Bases:
MSONable
Input File for Fiesta called “cell.in” by default (mandatory in Fiesta for now).
- Parameters:
mol – pymatgen mol
correlation_grid – dict
Exc_DFT_option – dict
COHSEX_options – dict
GW_options – dict
BSE_TDDFT_options – dict.
- dump_bse_data_in_gw_run(BSE_dump=True)[source]
Set the “do_bse” variable to 1 or 0 in cell.in.
- Parameters:
BSE_dump (bool) – Defaults to True.
- dump_tddft_data_in_gw_run(tddft_dump: bool = True)[source]
Set the do_tddft variable to 1 or 0 in cell.in.
- Parameters:
tddft_dump (bool) – Defaults to True.
- classmethod from_dict(dct: dict) Self [source]
- Parameters:
dct (dict) – Dict representation.
- Returns:
FiestaInput
- classmethod from_file(filename: str | Path) Self [source]
Read an Fiesta input from a file. Currently tested to work with files generated from this class itself.
- Parameters:
filename – Filename to parse.
- Returns:
FiestaInput object
- classmethod from_str(string_input: str) Self [source]
Read an FiestaInput from a string. Currently tested to work with files generated from this class itself.
- Parameters:
string_input – string_input to parse.
- Returns:
FiestaInput object
- static make_full_bse_densities_folder(folder)[source]
Mkdir “FULL_BSE_Densities” folder (needed for bse run) in the desired folder.
- set_auxiliary_basis_set(folder, auxiliary_folder, auxiliary_basis_set_type='aug_cc_pvtz')[source]
copy in the desired folder the needed auxiliary basis set “X2.ion” where X is a specie.
- Parameters:
auxiliary_folder – folder where the auxiliary basis sets are stored
auxiliary_basis_set_type – type of basis set (string to be found in the extension of the file name; must be in lower case). ex: C2.ion_aug_cc_pvtz_RI_Weigend find “aug_cc_pvtz”.
- set_bse_options(n_excitations=10, nit_bse=200)[source]
Set parameters in cell.in for a BSE computation.
- Parameters:
nv_bse – number of valence bands
nc_bse – number of conduction bands
n_excitations – number of excitations
nit_bse – number of iterations.
- set_gw_options(nv_band=10, nc_band=10, n_iteration=5, n_grid=6, dE_grid=0.5)[source]
Set parameters in cell.in for a GW computation.
- Parameters:
nv__band – number of valence bands to correct with GW
nc_band – number of conduction bands to correct with GW
n_iteration – number of iteration
dE_grid (n_grid and) – number of points and spacing in eV for correlation grid.
- class FiestaOutput(filename)[source]
Bases:
object
A Fiesta output file parser.
All energies are in eV.
- Parameters:
filename – Filename to read.
- class FiestaRun(folder: str | None = None, grid: Tuple3Ints = (2, 2, 2), log_file: str = 'log')[source]
Bases:
MSONable
- To run FIESTA inside python:
if grid is [x,x] then bse runs if grid is [x,x,y] the fiesta(gw) runs otherwise it breaks.
- Parameters:
folder – Folder to look for runs.
grid
log_file – logfile of Fiesta.
- class Nwchem2Fiesta(folder, filename='nwchem', log_file='log_n2f')[source]
Bases:
MSONable
To run NWCHEM2FIESTA inside python:
If nwchem.nw is the input, nwchem.out the output, and structure.movecs the “movecs” file, the syntax to run NWCHEM2FIESTA is: NWCHEM2FIESTA nwchem.nw nwchem.nwout structure.movecs > log_n2f
- Parameters:
folder – where are stored the nwchem
filename – name of nwchem files read by NWCHEM2FIESTA (filename.nw, filename.nwout and filename.movecs)
logfile – logfile of NWCHEM2FIESTA.
pymatgen.io.gaussian module
This module implements input and output processing from Gaussian.
- class GaussianInput(mol, charge=None, spin_multiplicity=None, title=None, functional='HF', basis_set='6-31G(d)', route_parameters=None, input_parameters=None, link0_parameters=None, dieze_tag='#P', gen_basis=None)[source]
Bases:
object
A Gaussian input file.
- Parameters:
mol – Input molecule. It can either be a Molecule object, a string giving the geometry in a format supported by Gaussian, or
None
. If the molecule isNone
, you will need to use read it in from a checkpoint. Consider addingCHK
to thelink0_parameters
.charge – Charge of the molecule. If None, charge on molecule is used. Defaults to None. This allows the input file to be set a charge independently from the molecule itself. If
mol
is not a Molecule object, then you must specify a charge.spin_multiplicity –
Spin multiplicity of molecule. Defaults to None, which means that the spin multiplicity is set to 1 if the molecule has no unpaired electrons and to 2 if there are unpaired electrons. If
mol
is not a Molecule object, then youmust specify the multiplicity
title – Title for run. Defaults to formula of molecule if None.
functional – Functional for run.
basis_set – Basis set for run.
route_parameters – Additional route parameters as a dict. For example, {‘SP’:””, “SCF”:”Tight”}
input_parameters – Additional input parameters for run as a dict. Used for example, in PCM calculations. e.g. {“EPS”:12}
link0_parameters – Link0 parameters as a dict. e.g. {“%mem”: “1000MW”}
dieze_tag – # preceding the route line. E.g. “#p”
gen_basis – allows a user-specified basis set to be used in a Gaussian calculation. If this is not None, the attribute
basis_set
will be set to “Gen”.
- classmethod from_file(filename: str | Path) Self [source]
Creates GaussianInput from a file.
- Parameters:
filename – Gaussian input filename
- Returns:
GaussianInput object
- classmethod from_str(contents: str) Self [source]
Creates GaussianInput from a string.
- Parameters:
contents – String representing an Gaussian input file.
- Returns:
GaussianInput object
- class GaussianOutput(filename: PathLike)[source]
Bases:
object
Parser for Gaussian output files.
Note: Still in early beta.
- structures[source]
All structures from the calculation in the standard orientation. If the symmetry is not considered, the standard orientation is not printed out and the input orientation is used instead. Check the standard_orientation attribute.
- Type:
list[Structure]
- structures_input_orientation[source]
All structures from the calculation in the input orientation or the Z-matrix orientation (if an opt=z-matrix was requested).
- Type:
list
- opt_structures[source]
All optimized structures from the calculation in the standard orientation, if the attribute ‘standard_orientation’ is True, otherwise in the input or the Z-matrix orientation.
- Type:
list
- frequencies[source]
A list for each freq calculation and for each mode of a dict with {
“frequency”: freq in cm-1, “symmetry”: symmetry tag “r_mass”: Reduce mass, “f_constant”: force constant, “IR_intensity”: IR Intensity, “mode”: normal mode
}
The normal mode is a 1D vector of dx, dy dz of each atom.
- Type:
list
- hessian[source]
Matrix of second derivatives of the energy with respect to cartesian coordinates in the input orientation frame. Need #P in the route section in order to be in the output.
- Type:
ndarray
- stationary_type[source]
If it is a relaxation run, indicates whether it is a minimum (Minimum) or a saddle point (“Saddle”).
- Type:
str
- corrections[source]
Thermochemical corrections if this run is a Freq run as a dict. Keys are “Zero-point”, “Thermal”, “Enthalpy” and “Gibbs Free Energy”.
- Type:
dict
- route[source]
Additional route parameters as a dict. For example, {‘SP’:””, “SCF”:”Tight”}.
- Type:
dict
- eigenvectors[source]
Matrix of shape (num_basis_func, num_basis_func). Each column is an eigenvectors and contains AO coefficients of an MO. eigenvectors[Spin] = mat(num_basis_func, num_basis_func).
- Type:
dict
- molecular_orbital[source]
MO development coefficients on AO in a more convenient array dict for each atom and basis set label. mo[Spin][OM j][atom i] = {AO_k: coeff, AO_k: coeff … }.
- Type:
dict
- atom_basis_labels[source]
Labels of AO for each atoms. These labels are those used in the output of molecular orbital coefficients (POP=Full) and in the molecular_orbital array dict. atom_basis_labels[iatom] = [AO_k, AO_k, …].
- Type:
list
- resumes[source]
List of gaussian data resume given at the end of the output file before the quotation. The resumes are given as string.
- Type:
list
- standard_orientation[source]
If True, the geometries stored in the structures are in the standard orientation. Else, the geometries are in the input orientation.
- Type:
bool
- bond_orders[source]
Dict of bond order values read in the output file such as: {(0, 1): 0.8709, (1, 6): 1.234, …}. The keys are the atom indexes and the values are the Wiberg bond indexes that are printed using pop=NBOREAD and $nbo bndidx $end.
- Type:
dict
- to_input()[source]
Return a GaussianInput object using the last geometry and the same calculation parameters.
- Parameters:
filename – Filename of Gaussian output file.
- get_scan_plot(coords=None)[source]
Get a matplotlib plot of the potential energy surface.
- Parameters:
coords – internal coordinate name to use as abscissa.
- get_spectre_plot(sigma=0.05, step=0.01)[source]
Get a matplotlib plot of the UV-visible xas. Transitions are plotted as vertical lines and as a sum of normal functions with sigma with. The broadening is applied in energy and the xas is plotted as a function of the wavelength.
- Parameters:
sigma – Full width at half maximum in eV for normal functions.
step – bin interval in eV
- Returns:
- {“energies”: values, “lambda”: values, “xas”: values}
where values are lists of abscissa (energies, lambda) and the sum of gaussian functions (xas).
A matplotlib plot.
- Return type:
A dict
- read_excitation_energies()[source]
Read a excitation energies after a TD-DFT calculation.
- Returns:
- A list of tuple for each transition such as
[(energie (eV), lambda (nm), oscillatory strength), … ]
- Return type:
A list
- read_scan()[source]
Read a potential energy surface from a gaussian scan calculation.
- Returns:
{“energies”: […], “coords”: {“d1”: […], “A2”, […], … }} “energies” are the energies of all points of the potential energy surface. “coords” are the internal coordinates used to compute the potential energy surface and the internal coordinates optimized, labelled by their name as defined in the calculation.
- Return type:
dict[str, list]
- save_scan_plot(filename='scan.pdf', img_format='pdf', coords=None)[source]
Save matplotlib plot of the potential energy surface to a file.
- Parameters:
filename – Filename to write to.
img_format – Image format to use. Defaults to EPS.
coords – internal coordinate name to use as abcissa.
- save_spectre_plot(filename='spectre.pdf', img_format='pdf', sigma=0.05, step=0.01)[source]
Save matplotlib plot of the spectre to a file.
- Parameters:
filename – Filename to write to.
img_format – Image format to use. Defaults to EPS.
sigma – Full width at half maximum in eV for normal functions.
step – bin interval in eV
- to_input(mol=None, charge=None, spin_multiplicity=None, title=None, functional=None, basis_set=None, route_parameters=None, input_parameters=None, link0_parameters=None, dieze_tag=None, cart_coords=False)[source]
Create a new input object using by default the last geometry read in the output file and with the same calculation parameters. Arguments are the same as GaussianInput class.
- Returns:
the gaussian input object
- Return type:
- read_route_line(route)[source]
read route line in gaussian input/output and return functional basis_set and a dictionary of other route parameters.
- Parameters:
route (str) – the route line
- Returns:
the method (HF, PBE …) basis_set (str) : the basis set route (dict) : dictionary of parameters
- Return type:
functional (str)
pymatgen.io.icet module
- class IcetSQS(structure: Structure, scaling: int, instances: int | None, cluster_cutoffs: dict[int, float], sqs_method: str | None = None, sqs_kwargs: dict | None = None)[source]
Bases:
object
Interface to the Icet library of SQS structure generation tools.
https://icet.materialsmodeling.org
Instantiate an IcetSQS interface.
- Parameters:
structure (Structure) – disordered structure to compute SQS
scaling (int) – SQS supercell contains scaling * len(structure) sites
instances (int) – number of parallel SQS jobs to run
cluster_cutoffs (dict) – dict of cluster size (pairs, triplets, …) and the size of the cluster
- Kwargs:
- sqs_method (str or None): if a str, one of (“enumeration”, “monte_carlo”)
If None, default to “enumeration” for a supercell of < 24 sites, and “monte carlo” otherwise.
- sqs_kwargs (dict): kwargs to pass to the icet SQS generators.
See self.sqs_kwarg_names for possible options.
- enumerate_sqs_structures(cluster_space: _ClusterSpace | None = None) list [source]
Generate an SQS by enumeration of all possible arrangements.
Adapted from icet.tools.structure_generation.generate_sqs_by_enumeration to accommodate multiprocessing.
- Parameters:
cluster_space (ClusterSpace) – ClusterSpace of the SQS search.
- Returns:
- dicts of the form: {
“structure”: SQS structure, “objective_function”: SQS objective function,
}
- Return type:
list
- get_icet_sqs_obj(material: Atoms | Structure, cluster_space: _ClusterSpace | None = None) float [source]
Get the SQS objective function.
- Parameters:
material (pymatgen.Structure | ase.Atoms) – structure to compute SQS objective function for.
cluster_space (ClusterSpace) – ClusterSpace of the SQS search.
- Returns:
the SQS objective function
- Return type:
float
pymatgen.io.jarvis module
This module provides conversion between the JARVIS Atoms object and pymatgen Structure objects.
pymatgen.io.lmto module
Module for implementing a CTRL file object class for the Stuttgart LMTO-ASA code. It will primarily be used to generate a pymatgen Structure object in the pymatgen.electronic_structure.cohp.py module.
- class LMTOCopl(filename='COPL', to_eV=False)[source]
Bases:
object
Read COPL files, which contain COHP data.
- cohp_data[source]
Contains the COHP data of the form: {bond: {“COHP”: {Spin.up: cohps, Spin.down:cohps},
“ICOHP”: {Spin.up: icohps, Spin.down: icohps}, “length”: bond length}
- Type:
dict
- Parameters:
filename – filename of the COPL file. Defaults to “COPL”.
to_eV – LMTO-ASA gives energies in Ry. To convert energies into eV, set to True. Defaults to False for energies in Ry.
- class LMTOCtrl(structure: Structure, header: str | None = None, version: str = 'LMASA-47')[source]
Bases:
object
Parse CTRL files from the Stuttgart LMTO-ASA code. Currently, only HEADER, VERS and the structure can be used.
- Parameters:
structure (Structure) – pymatgen object.
header (str) – The header for the CTRL file. Defaults to None.
version (str) – The LMTO version that is used for the VERS category. Defaults to version (4.7).
- as_dict()[source]
Get the CTRL as a dictionary. “SITE” and “CLASS” are of the form {‘CATEGORY’: {‘TOKEN’: value}}, the rest is of the form ‘TOKEN’/’CATEGORY’: value. It gets the conventional standard structure because primitive cells use the conventional a-lattice parameter as the scaling factor and not the a-lattice parameter of the primitive cell.
- classmethod from_dict(dct: dict) Self [source]
Creates a CTRL file object from a dictionary. The dictionary must contain the items “ALAT”, PLAT” and “SITE”.
- Valid dictionary items are:
ALAT: the a-lattice parameter PLAT: (3x3) array for the lattice vectors SITE: list of dictionaries: {‘ATOM’: class label, ‘POS’: (3x1) array of fractional coordinates} CLASS (optional): list of unique atom labels as str SPCGRP (optional): space group symbol (str) or number (int) HEADER (optional): HEADER text as a str VERS (optional): LMTO version as a str
- Parameters:
dct – The CTRL file as a dictionary.
- Returns:
An LMTOCtrl object.
- classmethod from_file(filename: str | Path = 'CTRL', **kwargs) Self [source]
Creates a CTRL file object from an existing file.
- Parameters:
filename – The name of the CTRL file. Defaults to ‘CTRL’.
- Returns:
An LMTOCtrl object.
- classmethod from_str(data: str, sigfigs: int = 8) Self [source]
Creates a CTRL file object from a string. This will mostly be used to read an LMTOCtrl object from a CTRL file. Empty spheres are ignored.
- Parameters:
data (str) – String representation of the CTRL file.
- Returns:
An LMTOCtrl object.
pymatgen.io.multiwfn module
This module implements input/output processing from Multiwfn.
Currently, the focus of this module is on processing Quantum Theory of Atoms in Molecules (QTAIM) outputs from Multiwfn. Additional features may be added over time as needed/desired.
- add_atoms(molecule: Molecule, organized_cps: dict[str, dict[Any, dict[str, Any]]], bond_atom_criterion: Literal['qtaim', 'distance', 'combined'] = 'combined', dist_threshold_bond: float = 1.0, dist_threshold_ring_cage: float = 3.0, distance_margin: float = 0.5) dict[str, dict[str, dict[str, Any]]] [source]
Modify bond, ring, and cage CPs to include information about surrounding critical points. Bonds will include information about the atoms that make up the bond. Rings will include the names of neighboring bonds and the indices of the atoms involved, and cages will include information on neighboring rings, bonds, and the atoms involved.
- Parameters:
molecule (Molecule) – structure corresponding to this Multiwfn calculation
organized_cps (Dict[str, Dict[Any, Dict[str, Any]]]) – Keys are CP categories (“atom”, “bond”, “ring”, and “cage”). Values are themselves dictionaries, where the keys are CP names (or atom indices) and the values are CP descriptors
bond_atom_criterion (Literal["qtaim", "distance", "combined"]) – If this is “qtaim”, the inherent bonding definition obtained from QTAIM/Multiwfn will be used to link bond CPs to atoms involved in those bonds. If it is “distance”, a distance-based metric will be used instead, where the atoms closest to the bond CP will be assumed to be bonded. If this is “combined”, then the QTAIM/Multiwfn definition will be used where available, and a distance metric will be used for all bond CPs lacking a definition from QTAIM/Multiwfn. NOTE: to use “qtaim” or “combined” as bond_atom_criterion, you must have used map_atoms_cps to link atom numbers from Multiwfn to atom indices in molecule.
dist_threshold_bond (float) – If the nearest atoms to a bond CP are further from the bond CP than this threshold (default 1.0 Angstrom), then a warning will be raised.
dist_threshold_ring_cage (float) – If the nearest bond CPs to a ring CP or the nearest ring CPs to a cage CP are further than this threshold (default 3.0 Angstrom), then a warning will be raised.
distance_margin (float) – Rings must be made up of at least three bonds, and cages must be made up of at least three rings. We therefore define rings by the three closest bond CPs and cages by the three closest ring CPs. We associate additional bond/ring CPs with ring/cage CPs if they are no further than the third-closest bond/ring CP, plus this margin. Default is 0.5 Angstrom
- Returns:
CP dict with additional information added.
- Return type:
modified_organized_cps (Dict[str, Dict[str, Dict[str, Any]]])
- extract_info_from_cp_text(lines_split: list[list[str]], cp_type: Literal['atom', 'bond', 'ring', 'cage'], conditionals: dict[str, list[str]]) tuple[str, dict[str, Any]] [source]
Extract specific information from a Multiwfn QTAIM output.
- Parameters:
lines_split (List[List[str]]) – List of lines from a (pre-processed) CP file, containing only information regarding one critical point, split by whitespace
cp_type – Type of critical point. Currently, can be “atom”, “bond”, “ring”, or “cage”
conditionals (Dict[str, List[str]]) – Parameters to extract with strings to search for to see if the data is present
- Returns:
dictionary of critical point information
- Return type:
cp_dict
- get_qtaim_descs(file: PathLike) dict[str, dict[str, Any]] [source]
Parse CPprop file from multiwfn by parsing each individual critical-point section.
- Parameters:
file (PathLike) – path to CPprop file
- Returns:
Output dictionary of QTAIM descriptors
- Return type:
descriptors (Dict[str, Dict[str, Any]])
- map_atoms_cps(molecule: Molecule, atom_cp_dict: dict[str, dict[str, Any]], max_distance: float = 0.5) tuple[dict[int, dict[str, Any]], list[int]] [source]
Connect atom CPs to atoms by their positions.
- Parameters:
molecule (Molecule) – structure corresponding to this Multiwfn calculation
atom_cp_dict (Dict[str, Dict[str, Any]]) – Dictionary where keys are critical point names and values are descriptors, including element symbol and position
max_distance (float) – Maximum distance (in Angstrom) that a critical point can be away from an atom center and be associated with that atom. Default is 0.5 Angstrom
- Returns:
- Dictionary mapping atomic indices to atom critical point
descriptors
missing_atoms (List[int]): list of dft atoms that do not have a cp found in qtaim
- Return type:
index_to_cp_desc (Dict[int, Dict[str, Any]])
- match_atom_cp(molecule: Molecule, index: int, atom_cp_dict: dict[str, dict[str, Any]], max_distance: float = 0.5) tuple[str | None, dict] [source]
From a dictionary with an atom’s position and element symbol, find the corresponding cp in the atom CP dictionary
- Parameters:
molecule (Molecule) – structure corresponding to this Multiwfn calculation
index (int) – index of the atom to be matched
atom_cp_dict (Dict[str, Dict[str, Any]]) – Dictionary where keys are critical point names and values are descriptors, including element symbol and position
max_distance (float) – Maximum distance (in Angstrom) that a critical point can be away from an atom center and be associated with that atom. Default is 0.5 Angstrom
- Returns:
- Key of atom_cp_dict; the name of the atom critical point corresponding to this atom. If
no match is found, this will be None
cp_dict (Dict): Dictionary of CP descriptors matching this atom
- Return type:
cp_name (str | None)
- parse_cp(lines: list[str]) tuple[str | None, dict[str, Any]] [source]
Parse information from a single QTAIM critical point.
- Parameters:
lines (List[str]) – list of lines from a (preparsed) CP file, containing only information regarding one critical point
- Returns:
dictionary of critical point information
- Return type:
cp_dict
- process_multiwfn_qtaim(molecule: Molecule, file: PathLike, bond_atom_criterion: Literal['qtaim', 'distance'] = 'distance', max_distance_atom: float = 0.5, dist_threshold_bond: float = 1.0, dist_threshold_ring_cage: float = 3.0, distance_margin: float = 0.5) dict[str, dict[Any, dict[str, Any]]] [source]
Process quantum theory of atoms in molecules (QTAIM) outputs from Multiwfn.
- Parameters:
molecule (Molecule) – structure corresponding to this Multiwfn calculation
file (PathLike) – path to CPprop file containing QTAIM information
bond_atom_criterion (Literal["qtaim", "distance"]) – If “qtaim”, the inherent bonding definition obtained from QTAIM/Multiwfn will be used to link bond CPs to atoms involved in those bonds; if “distance”, a distance-based metric will be used instead, where the atoms closest to the bond CP will be assumed to be bonded.
max_distance (float) – Maximum distance (in Angstrom) that an atom critical point can be away from an atom center and be associated with that atom. Default is 0.5 Angstrom
dist_threshold_bond (float) – If the nearest atoms to a bond CP are further from the bond CP than this threshold (default 1.0 Angstrom), then a warning will be raised.
dist_threshold_ring_cage (float) – If the nearest bond CPs to a ring CP or the nearest ring CPs to a cage CP are further than this threshold (default 3.0 Angstrom), then a warning will be raised.
distance_margin (float) – Rings must be made up of at least three bonds, and cages must be made up of at least three rings. We therefore define rings by the three closest bond CPs and cages by the three closest ring CPs. We associate additional bond/ring CPs with ring/cage CPs if they are no further than the third-closest bond/ring CP, plus this margin. Default is 0.5 Angstrom
- Returns:
- QTAIM descriptors, organized by type (“atom”, “bond”,
”ring”, “cage”), with additional metadata added to bond, ring, and cage CPs
- Return type:
with_atoms (Dict[str, Dict[str, Dict[str, Any]]])
- separate_cps_by_type(qtaim_descs: dict[Any, dict[str, Any]]) dict[str, dict[Any, dict[str, Any]]] [source]
Separates QTAIM descriptors by type (atom, bond, ring, or cage)
- Parameters:
qtaim_descs (Dict[str, Dict[str, Any]]) – Dictionary where keys are CP names and values are dictionaries of descriptors obtained from get_qtaim_descs and parse_cp
- Returns:
- Dictionary of organized QTAIM critical points and their
descriptors. Keys are “atom”, “bond”, “ring”, and “cage”, and values are dicts {<CP name>: <QTAIM descriptors>}
- Return type:
organized_descs (Dict[str, Dict[str, Dict[str, Any]]])
pymatgen.io.nwchem module
This module implements input and output processing from Nwchem.
2015/09/21 - Xin Chen (chenxin13@mails.tsinghua.edu.cn):
NwOutput will read new kinds of data:
normal hessian matrix. [“hessian”]
projected hessian matrix. [“projected_hessian”]
normal frequencies. [“normal_frequencies”]
For backward compatibility, the key for accessing the projected frequencies is still ‘frequencies’.
- 2015/10/12 - Xin Chen
NwOutput will read new kinds of data:
forces. [“forces”]
- class NwInput(mol, tasks, directives=None, geometry_options=('units', 'angstroms'), symmetry_options=None, memory_options=None)[source]
Bases:
MSONable
An object representing a Nwchem input file, which is essentially a list of tasks on a particular molecule.
- Parameters:
mol – Input molecule. If molecule is a single string, it is used as a direct input to the geometry section of the Gaussian input file.
tasks – List of NwTasks.
directives – List of root level directives as tuple. e.g. [(“start”, “water”), (“print”, “high”)]
geometry_options – Additional list of options to be supplied to the geometry. e.g. [“units”, “angstroms”, “noautoz”]. Defaults to (“units”, “angstroms”).
symmetry_options – Addition list of option to be supplied to the symmetry. E.g. [“c1”] to turn off the symmetry
memory_options – Memory controlling options. str. E.g “total 1000 mb stack 400 mb”.
- classmethod from_dict(dct: dict) Self [source]
- Parameters:
dct (dict) – Dict representation.
- Returns:
NwInput
- classmethod from_file(filename: str | Path) Self [source]
Read an NwInput from a file. Currently tested to work with files generated from this class itself.
- Parameters:
filename – Filename to parse.
- Returns:
NwInput object
- class NwOutput(filename)[source]
Bases:
object
A Nwchem output file parser. Very basic for now - supports only dft and only parses energies and geometries. Please note that Nwchem typically outputs energies in either au or kJ/mol. All energies are converted to eV in the parser.
- Parameters:
filename – Filename to read.
- get_excitation_spectrum(width=0.1, npoints=2000)[source]
Generate an excitation spectra from the singlet roots of TDDFT calculations.
- Parameters:
width (float) – Width for Gaussian smearing.
npoints (int) – Number of energy points. More points => smoother curve.
- Returns:
can be plotted using pymatgen.vis.plotters.SpectrumPlotter.
- Return type:
- class NwTask(charge, spin_multiplicity, basis_set, basis_set_option='cartesian', title=None, theory='dft', operation='optimize', theory_directives=None, alternate_directives=None)[source]
Bases:
MSONable
Base task for Nwchem.
Very flexible arguments to support many types of potential setups. Users should use more friendly static methods unless they need the flexibility.
- Parameters:
charge – Charge of the molecule. If None, charge on molecule is used. Defaults to None. This allows the input file to be set a charge independently from the molecule itself.
spin_multiplicity – Spin multiplicity of molecule. Defaults to None, which means that the spin multiplicity is set to 1 if the molecule has no unpaired electrons and to 2 if there are unpaired electrons.
basis_set – The basis set used for the task as a dict. e.g. {“C”: “6-311++G**”, “H”: “6-31++G**”}.
basis_set_option – cartesian (default) | spherical,
title – Title for the task. Defaults to None, which means a title based on the theory and operation of the task is autogenerated.
theory – The theory used for the task. Defaults to “dft”.
operation – The operation for the task. Defaults to “optimize”.
theory_directives – A dict of theory directives. For example, if you are running dft calculations, you may specify the exchange correlation functional using {“xc”: “b3lyp”}.
alternate_directives – A dict of alternate directives. For example, to perform cosmo calculations and dielectric constant of 78, you’d supply {‘cosmo’: {“dielectric”: 78}}.
- classmethod dft_task(mol, xc='b3lyp', **kwargs)[source]
A class method for quickly creating DFT tasks with optional cosmo parameter .
- Parameters:
mol – Input molecule
xc – Exchange correlation to use.
kwargs – Any of the other kwargs supported by NwTask. Note the theory is always “dft” for a dft task.
- classmethod esp_task(mol, **kwargs)[source]
A class method for quickly creating ESP tasks with RESP charge fitting.
- Parameters:
mol – Input molecule
kwargs – Any of the other kwargs supported by NwTask. Note the theory is always “dft” for a dft task.
- classmethod from_dict(dct: dict) Self [source]
- Parameters:
dct (dict) – Dict representation.
- Returns:
NwTask
- classmethod from_molecule(mol, theory, charge=None, spin_multiplicity=None, basis_set='6-31g', basis_set_option='cartesian', title=None, operation='optimize', theory_directives=None, alternate_directives=None) Self [source]
Very flexible arguments to support many types of potential setups. Users should use more friendly static methods unless they need the flexibility.
- Parameters:
mol – Input molecule
charge – Charge of the molecule. If None, charge on molecule is used. Defaults to None. This allows the input file to be set a charge independently from the molecule itself.
spin_multiplicity – Spin multiplicity of molecule. Defaults to None, which means that the spin multiplicity is set to 1 if the molecule has no unpaired electrons and to 2 if there are unpaired electrons.
basis_set – The basis set to be used as string or a dict. e.g. {“C”: “6-311++G**”, “H”: “6-31++G**”} or “6-31G”. If string, same basis set is used for all elements.
basis_set_option – cartesian (default) | spherical,
title – Title for the task. Defaults to None, which means a title based on the theory and operation of the task is autogenerated.
theory – The theory used for the task. Defaults to “dft”.
operation – The operation for the task. Defaults to “optimize”.
theory_directives – A dict of theory directives. For example, if you are running dft calculations, you may specify the exchange correlation functional using {“xc”: “b3lyp”}.
alternate_directives – A dict of alternate directives. For example, to perform cosmo calculations with DFT, you’d supply {‘cosmo’: “cosmo”}.
- operations: ClassVar[dict[str, str]] = {'': 'dummy', 'dynamics': 'Perform classical molecular dynamics.', 'energy': 'Evaluate the single point energy.', 'freq': 'Same as frequencies.', 'frequencies': 'Compute second derivatives and print out an analysis of molecular vibrations.', 'gradient': 'Evaluate the derivative of the energy with respect to nuclear coordinates.', 'hessian': 'Compute second derivatives.', 'optimize': 'Minimize the energy by varying the molecular structure.', 'property': 'Calculate the properties for the wave function.', 'saddle': 'Conduct a search for a transition state (or saddle point).', 'thermodynamics': 'Perform multi-configuration thermodynamic integration using classical MD.', 'vscf': 'Compute anharmonic contributions to the vibrational modes.'}[source]
- theories: ClassVar[dict[str, str]] = {'band': 'Pseudopotential plane-wave DFT for solids using NWPW', 'ccsd': 'Coupled-cluster single and double excitations', 'ccsd(t)': 'Coupled-cluster linearized triples approximation', 'ccsd+t(ccsd)': 'Fourth order triples contribution', 'dft': 'DFT', 'direct_mp2': 'MP2 using a full-direct algorithm', 'esp': 'ESP', 'g3gn': 'some description', 'mcscf': 'Multiconfiguration SCF', 'md': 'Classical molecular dynamics simulation', 'mp2': 'MP2 using a semi-direct algorithm', 'pspw': 'Pseudopotential plane-wave DFT for molecules and insulating solids using NWPW', 'rimp2': 'MP2 using the RI approximation', 'scf': 'Hartree-Fock', 'selci': 'Selected CI with perturbation correction', 'sodft': 'Spin-Orbit DFT', 'tce': 'Tensor Contraction Engine', 'tddft': 'Time Dependent DFT'}[source]
pymatgen.io.openff module
Utility functions for classical MD subpackage.
- add_conformer(openff_mol: Molecule, geometry: Molecule | None) tuple[Molecule, dict[int, int]] [source]
Add conformers to an OpenFF Molecule based on the provided geometry.
If a geometry is provided, infers an OpenFF Molecule from it, finds an atom mapping between the inferred molecule and the input molecule, and adds the conformer coordinates to the input molecule. If no geometry is provided, generates a single conformer.
- Parameters:
openff_mol (tk.Molecule) – The OpenFF Molecule to add conformers to.
geometry (Union[pymatgen.core.Molecule, None]) – The geometry to use for adding conformers.
- Returns:
- A tuple containing the updated OpenFF
Molecule with added conformers and a dictionary representing the atom mapping.
- Return type:
Tuple[tk.Molecule, Dict[int, int]]
- assign_partial_charges(openff_mol: Molecule, atom_map: dict[int, int], charge_method: str, partial_charges: None | list[float]) Molecule [source]
Assign partial charges to an OpenFF Molecule.
If partial charges are provided, assigns them to the molecule based on the atom mapping. If the molecule has only one atom, assigns the total charge as the partial charge. Otherwise, assigns partial charges using the specified charge method.
- Parameters:
openff_mol (tk.Molecule) – The OpenFF Molecule to assign partial charges to.
atom_map (Dict[int, int]) – A dictionary representing the atom mapping.
charge_method (str) – The charge method to use if partial charges are not provided.
partial_charges (Union[None, List[float]]) – A list of partial charges to assign or None to use the charge method.
- Returns:
The OpenFF Molecule with assigned partial charges.
- Return type:
tk.Molecule
- create_openff_mol(smile: str, geometry: Molecule | str | Path | None = None, charge_scaling: float = 1, partial_charges: list[float] | None = None, backup_charge_method: str = 'am1bcc') Molecule [source]
Create an OpenFF Molecule from a SMILES string and optional geometry.
Constructs an OpenFF Molecule from the provided SMILES string, adds conformers based on the provided geometry (if any), assigns partial charges using the specified method or provided partial charges, and applies charge scaling.
- Parameters:
smile (str) – The SMILES string of the molecule.
geometry (Union[pymatgen.core.Molecule, str, Path, None], optional) – The geometry to use for adding conformers. Can be a Pymatgen Molecule, file path, or None.
charge_scaling (float, optional) – The scaling factor for partial charges. Default is 1.
partial_charges (Union[List[float], None], optional) – A list of partial charges to assign, or None to use the charge method.
backup_charge_method (str, optional) – The backup charge method to use if partial charges are not provided. Default is “am1bcc”.
- Returns:
The created OpenFF Molecule.
- Return type:
tk.Molecule
- get_atom_map(inferred_mol: Molecule, openff_mol: Molecule) tuple[bool, dict[int, int]] [source]
Compute an atom mapping between two OpenFF Molecules.
Attempts to find an isomorphism between the molecules, considering various matching criteria such as formal charges, stereochemistry, and bond orders. Returns the atom mapping if an isomorphism is found, otherwise returns an empty mapping.
- Parameters:
inferred_mol (tk.Molecule) – The first OpenFF Molecule.
openff_mol (tk.Molecule) – The second OpenFF Molecule.
- Returns:
- A tuple containing a boolean indicating if an
isomorphism was found and a dictionary representing the atom mapping.
- Return type:
Tuple[bool, Dict[int, int]]
- infer_openff_mol(mol_geometry: Molecule) Molecule [source]
Infer an OpenFF Molecule from a Pymatgen Molecule.
Constructs a MoleculeGraph from the Pymatgen Molecule using the OpenBabelNN local environment strategy and extends metal edges. Converts the resulting MoleculeGraph to an OpenFF Molecule using mol_graph_to_openff_mol.
- Parameters:
mol_geometry (pymatgen.core.Molecule) – The Pymatgen Molecule to infer from.
- Returns:
The inferred OpenFF Molecule.
- Return type:
tk.Molecule
- mol_graph_from_openff_mol(molecule: Molecule) MoleculeGraph [source]
This is designed to closely mirror the graph structure generated by tk.Molecule.to_networkx.
- Parameters:
molecule (tk.Molecule) – The OpenFF Molecule to convert.
- Returns:
The converted MoleculeGraph.
- Return type:
- mol_graph_to_openff_mol(mol_graph: MoleculeGraph) Molecule [source]
Convert a Pymatgen MoleculeGraph to an OpenFF Molecule.
- Parameters:
mol_graph (MoleculeGraph) – The Pymatgen MoleculeGraph to be converted.
- Returns:
The converted OpenFF Molecule.
- Return type:
tk.Molecule
pymatgen.io.optimade module
This module provides conversion between structure entries following the OPTIMADE (https://optimade.org) standard and pymatgen Structure objects.
The code is adapted from the optimade.adapters.structures.pymatgen module in optimade-python-tools (https://github.com/Materials-Consortia/optimade-python-tools), and aims to work without requiring the explicit installation of the optimade-python-tools.
- class OptimadeStructureAdapter[source]
Bases:
object
Adapter serves as a bridge between OPTIMADE structures and pymatgen objects.
- static get_optimade_structure(structure: Structure, **kwargs) dict[str, str | dict[str, Any]] [source]
Get a dictionary in the OPTIMADE Structure format from a pymatgen structure or molecule.
- Parameters:
structure (Structure) – pymatgen Structure
**kwargs – passed to the ASE Atoms constructor
- Returns:
A dictionary serialization of the structure in the OPTIMADE format.
- static get_structure(resource: dict) Structure [source]
Get pymatgen structure from an OPTIMADE structure resource.
- Parameters:
resource – OPTIMADE structure resource as a dictionary, JSON string, or the corresponding attributes dictionary (i.e., resource[“attributes”]).
- Returns:
Equivalent pymatgen Structure
- Return type:
pymatgen.io.packmol module
This module provides a pymatgen I/O interface to PACKMOL.
PackmolSet provides a “run” method to run PACKMOL locally.
PackmolBoxGen provides “get_input_set” for packing molecules into a box,
which returns a PackmolSet object.
For the run() method to work, you need to install the PACKMOL package. See https://m3g.iqm.unicamp.br/packmol for download and setup instructions. After installation, you may need to add the path of the PACKMOL executable to the PATH environment variable.
Note that PACKMOL versions prior to 20.3.0 do not support paths with spaces.
- class PackmolBoxGen(tolerance: float = 2.0, seed: int = 1, control_params: dict | None = None, inputfile: PathLike = 'packmol.inp', outputfile: PathLike = 'packmol_out.xyz', stdoutfile: PathLike = 'packmol.stdout')[source]
Bases:
InputGenerator
Generator for a Packmol InputSet that packs one or more molecules into a rectangular simulation box.
Instantiate a PackmolBoxGen class. The init method defines simulations parameters like filenames, random seed, tolerance, etc.
- Parameters:
tolerance (float) – Tolerance for packmol, in Å.
seed (int) – Random seed for packmol. Use 1 (default) for deterministic output, or -1 to generate a new random seed from the current time.
inputfile (PathLike) – Path to the input file. Default to “packmol.inp”.
outputfile (PathLike) – Path to the output file. Default to “packmol_out.xyz”.
stdoutfile (PathLike) – Path to the file where stdout will be recorded. Default to “packmol.stdout”.
- get_input_set(molecules: list[dict], box: list[float] | None = None) PackmolSet [source]
Generate a Packmol InputSet for a set of molecules.
- Parameters:
molecules (list[dict]) –
Information about molecules to pack into the box. Each dict requires three keys:
”name” - the structure name.
”number” - the number of that molecule to pack into the box.
- ”coords” - Coordinates in the form of either a Molecule
object or a path to a file.
Example
- {
“name”: “water”, “number”: 500, “coords”: “/path/to/input/file.xyz”,
}
box (list[float]) – Box dimensions xlo, ylo, zlo, xhi, yhi, zhi, in Å. If set to None (default), pymatgen will estimate the required box size based on the volumes of the provided molecules.
- Returns:
PackmolSet
- class PackmolSet(inputs: dict[PathLike, str | InputFile] | None = None, **kwargs)[source]
Bases:
InputSet
InputSet for the PACKMOL software. This class defines several attributes related to.
Instantiate an InputSet.
- Parameters:
inputs – The core mapping of filename: file contents that defines the InputSet data. This should be a dict where keys are filenames and values are InputFile objects or strings representing the entire contents of the file. If a value is not an InputFile object nor a str, but has a __str__ method, this str representation of the object will be written to the corresponding file. This mapping will become the .inputs attribute of the InputSet.
**kwargs – Any kwargs passed will be set as class attributes e.g. InputSet(inputs={}, foo=’bar’) will make InputSet.foo == ‘bar’.
- classmethod from_directory(directory: PathLike) None [source]
Construct an InputSet from a directory of one or more files.
- Parameters:
directory (PathLike) – Directory to read input files from.
- run(path: PathLike, timeout: float = 30) None [source]
Run PACKMOL and write out the packed structure.
- Parameters:
path (PathLike) – The path in which packmol input files are located.
timeout (float) – Timeout in seconds.
- Raises:
ValueError – if packmol does not succeed in packing the box.
TimeoutExpiredError – if packmol does not finish within the timeout.
pymatgen.io.phonopy module
Module for interfacing with phonopy, see https://atztogo.github.io/phonopy/.
- eigvec_to_eigdispl(eig_vec, q, frac_coords, mass)[source]
Converts a single eigenvector to an eigendisplacement in the primitive cell according to the formula:
exp(2*pi*i*(frac_coords dot q) / sqrt(mass) * v
Compared to the modulation option in phonopy, here all the additional multiplicative and phase factors are set to 1.
- Parameters:
v – the vector that should be converted. A 3D complex numpy array.
q – the q point in fractional coordinates
frac_coords – the fractional coordinates of the atom
mass – the mass of the atom
- get_complete_ph_dos(partial_dos_path, phonopy_yaml_path)[source]
Create a pymatgen CompletePhononDos from a partial_dos.dat and phonopy.yaml files. The second is produced when generating a Dos and is needed to extract the structure.
- Parameters:
partial_dos_path – path to the partial_dos.dat file.
phonopy_yaml_path – path to the phonopy.yaml file.
- get_displaced_structures(pmg_structure, atom_disp=0.01, supercell_matrix=None, yaml_fname=None, **kwargs)[source]
Generate a set of symmetrically inequivalent displaced structures for phonon calculations.
- Parameters:
pmg_structure (Structure) – A pymatgen structure object.
atom_disp (float) – Atomic displacement. Default is 0.01 $\AA$.
supercell_matrix (3x3 array) – Scaling matrix for supercell.
yaml_fname (str) – If not None, it represents the full path to the outputting displacement YAML file, e.g. disp.yaml.
**kwargs – Parameters used in Phonopy.generate_displacement method.
- Returns:
A list of symmetrically inequivalent structures with displacements, in which the first element is the perfect supercell structure.
- get_gruneisen_ph_bs_symm_line(gruneisen_path, structure=None, structure_path=None, labels_dict=None, fit=False)[source]
Create a pymatgen GruneisenPhononBandStructure from a band.yaml file. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula: \exp(2*pi*i*(frac_coords \dot q) / sqrt(mass) * v
and added to the object.
- Parameters:
gruneisen_path – path to the band.yaml file
structure – pymaten Structure object
structure_path – path to a structure file (e.g., POSCAR)
labels_dict – dict that links a qpoint in frac coords to a label.
fit – Substitute Grueneisen parameters close to the gamma point with points obtained from a fit to a spline if the derivate from a smooth curve (i.e. if the slope changes by more than 200% in the range of 10% around the gamma point). These derivations occur because of very small frequencies (and therefore numerical inaccuracies) close to gamma.
- get_gruneisenparameter(gruneisen_path, structure=None, structure_path=None) GruneisenParameter [source]
Get Gruneisen object from gruneisen.yaml file, as obtained from phonopy (Frequencies in THz!). The order is structure > structure path > structure from gruneisen dict. Newer versions of phonopy include the structure in the YAML file, the structure/structure_path is kept for compatibility.
- Parameters:
gruneisen_path – Path to gruneisen.yaml file (frequencies have to be in THz!)
structure – pymatgen Structure object
structure_path – path to structure in a file (e.g., POSCAR)
- Returns:
GruneisenParameter
- get_gs_ph_bs_symm_line_from_dict(gruneisen_dict, structure=None, structure_path=None, labels_dict=None, fit=False) GruneisenPhononBandStructureSymmLine [source]
Create a pymatgen GruneisenPhononBandStructure object from the dictionary extracted by the gruneisen.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula:
exp(2*pi*i*(frac_coords \dot q) / sqrt(mass) * v
and added to the object. A fit algorithm can be used to replace diverging Gruneisen values close to gamma.
- Parameters:
gruneisen_dict (dict) – the dictionary extracted from the gruneisen.yaml file
structure (Structure) – pymatgen structure object
structure_path – path to structure file
labels_dict (dict) – dict that links a qpoint in frac coords to a label. Its value will replace the data contained in the band.yaml.
fit (bool) – Substitute Grueneisen parameters close to the gamma point with points obtained from a fit to a spline if the derivate from a smooth curve (i.e. if the slope changes by more than 200% in the range of 10% around the gamma point). These derivations occur because of very small frequencies (and therefore numerical inaccuracies) close to gamma.
- get_ph_bs_symm_line(bands_path, has_nac=False, labels_dict=None)[source]
Create a pymatgen PhononBandStructure from a band.yaml file. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula: \exp(2*pi*i*(frac_coords \dot q) / sqrt(mass) * v
and added to the object.
- Parameters:
bands_path – path to the band.yaml file
has_nac – True if the data have been obtained with the option –nac option. Default False.
labels_dict – dict that links a q-point in frac coords to a label.
- get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None) PhononBandStructureSymmLine [source]
Create a pymatgen PhononBandStructure object from the dictionary extracted by the band.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the ‘eigenvector’ key is found the eigendisplacements will be calculated according to the formula:
exp(2*pi*i*(frac_coords \dot q) / sqrt(mass) * v
and added to the object.
- Parameters:
bands_dict – the dictionary extracted from the band.yaml file
has_nac – True if the data have been obtained with the option –nac option. Default False.
labels_dict – dict that links a qpoint in frac coords to a label. Its value will replace the data contained in the band.yaml.
- Returns:
the phonon band structure
- Return type:
- get_ph_dos(total_dos_path)[source]
Create a pymatgen PhononDos from a total_dos.dat file.
- Parameters:
total_dos_path – path to the total_dos.dat file.
- get_phonon_band_structure_from_fc(structure: Structure, supercell_matrix: ndarray, force_constants: ndarray, mesh_density: float = 100.0, **kwargs) PhononBandStructure [source]
Get a uniform phonon band structure from phonopy force constants.
- Parameters:
structure – A structure.
supercell_matrix – The supercell matrix used to generate the force constants.
force_constants – The force constants in phonopy format.
mesh_density – The density of the q-point mesh. See the docstring for the
mesh
argument in Phonopy.init_mesh() for more details.**kwargs – Additional kwargs passed to the Phonopy constructor.
- Returns:
The uniform phonon band structure.
- get_phonon_band_structure_symm_line_from_fc(structure: Structure, supercell_matrix: ndarray, force_constants: ndarray, line_density: float = 20.0, symprec: float = 0.01, **kwargs) PhononBandStructureSymmLine [source]
Get a phonon band structure along a high symmetry path from phonopy force constants.
- Parameters:
structure – A structure.
supercell_matrix – The supercell matrix used to generate the force constants.
force_constants – The force constants in phonopy format.
line_density – The density along the high symmetry path.
symprec – Symmetry precision passed to phonopy and used for determining the band structure path.
**kwargs – Additional kwargs passed to the Phonopy constructor.
- Returns:
The line mode band structure.
- get_phonon_dos_from_fc(structure: Structure, supercell_matrix: ndarray, force_constants: ndarray, mesh_density: float = 100.0, num_dos_steps: int = 200, **kwargs) CompletePhononDos [source]
Get a projected phonon density of states from phonopy force constants.
- Parameters:
structure – A structure.
supercell_matrix – The supercell matrix used to generate the force constants.
force_constants – The force constants in phonopy format.
mesh_density – The density of the q-point mesh. See the docstring for the
mesh
argument in Phonopy.init_mesh() for more details.num_dos_steps – Number of frequency steps in the energy grid.
**kwargs – Additional kwargs passed to the Phonopy constructor.
- Returns:
The density of states.
- get_phonopy_structure(pmg_structure: Structure) PhonopyAtoms [source]
Convert a pymatgen Structure object to a PhonopyAtoms object.
- Parameters:
pmg_structure (pymatgen Structure) – A Pymatgen structure object.
- get_pmg_structure(phonopy_structure: PhonopyAtoms) Structure [source]
Convert a PhonopyAtoms object to pymatgen Structure object.
- Parameters:
phonopy_structure (PhonopyAtoms) – A phonopy structure object.
- get_structure_from_dict(dct) Structure [source]
Extracts a structure from the dictionary extracted from the output files of phonopy like phonopy.yaml or band.yaml. Adds “phonopy_masses” in the site_properties of the structures. Compatible with older phonopy versions.
- get_thermal_displacement_matrices(thermal_displacements_yaml='thermal_displacement_matrices.yaml', structure_path='POSCAR')[source]
Read “thermal_displacement_matrices.yaml” from phonopy and return a list of ThermalDisplacementMatrices objects.
- Parameters:
thermal_displacements_yaml – path to thermal_displacement_matrices.yaml
structure_path – path to POSCAR.
- Returns:
list[ThermalDisplacementMatrices]
pymatgen.io.prismatic module
Write Prismatic (https://prism-em.com) input files.
- class Prismatic(structure: Structure, comment: str = 'Generated by pymatgen')[source]
Bases:
object
Write Prismatic (https://prism-em.com) input files. This is designed for STEM image simulation.
- Parameters:
structure – pymatgen Structure
comment (str) – comment.
pymatgen.io.pwscf module
This module implements input and output processing from PWSCF.
- class PWInput(structure, pseudo=None, control=None, system=None, electrons=None, ions=None, cell=None, kpoints_mode='automatic', kpoints_grid=(1, 1, 1), kpoints_shift=(0, 0, 0), format_options=None)[source]
Bases:
object
Base input file class. Right now, only supports no symmetry and is very basic.
Initialize a PWSCF input file.
- Parameters:
structure (Structure) – Input structure. For spin-polarized calculation, properties (e.g. {“starting_magnetization”: -0.5, “pseudo”: “Mn.pbe-sp-van.UPF”}) on each site is needed instead of pseudo (dict).
pseudo (dict) – A dict of the pseudopotentials to use. Default to None.
control (dict) – Control parameters. Refer to official PWSCF doc on supported parameters. Default to {“calculation”: “scf”}
system (dict) – System parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
electrons (dict) – Electron parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
ions (dict) – Ions parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
cell (dict) – Cell parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
kpoints_mode (str) – Kpoints generation mode. Default to automatic.
kpoints_grid (sequence) – The kpoint grid. Default to (1, 1, 1).
kpoints_shift (sequence) – The shift for the kpoints. Defaults to (0, 0, 0).
format_options (dict) –
Formatting options when writing into a string. Can be used to specify e.g., the number of decimal places (including trailing zeros) for real-space coordinate values (atomic positions, cell parameters). Defaults to None, in which case the following default values are used (so as to maintain backwards compatibility): {“indent”: 2, “kpoints_crystal_b_indent”: 1,
”coord_decimals”: 6, “atomic_mass_decimals”: 4, “kpoints_grid_decimals”: 4}.
- classmethod from_dict(dct: dict) Self [source]
Load a PWInput object from a dictionary.
- Parameters:
dct (dict) – dictionary with PWInput data
- Returns:
PWInput object
- classmethod from_file(filename: str | Path) Self [source]
Reads an PWInput object from a file.
- Parameters:
filename (str | Path) – Filename for file
- Returns:
PWInput object
- classmethod from_str(string: str) Self [source]
Reads an PWInput object from a string.
- Parameters:
string (str) – PWInput string
- Returns:
PWInput object
- class PWOutput(filename)[source]
Bases:
object
Parser for PWSCF output file.
- Parameters:
filename (str) – Filename.
- patterns: ClassVar[dict[str, str]] = {'celldm1': 'celldm\\(1\\)=\\s+([\\d\\.]+)\\s', 'celldm2': 'celldm\\(2\\)=\\s+([\\d\\.]+)\\s', 'celldm3': 'celldm\\(3\\)=\\s+([\\d\\.]+)\\s', 'celldm4': 'celldm\\(4\\)=\\s+([\\d\\.]+)\\s', 'celldm5': 'celldm\\(5\\)=\\s+([\\d\\.]+)\\s', 'celldm6': 'celldm\\(6\\)=\\s+([\\d\\.]+)\\s', 'ecut': 'kinetic\\-energy cutoff\\s+=\\s+([\\d\\.\\-]+)\\s+Ry', 'energies': 'total energy\\s+=\\s+([\\d\\.\\-]+)\\sRy', 'lattice_type': 'bravais\\-lattice index\\s+=\\s+(\\d+)', 'nkpts': 'number of k points=\\s+([\\d]+)'}[source]
- read_pattern(patterns, reverse=False, terminate_on_match=False, postprocess=<class 'str'>)[source]
General pattern reading. Uses monty’s regrep method. Takes the same arguments.
- Parameters:
patterns (dict) – A dict of patterns, e.g. {“energy”: r”energy\(sigma->0\)\s+=\s+([\d\-.]+)”}.
reverse (bool) – Read files in reverse. Defaults to false. Useful for large files, esp OUTCARs, especially when used with terminate_on_match.
terminate_on_match (bool) – Whether to terminate when there is at least one match in each key in pattern.
postprocess (callable) – A post processing function to convert all matches. Defaults to str, i.e., no change.
- Renders accessible:
Any attribute in patterns. For example, {“energy”: r”energy\(sigma->0\)\s+=\s+([\d\-.]+)”} will set the value of self.data[“energy”] = [[-1234], [-3453], …], to the results from regex and postprocess. Note that the returned values are lists of lists, because you can grep multiple items on one line.
pymatgen.io.res module
Provides parsing and read/write support for ShelX .res files as produced by the AIRSS code.
Converting from and back to pymatgen objects is expected to be reversible, i.e. you should get the same Structure or ComputedStructureEntry back. On the other hand, converting from and back to a string/file is not guaranteed to be reversible, i.e. a diff on the output would not be empty. The difference should be limited to whitespace, float precision, and the REM entries.
- class AirssProvider(res: Res, parse_rems: Literal['gentle', 'strict'] = 'gentle')[source]
Bases:
ResProvider
Provides access to the res file as does ResProvider. This class additionally provides access to fields in the TITL entry and various other fields found in the REM entries that AIRSS puts in the file. Values in the TITL entry that AIRSS could not get end up as 0. If the TITL entry is malformed, empty, or missing then attempting to construct this class from a res file will raise a ResError.
While AIRSS supports a number of geometry and energy solvers, CASTEP is the default. As such, fetching the information from the REM entries is only supported if AIRSS was used with CASTEP. The other properties that get put in the TITL should still be accessible even if CASTEP was not used.
The
parse_rems
attribute controls whether functions that fail to retrieve information from the REM entries should returnNone
. If this is set to"strict"
, then a ParseError may be raised, but the return value will not beNone
. If it is set to"gentle"
, thenNone
will be returned instead of raising an exception. This setting applies to all methods of this class that are typed to return an Optional type. Default is"gentle"
.The
from_str()
andfrom_file()
methods should be used instead of constructing this directly.- property appearances: int[source]
This is sometimes the number of times a structure was found in an AIRSS search. Using the cryan tool that comes with AIRSS may be a better approach than relying on this property.
- as_dict(verbose: bool = True) dict[str, Any] [source]
Get dict with title fields, structure and rems of this AirssProvider.
- property energy: float[source]
Energy of the structure. With CASTEP, this is usually the enthalpy and is in eV.
- property entry: ComputedStructureEntry[source]
This res file as a ComputedStructureEntry.
- classmethod from_file(filename: str | Path, parse_rems: Literal['gentle', 'strict'] = 'gentle') Self [source]
Construct a Provider from a file.
- classmethod from_str(string: str, parse_rems: Literal['gentle', 'strict'] = 'gentle') Self [source]
Construct a Provider from a string.
- get_airss_version() tuple[str, date] | None [source]
Retrieves the version of AIRSS that was used along with the build date (not compile date).
- Returns:
tuple[str, date] (version string, date)
- get_castep_version() str | None [source]
Retrieves the version of CASTEP that the res file was computed with from the REM entries.
- Returns:
version string
- get_cut_grid_gmax_fsbc() tuple[float, float, float, str] | None [source]
Retrieves the cut-off energy, grid scale, Gmax, and finite basis set correction setting from the REM entries.
- Returns:
(cut-off, grid scale, Gmax, fsbc)
- Return type:
tuple[float, float, float, str]
- get_func_rel_disp() tuple[str, str, str] | None [source]
Retrieves the functional, relativity scheme, and dispersion correction from the REM entries.
- Returns:
(functional, relativity, dispersion)
- Return type:
tuple[str, str, str]
- get_mpgrid_offset_nkpts_spacing() tuple[Tuple3Ints, Vector3D, int, float] | None [source]
Retrieves the MP grid, the grid offsets, number of kpoints, and maximum kpoint spacing.
- Returns:
(MP grid), (offsets), No. kpts, max spacing)
- Return type:
tuple[tuple[int, int, int], Vector3D, int, float]
- get_pspots() dict[str, str] [source]
Retrieves the OTFG pseudopotential string that can be used to generate the pseudopotentials used in the calculation.
- Returns:
dict[specie, potential]
- get_run_start_info() tuple[date, str] | None [source]
Retrieves the run start date and the path it was started in from the REM entries.
- Returns:
(date, path)
- Return type:
tuple[date, str]
- property integrated_absolute_spin_density: float[source]
Corresponds to the last
Integrated |Spin Density|
in the CASTEP file.
- property integrated_spin_density: float[source]
Corresponds to the last
Integrated Spin Density
in the CASTEP file.
- class AirssTITL(seed: 'str', pressure: 'float', volume: 'float', energy: 'float', integrated_spin_density: 'float', integrated_absolute_spin_density: 'float', spacegroup_label: 'str', appearances: 'int')[source]
Bases:
object
- class Ion(specie: 'str', specie_num: 'int', pos: 'Vector3D', occupancy: 'float', spin: 'float | None')[source]
Bases:
object
- class Res(TITL: AirssTITL | None, REMS: list[str], CELL: ResCELL, SFAC: ResSFAC)[source]
Bases:
object
Representation for the data in a res file.
- class ResCELL(unknown_field_1: 'float', a: 'float', b: 'float', c: 'float', alpha: 'float', beta: 'float', gamma: 'float')[source]
Bases:
object
- exception ResError[source]
Bases:
ValueError
This exception indicates a problem was encountered while trying to retrieve a value or perform an action that a provider for the res file does not support.
- class ResIO[source]
Bases:
object
Convenience methods for converting a Structure or ComputedStructureEntry to/from a string or file in the res format as used by AIRSS.
Note: Converting from and back to pymatgen objects is expected to be reversible, i.e. you should get the same Structure or ComputedStructureEntry back. On the other hand, converting from and back to a string/file is not guaranteed to be reversible, i.e. a diff on the output would not be empty. The difference should be limited to whitespace, float precision, and the REM entries.
If the TITL entry doesn’t exist or is malformed or empty, then you can only get a Structure. Attempting to get an Entry will raise a ResError.
- classmethod entry_from_file(filename: str) ComputedStructureEntry [source]
Produce a pymatgen ComputedStructureEntry from a res file.
- classmethod entry_from_str(string: str) ComputedStructureEntry [source]
Produce a pymatgen ComputedStructureEntry from contents of a res file.
- classmethod entry_to_file(entry: ComputedStructureEntry, filename: str) None [source]
Write a pymatgen ComputedStructureEntry to a res file.
- classmethod entry_to_str(entry: ComputedStructureEntry) str [source]
Produce the contents of a res file from a pymatgen ComputedStructureEntry.
- classmethod structure_from_file(filename: str) Structure [source]
Produces a pymatgen Structure from a res file.
- classmethod structure_from_str(string: str) Structure [source]
Produces a pymatgen Structure from contents of a res file.
- exception ResParseError[source]
Bases:
ParseError
This exception indicates a problem was encountered during parsing due to unexpected formatting.
- class ResProvider(res: Res)[source]
Bases:
MSONable
Access elements of the RES file as familiar pymatgen objects.
The
from_str()
andfrom_file()
methods should be used instead of constructing this directly.- property sites: list[PeriodicSite][source]
Construct a list of PeriodicSites from the res file.
- class ResWriter(entry: Structure | ComputedStructureEntry)[source]
Bases:
object
This class provides a means to write a Structure or ComputedStructureEntry to a res file.
This class can be constructed from either a pymatgen Structure or ComputedStructureEntry object.
pymatgen.io.shengbte module
This module implements reading and writing of ShengBTE CONTROL files.
- class Control(ngrid: list[int] | None = None, temperature: float | dict[str, float] = 300, **kwargs)[source]
Bases:
MSONable
,dict
Read, update, and write ShengBTE CONTROL files. See https://bitbucket.org/sousaw/shengbte/src/master/ for more detailed description and default values of CONTROL arguments.
- Parameters:
ngrid – Reciprocal space grid density as a list of 3 ints.
temperature – The temperature to calculate the lattice thermal conductivity for. Can be given as a single float, or a dictionary with the keys “min”, “max”, “step”.
**kwargs –
Other ShengBTE parameters. Several parameters are required for ShengBTE to run - we have listed these parameters below: - nelements (int): number of different elements in the compound - natoms (int): number of atoms in the unit cell - lattvec (size 3x3 array): real-space lattice vectors, in units of lfactor - lfactor (float): unit of measurement for lattice vectors (nm).
I.e., set to 0.1 if lattvec given in Angstrom.
types (size natom list): a vector of natom integers, ranging from 1 to nelements, assigning an element to each atom in the system
elements (size natom list): a vector of element names
positions (size natomx3 array): atomic positions in lattice coordinates
scell (size 3 list): supercell sizes along each crystal axis used for the 2nd-order force constant calculation.
- crystal_keys = ('lfactor', 'lattvec', 'types', 'elements', 'positions', 'masses', 'gfactors', 'epsilon', 'born', 'scell', 'orientations')[source]
- data_keys = ('nelements', 'natoms', 'ngrid', 'lattvec', 'types', 'elements', 'positions', 'scell')[source]
- flags_keys = ('nonanalytic', 'convergence', 'isotopes', 'autoisotopes', 'nanowires', 'onlyharmonic', 'espresso')[source]
- classmethod from_dict(control_dict: dict) Self [source]
Write a CONTROL file from a Python dictionary. Description and default parameters can be found at https://bitbucket.org/sousaw/shengbte/src/master/. Note some parameters are mandatory. Optional parameters default here to None and will not be written to file.
- Parameters:
control_dict – A Python dictionary of ShengBTE input parameters.
- classmethod from_file(filepath: str) Self [source]
Read a CONTROL namelist file and output a ‘Control’ object.
- Parameters:
filepath – Path of the CONTROL file.
- Returns:
‘Control’ object with parameters instantiated.
- classmethod from_structure(structure: Structure, reciprocal_density: int | None = 50000, **kwargs) Self [source]
Get a ShengBTE control object from a structure.
- Parameters:
structure – A structure object.
reciprocal_density – If not None, the q-point grid (“ngrid”) will be set using this density.
kwargs – Additional options to be passed to the Control constructor. See the docstring of the __init__ method for more details
- Returns:
A ShengBTE control object.
- get_structure() Structure [source]
Get a pymatgen Structure from a ShengBTE control object.
The control object must have the “lattvec”, “types”, “elements”, and “positions” settings otherwise an error will be thrown.
- Returns:
The structure.
- params_keys = ('t', 't_min', 't_max', 't_step', 'omega_max', 'scalebroad', 'rmin', 'rmax', 'dr', 'maxiter', 'nticks', 'eps')[source]
pymatgen.io.template module
This module defines a simple concrete implementation of the InputGenerator class that can be used to facilitate writing large numbers of input files based on a template.
- class TemplateInputGen[source]
Bases:
InputGenerator
Concrete implementation of InputGenerator that is based on a single template input file with variables.
This class is provided as a low-barrier way to support new codes and to provide an intuitive way for users to transition from manual scripts to pymatgen I/O classes.
- get_input_set(template: PathLike, variables: dict | None = None, filename: PathLike = 'input.txt') InputSet [source]
- Parameters:
template – the input file template containing variable strings to be replaced.
variables – dict of variables to replace in the template. Keys are the text to replaced with the values, e.g. {“TEMPERATURE”: 298} will replace the text $TEMPERATURE in the template. See Python’s Template.safe_substitute() method documentation for more details.
filename – the file to be written.
pymatgen.io.wannier90 module
Modules for working with wannier90 input and output.
- class Unk(ik: int, data: ndarray)[source]
Bases:
object
Object representing the data in a UNK file.
- data[source]
Numpy array that contains the wavefunction data in the UNK file. The shape should be (nbnd, ngx, ngy, ngz) for regular calculations and (nbnd, 2, ngx, ngy, ngz) for noncollinear calculations.
- Type:
numpy.ndarray
- ng[source]
Sequence of three integers that correspond to the grid size of the given data. The definition is ng = (ngx, ngy, ngz).
- Type:
tuple
Initialize Unk class.
- Parameters:
ik (int) – index of the kpoint UNK file is for
data (np.ndarray) – data from the UNK file that has shape (nbnd, ngx, ngy, ngz) or (nbnd, 2, ngx, ngy, ngz) if noncollinear
- property data: ndarray[source]
contains the wavefunction data in the UNK file. The shape should be (nbnd, ngx, ngy, ngz) for regular calculations and (nbnd, 2, ngx, ngy, ngz) for noncollinear calculations.
- Type:
np.ndarray
pymatgen.io.xcrysden module
Support for reading XCrysDen files.
- class XSF(structure: Structure)[source]
Bases:
object
Parse XCrysden files.
- Parameters:
structure (Structure) – Structure object.
- classmethod from_str(input_string: str, cls_=None) Self [source]
Initialize a Structure object from a string with data in XSF format.
- Parameters:
input_string – String with the structure in XSF format. See http://www.xcrysden.org/doc/XSF.html
cls – Structure class to be created. default: pymatgen structure
- Example file:
CRYSTAL see (1) these are primitive lattice vectors (in Angstroms) PRIMVEC 0.0000000 2.7100000 2.7100000 see (2) 2.7100000 0.0000000 2.7100000 2.7100000 2.7100000 0.0000000
these are conventional lattice vectors (in Angstroms) CONVVEC 5.4200000 0.0000000 0.0000000 see (3) 0.0000000 5.4200000 0.0000000 0.0000000 0.0000000 5.4200000
these are atomic coordinates in a primitive unit cell (in Angstroms) PRIMCOORD 2 1 see (4) 16 0.0000000 0.0000000 0.0000000 see (5) 30 1.3550000 -1.3550000 -1.3550000
- to_str(atom_symbol: bool = True) str [source]
Get a string with the structure in XSF format See http://www.xcrysden.org/doc/XSF.html.
- Parameters:
atom_symbol (bool) – Uses atom symbol instead of atomic number. Defaults to True.
pymatgen.io.xr module
This module provides input and output mechanisms for the xr file format, which is a modified CSSR file format and, for example, used in GULP. In particular, the module makes it easy to remove shell positions from relaxations that employed core-shell models.
- class Xr(structure: Structure)[source]
Bases:
object
For working with XR files.
- Parameters:
structure (Structure | IStructure) – Structure object to create the Xr object.
- classmethod from_file(filename: str | Path, use_cores: bool = True, thresh: float = 0.0001) Self [source]
Reads an xr-formatted file to create an Xr object.
- Parameters:
filename (str) – name of file to read from.
use_cores (bool) – use core positions and discard shell positions if set to True (default). Otherwise, use shell positions and discard core positions.
thresh (float) – relative threshold for consistency check between cell parameters (lengths and angles) from header information and cell vectors, respectively.
- Returns:
- Xr object corresponding to the input
file.
- Return type:
xr (Xr)
- classmethod from_str(string: str, use_cores: bool = True, thresh: float = 0.0001) Self [source]
Creates an Xr object from a string representation.
- Parameters:
string (str) – string representation of an Xr object.
use_cores (bool) – use core positions and discard shell positions if set to True (default). Otherwise, use shell positions and discard core positions.
thresh (float) – relative threshold for consistency check between cell parameters (lengths and angles) from header information and cell vectors, respectively.
- Returns:
- Xr object corresponding to the input
string representation.
- Return type:
xr (Xr)
pymatgen.io.xyz module
Module implementing an XYZ file object class.
- class XYZ(mol: Molecule | Structure | Sequence[Molecule | Structure], coord_precision: int = 6)[source]
Bases:
object
Basic class for importing and exporting Molecules or Structures in XYZ format.
Note
Exporting periodic structures in the XYZ format will lose information about the periodicity. Essentially, only Cartesian coordinates are written in this format and no information is retained about the lattice.
- Parameters:
- property all_molecules: list[Molecule][source]
All the frames of molecule associated with this XYZ.
- as_dataframe()[source]
Generate a coordinates data frame with columns: atom, x, y, and z In case of multiple frame XYZ, returns the last frame.
- Returns:
pandas.DataFrame
- classmethod from_file(filename: str | Path) Self [source]
Creates XYZ object from a file.
- Parameters:
filename – XYZ filename
- Returns:
XYZ object
- classmethod from_str(contents: str) Self [source]
Creates XYZ object from a string.
- Parameters:
contents – String representing an XYZ file.
- Returns:
XYZ object
pymatgen.io.zeopp module
Module implementing classes and functions to use Zeo++ by Maciej Haranczyk.
If using this module, cite the following paper on Zeo++: T.F. Willems, C.H. Rycroft, M. Kazi, J.C. Meza, and M. Haranczyk, Algorithms and tools for high-throughput geometry-based analysis of crystalline porous materials, Microporous and Mesoporous Materials, 149 (2012) 134-141.
Zeo++ Installation Steps:
A stable version of Zeo++ can be obtained from https://zeoplusplus.org. Instructions can be found at https://www.zeoplusplus.org/download.html
Zeo++ Post-Installation Checking:
Go to pymatgen/io/tests and run “python test_zeoio.py” If Zeo++ python bindings are properly installed, the tests should pass. One or two tests will be skipped.
Go to pymatgen/analysis/defects/tests and run “python test_point_defects.py”. Lots of tests will be skipped if GULP is not installed. But there should be no errors.
- class ZeoCssr(structure: Structure)[source]
Bases:
Cssr
ZeoCssr adds extra fields to CSSR sites to conform with Zeo++ input CSSR format. The coordinate system is rotated from xyz to zyx. This change aligns the pivot axis of pymatgen (z-axis) to pivot axis of Zeo++ (x-axis) for structural modifications.
- Parameters:
structure – A structure to create ZeoCssr object.
- class ZeoVoronoiXYZ(mol)[source]
Bases:
XYZ
Read Voronoi Nodes from XYZ file written by Zeo++. The sites have an additional column representing the voronoi node radius. The voronoi node radius is represented by the site property voronoi_radius.
- Parameters:
mol – Input molecule holding the voronoi node information.
- get_free_sphere_params(structure, rad_dict=None, probe_rad=0.1)[source]
Analyze the void space in the input structure using voronoi decomposition Calls Zeo++ for Voronoi decomposition.
- Parameters:
structure – pymatgen Structure
rad_dict (optional) – Dictionary of radii of elements in structure. If not given, Zeo++ default values are used. Note: Zeo++ uses atomic radii of elements. For ionic structures, pass rad_dict with ionic radii
probe_rad (optional) – Sampling probe radius in Angstroms. Default is 0.1 A
- Returns:
voronoi nodes as pymatgen Structure within the unit cell defined by the lattice of input structure voronoi face centers as pymatgen Structure within the unit cell defined by the lattice of input structure
- get_high_accuracy_voronoi_nodes(structure, rad_dict, probe_rad=0.1)[source]
Analyze the void space in the input structure using high accuracy voronoi decomposition. Calls Zeo++ for Voronoi decomposition.
- Parameters:
structure – pymatgen Structure
rad_dict (optional) – Dictionary of radii of elements in structure. If not given, Zeo++ default values are used. Note: Zeo++ uses atomic radii of elements. For ionic structures, pass rad_dict with ionic radii
probe_rad (optional) – Sampling probe radius in Angstroms. Default is 0.1 A
- Returns:
voronoi nodes as pymatgen Structure within the unit cell defined by the lattice of input structure voronoi face centers as pymatgen Structure within the unit cell defined by the lattice of input structure
- get_voronoi_nodes(structure, rad_dict=None, probe_rad=0.1)[source]
Analyze the void space in the input structure using voronoi decomposition Calls Zeo++ for Voronoi decomposition.
- Parameters:
structure – pymatgen Structure
rad_dict (optional) – Dictionary of radii of elements in structure. If not given, Zeo++ default values are used. Note: Zeo++ uses atomic radii of elements. For ionic structures, pass rad_dict with ionic radii
probe_rad (optional) – Sampling probe radius in Angstroms. Default is 0.1 A
- Returns:
voronoi nodes as pymatgen Structure within the unit cell defined by the lattice of input structure voronoi face centers as pymatgen Structure within the unit cell defined by the lattice of input structure