Exemplo n.º 1
0
 def __init__(self, name, incar, poscar, potcar, kpoints,
              qadapter=None, script_name='submit_script',
              vis_logger=None, **kwargs):
     """
     default INCAR from config_dict
     
     """
     self.name = name
     self.incar = Incar.from_dict(incar.as_dict())
     self.poscar = Poscar.from_dict(poscar.as_dict())
     self.potcar = Potcar.from_dict(potcar.as_dict())
     self.kpoints = Kpoints.from_dict(kpoints.as_dict())
     self.extra = kwargs
     if qadapter is not None:
         self.qadapter = qadapter.from_dict(qadapter.to_dict())
     else:
         self.qadapter = None
     self.script_name = script_name
     config_dict = {}
     config_dict['INCAR'] = self.incar.as_dict()
     config_dict['POSCAR'] = self.poscar.as_dict()
     # caution the key and the value are not always the same
     config_dict['POTCAR'] = self.potcar.as_dict()
     # dict(zip(self.potcar.as_dict()['symbols'],
     # self.potcar.as_dict()['symbols']))
     config_dict['KPOINTS'] = self.kpoints.as_dict()
     # self.user_incar_settings = self.incar.as_dict()
     DictVaspInputSet.__init__(self, name, config_dict,
                               ediff_per_atom=False, **kwargs)
     if vis_logger:
         self.logger = vis_logger
     else:
         self.logger = logger
Exemplo n.º 2
0
 def __init__(self, name, incar, poscar, potcar, kpoints,
              qadapter=None, **kwargs ):
     """
     default INCAR from config_dict
     
     """
     self.name = name
     self.incar = Incar.from_dict(incar.as_dict())
     self.poscar = Poscar.from_dict(poscar.as_dict())
     self.potcar = Potcar.from_dict(potcar.as_dict())
     self.kpoints = Kpoints.from_dict(kpoints.as_dict())
     self.extra = kwargs
     if qadapter is not None:
         self.qadapter = qadapter.from_dict(qadapter.to_dict())
     else:
         self.qadapter = None        
     config_dict = {}
     config_dict['INCAR'] = self.incar.as_dict()
     config_dict['POSCAR'] = self.poscar.as_dict() 
     #caution the key and the value are not always the same        
     config_dict['POTCAR'] = self.potcar.as_dict() 
     #dict(zip(self.potcar.as_dict()['symbols'],
     #self.potcar.as_dict()['symbols']))
     config_dict['KPOINTS'] = self.kpoints.as_dict()
     #self.user_incar_settings = self.incar.as_dict()        
     DictVaspInputSet.__init__(self, name, config_dict,
                                ediff_per_atom=False, **kwargs)
Exemplo n.º 3
0
    def get_poscar(self):
        """
        Create and return a :class:`pymatgen.io.vasp.inputs.Poscar` instance
        initialized from the node's stored structure data contents.

        :return: a pymatgen Poscar instance
        :rtype: :class:`pymatgen.io.vasp.inputs.Poscar`
        """
        return Poscar.from_dict(self.get_dict())
Exemplo n.º 4
0
    def __init__(self,
                 name,
                 incar,
                 poscar,
                 kpoints,
                 potcar=None,
                 qadapter=None,
                 script_name='submit_script',
                 vis_logger=None,
                 reuse_path=None,
                 test=False,
                 **kwargs):
        """
        default INCAR from config_dict

        """
        self.name = name
        self.test = test
        #print (test)
        self.incar_init = Incar.from_dict(incar.as_dict())
        self.poscar_init = Poscar.from_dict(poscar.as_dict())
        if not self.test:
            self.potcar_init = Potcar.from_dict(potcar.as_dict())
        if not isinstance(kpoints, str):
            self.kpoints_init = Kpoints.from_dict(kpoints.as_dict())
            #print (kpoints)
        else:
            self.kpoints_init = kpoints
        self.reuse_path = reuse_path  # complete reuse paths
        self.extra = kwargs
        if qadapter is not None:
            self.qadapter = qadapter.from_dict(qadapter.to_dict())
        else:
            self.qadapter = None
        self.script_name = script_name
        config_dict = {}
        config_dict['INCAR'] = self.incar_init.as_dict()
        config_dict['POSCAR'] = self.poscar_init.as_dict()
        # caution the key and the value are not always the same
        if not self.test:
            config_dict['POTCAR'] = self.potcar_init.as_dict()
        # dict(zip(self.potcar.as_dict()['symbols'],
        # self.potcar.as_dict()['symbols']))
        if not isinstance(kpoints, str):
            #print (self.kpoints_init)
            config_dict['KPOINTS'] = self.kpoints_init.as_dict()
        else:
            # need to find a way to dictify this kpoints string more
            # appropriately
            config_dict['KPOINTS'] = {'kpts_hse': self.kpoints_init}
        # self.user_incar_settings = self.incar.as_dict()
        DictSet.__init__(self, poscar.structure, config_dict)
        #**kwargs)
        if vis_logger:
            self.logger = vis_logger
        else:
            self.logger = logger
Exemplo n.º 5
0
 def from_dict(cls, d):
     incar = Incar.from_dict(d["incar"])
     poscar = Poscar.from_dict(d["poscar"])
     potcar = Potcar.from_dict(d["potcar"])
     kpoints = Kpoints.from_dict(d["kpoints"])
     qadapter = None
     if d["qadapter"] is not None:
         qadapter = CommonAdapter.from_dict(d["qadapter"])
     return MPINTVaspInputSet(d["name"], incar, poscar, potcar,
                              kpoints, qadapter, **d["kwargs"])
Exemplo n.º 6
0
def update_spec_force_convergence(spec, user_vasp_settings=None):
    fw_spec = spec
    update_set = {"ENCUT": 700, "EDIFF": 0.000001, "ALGO":"N", "NPAR":2}
    if user_vasp_settings and user_vasp_settings.get("incar"):
            update_set.update(user_vasp_settings["incar"])
    fw_spec['vasp']['incar'].update(update_set)
    old_struct=Poscar.from_dict(fw_spec["vasp"]["poscar"]).structure
    if user_vasp_settings and user_vasp_settings.get("kpoints"):
        kpoints_density = user_vasp_settings["kpoints"]["kpoints_density"]
    else:
        kpoints_density = 7000
    k=Kpoints.automatic_density(old_struct, kpoints_density)
    fw_spec['vasp']['kpoints'] = k.as_dict()
    return fw_spec
Exemplo n.º 7
0
 def from_dict(cls, d):
     incar = Incar.from_dict(d["incar"])
     poscar = Poscar.from_dict(d["poscar"])
     potcar = Potcar.from_dict(d["potcar"])
     kpoints = Kpoints.from_dict(d["kpoints"])
     qadapter = None
     if d["qadapter"] is not None:
         qadapter = CommonAdapter.from_dict(d["qadapter"])
     script_name = d["script_name"]
     return MPINTVaspInputSet(d["name"], incar, poscar, potcar,
                              kpoints, qadapter,
                              script_name=script_name,
                              vis_logger=logging.getLogger(d["logger"]),
                              **d["kwargs"])
Exemplo n.º 8
0
 def from_dict(cls, d):
     incar = Incar.from_dict(d["incar"])
     poscar = Poscar.from_dict(d["poscar"])
     potcar = Potcar.from_dict(d["potcar"])
     kpoints = Kpoints.from_dict(d["kpoints"])
     cal =  Calibrate(incar, poscar, potcar, kpoints, 
                      system=d["system"], is_matrix = d["is_matrix"], 
                      Grid_type = d["Grid_type"], 
                      parent_job_dir=d["parent_job_dir"], 
                      job_dir=d["job_dir"], qadapter=d.get("qadapter"), 
                      job_cmd=d["job_cmd"], wait=d["wait"],
                      turn_knobs=d["turn_knobs"])
     cal.job_dir_list = d["job_dir_list"]
     cal.job_ids = d["job_ids"]
     return cal
Exemplo n.º 9
0
 def from_dict(cls, d):
     incar = Incar.from_dict(d["incar"])
     poscar = Poscar.from_dict(d["poscar"])
     potcar = Potcar.from_dict(d["potcar"])
     kpoints = Kpoints.from_dict(d["kpoints"])
     cal = Calibrate(incar, poscar, potcar, kpoints,
                     system=d["system"], is_matrix=d["is_matrix"],
                     Grid_type=d["Grid_type"],
                     parent_job_dir=d["parent_job_dir"],
                     job_dir=d["job_dir"], qadapter=d.get("qadapter"),
                     job_cmd=d["job_cmd"], wait=d["wait"],
                     turn_knobs=d["turn_knobs"])
     cal.job_dir_list = d["job_dir_list"]
     cal.job_ids = d["job_ids"]
     return cal
Exemplo n.º 10
0
    def __init__(self, name, incar, poscar, kpoints, potcar=None,
                 qadapter=None, script_name='submit_script',
                 vis_logger=None, reuse_path=None, test=False,
                 **kwargs):
        """
        default INCAR from config_dict

        """
        self.name = name
        self.test = test
        self.incar_init = Incar.from_dict(incar.as_dict())
        self.poscar_init = Poscar.from_dict(poscar.as_dict())
        if not self.test:
            self.potcar_init = Potcar.from_dict(potcar.as_dict())
        if not isinstance(kpoints, str):
            self.kpoints_init = Kpoints.from_dict(kpoints.as_dict())
        else:
            self.kpoints_init = kpoints
        self.reuse_path = reuse_path  # complete reuse paths
        self.extra = kwargs
        if qadapter is not None:
            self.qadapter = qadapter.from_dict(qadapter.to_dict())
        else:
            self.qadapter = None
        self.script_name = script_name
        config_dict = {}
        config_dict['INCAR'] = self.incar_init.as_dict()
        config_dict['POSCAR'] = self.poscar_init.as_dict()
        # caution the key and the value are not always the same
        if not self.test:
            config_dict['POTCAR'] = self.potcar_init.as_dict()
        # dict(zip(self.potcar.as_dict()['symbols'],
        # self.potcar.as_dict()['symbols']))
        if not isinstance(kpoints, str):
            config_dict['KPOINTS'] = self.kpoints_init.as_dict()
        else:
            # need to find a way to dictify this kpoints string more
            # appropriately
            config_dict['KPOINTS'] = {'kpts_hse':self.kpoints_init}
        # self.user_incar_settings = self.incar.as_dict()
        DictSet.__init__(self, poscar.structure, config_dict)
                         #**kwargs)
        if vis_logger:
            self.logger = vis_logger
        else:
            self.logger = logger
Exemplo n.º 11
0
    def test_to_from_dict(self):
        poscar_string = """Test3
1.0
3.840198 0.000000 0.000000
1.920099 3.325710 0.000000
0.000000 -2.217138 3.135509
1 1
Selective dynamics
direct
0.000000 0.000000 0.000000 T T T Si
0.750000 0.500000 0.750000 F F F O
"""
        poscar = Poscar.from_string(poscar_string)
        d = poscar.as_dict()
        poscar2 = Poscar.from_dict(d)
        self.assertEqual(poscar2.comment, "Test3")
        self.assertTrue(all(poscar2.selective_dynamics[0]))
        self.assertFalse(all(poscar2.selective_dynamics[1]))
Exemplo n.º 12
0
    def test_to_from_dict(self):
        poscar_string = """Test3
1.0
3.840198 0.000000 0.000000
1.920099 3.325710 0.000000
0.000000 -2.217138 3.135509
1 1
Selective dynamics
direct
0.000000 0.000000 0.000000 T T T Si
0.750000 0.500000 0.750000 F F F O
"""
        poscar = Poscar.from_string(poscar_string)
        d = poscar.as_dict()
        poscar2 = Poscar.from_dict(d)
        self.assertEqual(poscar2.comment, "Test3")
        self.assertTrue(all(poscar2.selective_dynamics[0]))
        self.assertFalse(all(poscar2.selective_dynamics[1]))
Exemplo n.º 13
0
    def set_poscar(self, scale=None, poscar=None):
        """
        perturbs given structure by volume scaling factor 
	or takes user defined variants of Poscar 
	
	Args:
	   scale : Volume Scaling parameter

	   poscar : Poscar object of user defined structure

	   set the poscar: volume scaled by the scale factor
        """
        if scale is not None:
            structure = Poscar.from_dict(self.poscar_orig).structure
            volume = structure.volume
            structure.scale_lattice(scale *volume)
            self.poscar = Poscar(structure)
        elif poscar is not None:
            self.poscar = poscar
Exemplo n.º 14
0
    def set_poscar(self, scale=None, poscar=None):
        """
        perturbs given structure by volume scaling factor 
	or takes user defined variants of Poscar 
	
	Args:
	   scale : Volume Scaling parameter

	   poscar : Poscar object of user defined structure

	   set the poscar: volume scaled by the scale factor
        """
        if scale is not None:
            structure = Poscar.from_dict(self.poscar_orig).structure
            volume = structure.volume
            structure.scale_lattice(scale * volume)
            self.poscar = Poscar(structure)
        elif poscar is not None:
            self.poscar = poscar