本文整理汇总了Python中pymatgen.io.vasp.inputs.Poscar.as_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Poscar.as_dict方法的具体用法?Python Poscar.as_dict怎么用?Python Poscar.as_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.vasp.inputs.Poscar
的用法示例。
在下文中一共展示了Poscar.as_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Calibrate
# 需要导入模块: from pymatgen.io.vasp.inputs import Poscar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Poscar import as_dict [as 别名]
class Calibrate(PMGSONable):
"""
The base class for creating vasp work flows for
calibrating the input parameters for different systems
A wrapper around Custodian
"""
LOG_FILE = "calibrate.json"
def __init__(self, incar, poscar, potcar, kpoints, system=None,
is_matrix = False, Grid_type = 'A',
parent_job_dir='.',job_dir='Job',
qadapter=None, job_cmd='qsub', wait=True,
mappings_override = None, functional="PBE",
turn_knobs=OrderedDict( [ ('ENCUT',[]),
('KPOINTS',[])] ),
checkpoint_file=None, cal_logger=None):
"""
Calibrate constructor
Args:
incar (Incar object): input INCAR
poscar (Poscar object): input POSCAR
potcar (Potcar object): input POTCAR
kpoints: input KPOINTS
system: system info as a dictionary,
slab or interface example:
system={'hkl':[1,1,1], 'ligand':None},
is_matrix (bool): whether the jobs are dependent on each
other
Grid_type: kpoints grid_type
parent_job_dir: the directory from which all the jobs are
launched
job_dir: job directory
qadapter: adapter for the batch system
job_cmd: command to be used for submitting the job. If
qadapter is specified then job_cmd is ignored
wait: whther to wait for the job to finish. If the job is
being submitted to the queue then there is no need for
waiting
turn_knobs: an ordered dictionary of parmaters and the
corresponding values
mappings_override: override symbol mapping in potcar
eg:- {'S':'S_sv'}
functional: exchange-correlation functional
Note: input structure if needed will be obtained from the
provided poscar object
"""
self.name = datetime.datetime.now().isoformat()
self.system = system
self.parent_job_dir = os.path.abspath(parent_job_dir)
self.job_dir = job_dir
self.incar = incar
self.poscar = poscar
self.potcar = potcar
if poscar:
self.potcar = Potcar(symbols=poscar.site_symbols,
functional=functional)
self.kpoints = kpoints
if incar:
self.incar_orig = incar.as_dict()
if poscar:
self.poscar_orig = poscar.as_dict()
if self.potcar:
self.potcar_orig = self.potcar.as_dict()
if kpoints:
self.kpoints_orig = kpoints.as_dict()
self.qadapter = qadapter
self.job_dir_list = []
self.jobs = []
self.job_ids = []
self.handlers = []
self.job_cmd = job_cmd
self.n_atoms = 0
self.turn_knobs = turn_knobs
self.response_to_knobs = {}
self.sorted_response_to_knobs = {}
for k, v in turn_knobs.items():
self.response_to_knobs[k] = {}
self.sorted_response_to_knobs[k] = {}
self.is_matrix = is_matrix
self.Grid_type = Grid_type
self.wait = wait
self.cal_log = []
self.mappings_override = mappings_override
self.functional = functional
self.checkpoint_file = checkpoint_file
if cal_logger:
self.logger = cal_logger
else:
self.logger = logger
def setup(self):
"""
set up the jobs for the given turn_knobs dict
is_matrix = True implies that the params in the dict are
interrelated. Otherwise calcs corresponding to each dict key
is independent
"""
#.........这里部分代码省略.........
示例2: Calibrate
# 需要导入模块: from pymatgen.io.vasp.inputs import Poscar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Poscar import as_dict [as 别名]
#.........这里部分代码省略.........
where the fuel (input file sources) and driving method (kind of calculation)
are decided . The Engine itself is instrument.py which creates the input set
configured in Calibrate.
Current fueling methods:
1. simplest test case involving a single job:
- specify the incar, kpoints, poscar, potcar (aka the VASP 4)
explicitly as pymatgen objects
- turn_knobs = {} , is_matrix = False
2. test case for calibration of parameters:
- specify an initial configuration for the VASP 4
- specify parameters to calibrate via turn_knobs,
set is_matrix = True only if number of parameters > 1
3. Database production case: (possibly most used)
- specify initial configuration for the VASP 4 based on
a database.yaml
- specify an input.yaml that details the workflow
Note: input structure if needed will be obtained from the
provided poscar object
"""
self.name = datetime.datetime.now().isoformat()
self.system = system
self.parent_job_dir = os.path.abspath(parent_job_dir)
self.job_dir = job_dir
self.incar = incar
self.poscar = poscar
self.potcar = potcar
if poscar:
self.potcar = Potcar(symbols=poscar.site_symbols,
functional=functional)
self.kpoints = kpoints
if incar:
self.incar_orig = incar.as_dict()
if poscar:
self.poscar_orig = poscar.as_dict()
if self.potcar:
self.potcar_orig = self.potcar.as_dict()
if kpoints:
self.kpoints_orig = kpoints.as_dict()
self.qadapter = qadapter
self.job_dir_list = []
self.jobs = []
self.job_ids = []
self.handlers = []
self.job_cmd = job_cmd
self.n_atoms = 0
self.turn_knobs = turn_knobs
self.response_to_knobs = {}
self.sorted_response_to_knobs = {}
for k, v in turn_knobs.items():
self.response_to_knobs[k] = {}
self.sorted_response_to_knobs[k] = {}
self.is_matrix = is_matrix
self.Grid_type = Grid_type
self.wait = wait
self.cal_log = []
self.mappings_override = mappings_override
self.database = database
self.magnetism = magnetism
self.mag_init = mag_init
self.solvation = solvation
self.reuse = reuse
self.reuse_incar = reuse_incar
self.reuse_override = reuse_override
self.reuse_paths = None # list object communicated to instrument