def test__get_required_tasks(qoi):
    _qoidb_filename_in = "pypospack.qoi.yaml"

    from pypospack.qoi import QoiDatabase
    from pypospack.qoi import QoiManager

    _qoi_type = qoi
    _qoi_structure = 'MgO_NaCl'
    _qoi_name = "{}.{}".format(_qoi_structure, _qoi_type)
    _qoi_structures = OrderedDict()
    _qoi_structures['ideal'] = 'MgO_NaCl'
    _qoidb_QoiDatabase = QoiDatabase()
    _qoidb_QoiDatabase.add_qoi(qoi_name=_qoi_name,
                               qoi_type=_qoi_type,
                               structures=_qoi_structures,
                               target=4.5)

    qoimanager = QoiManager(qoi_database=_qoidb_QoiDatabase, fullauto=False)
    qoimanager.configure()
    qoimanager.determine_tasks()

    _task_type = 'lmps_min_all'
    _qoi_task_name = "{}.{}".format(_qoi_structures['ideal'], _task_type)
    assert isinstance(qoimanager.tasks, OrderedDict)
    assert _qoi_task_name in qoimanager.tasks
    assert qoimanager.tasks[_qoi_task_name]['task_type'] == _task_type
    assert qoimanager.tasks[_qoi_task_name]['task_structure'] \
            == _qoi_structures['ideal']
Exemplo n.º 2
0
def test__read():
    _yaml_filename_in = 'pypospack.qoi.yaml'

    from pypospack.qoi import QoiDatabase
    qoidb = QoiDatabase()
    qoidb.read(filename=_yaml_filename_in)

    assert isinstance(qoidb.qois, dict)
    assert isinstance(qoidb.qois, OrderedDict)
Exemplo n.º 3
0
def test__write():
    _yaml_filename_in = 'pypospack.qoi.yaml'
    _yaml_filename_out = 'pypospack.qoi.yaml.out'

    from pypospack.qoi import QoiDatabase
    qoidb = QoiDatabase()
    qoidb.read(filename=_yaml_filename_in)
    qoidb.write(filename=_yaml_filename_out)
    qoidb.read(filename=_yaml_filename_out)
Exemplo n.º 4
0
    def test__init__with_QoiDatabase():
        _qoidb_filename_in = "pypospack.qoi.yaml"

        from pypospack.qoi import QoiDatabase
        qoidb = QoiDatabase()
        qoidb.read(filename=_qoidb_filename_in)

        from pypospack.qoi import QoiManager
        qoimanager = QoiManager(qoi_database=qoidb, fullauto=False)

        assert isinstance(qoimanager.qoidb, QoiDatabase)
        assert isinstance(qoimanager.qoidb.qoi_names, list)
        assert isinstance(qoimanager.qoi_names, list)
Exemplo n.º 5
0
def get_testing_set_Si():
    testing_set = OrderedDict()
    # Stillinger and Weber,  Phys. Rev. B, v. 31, p. 5262, (1985)
    testing_set['parameters'] = OrderedDict([('SiSiSi_epsilon', 2.1686),
                                             ('SiSiSi_sigma', 2.0951),
                                             ('SiSiSi_a', 1.80),
                                             ('SiSiSi_lambda', 21.0),
                                             ('SiSiSi_gamma', 1.20),
                                             ('SiSiSi_costheta0', -1 / 3),
                                             ('SiSiSi_A', 7.049556277),
                                             ('SiSiSi_B', 0.6022245584),
                                             ('SiSiSi_p', 4.0),
                                             ('SiSiSi_q', 0.0),
                                             ('SiSiSi_tol', 0.0)])
    testing_set['structure_db'] = OrderedDict()
    testing_set['structure_db']['structure_directory'] = os.path.join(
        pypospack.utils.get_pypospack_root_directory(), 'data',
        'Si__structure_db')
    testing_set['structure_db']['structures'] = OrderedDict()
    testing_set['structure_db']['structures']['Si_dia'] = 'Si_dia_unit.vasp'
    testing_set['structure_db']['structures']['Si_vac'] = 'Si_dia_333_vac.vasp'
    testing_set['qoi_db'] = QoiDatabase()
    testing_set['qoi_db'].add_qoi(qoi_name='Si_dia.vac',
                                  qoi_type='E_formation',
                                  structures=OrderedDict([('defect', 'Si_vac'),
                                                          ('ideal', 'Si_dia')
                                                          ]),
                                  target=3.6)
    testing_set['tasks'] = OrderedDict()
    testing_set['tasks']['Si_dia.lmps_min_all'] = OrderedDict([
        ('task_type', 'lmps_min_all'), ('task_structure', 'Si_dia')
    ])
    testing_set['tasks']['Si_vac.lmps_min_pos'] = OrderedDict([
        ('task_type', 'lmps_min_pos'), ('task_structure', 'Si_vac'),
        ('bulk_structure', 'Si_dia')
    ])
    return testing_set
def write_configuration_file(qoi_name,qoi_type,structures,target):
    qoidb = QoiDatabase()
    qoidb.add_qoi(
            qoi_name=qoi_name,
            qoi_type=qoi_type,
            structures=structures,
            target=target
        )
    
    potential = OrderedDict()
    potential['potential_type'] = 'buckingham'
    potential['symbols'] = ['Mg','O']
    potential['cutoff_global'] = 10.0
    
    structures = OrderedDict()
    structures['structure_directory'] = 'test_PypospackEngine'
    structures['structures'] = OrderedDict()
    structures['structures']['MgO_NaCl'] = 'MgO_NaCl_unit.gga.relax.vasp'
    
    configuration = PyposmatConfigurationFile()
    configuration.qois = qoidb.qois
    configuration.potential = potential
    configuration.structures = structures
    configuration.write(filename='pyposmat.config.in')
Exemplo n.º 7
0
parameter_constraints['OO_C > 0'] = 'OO_C > 0.'
#------------------------------------------------------------------------------
# STRUCTURE DATABASE DEFINITION
#------------------------------------------------------------------------------
structure_db = OrderedDict()
structure_db['structure_directory'] = _pyposmat_structure_directory
structure_db['structures'] = OrderedDict()
structure_db['structures']['MgO_NaCl'] = 'MgO_NaCl_unit.vasp'
structure_db['structures']['MgO_NaCl_001s'] = 'MgO_NaCl_001s.vasp'
structure_db['structures']['MgO_NaCl_fr_a'] = 'MgO_NaCl_333_fr_a.vasp'
structure_db['structures']['MgO_NaCl_fr_c'] = 'MgO_NaCl_333_fr_c.vasp'
structure_db['structures']['MgO_NaCl_sch'] = 'MgO_NaCl_333_sch.vasp'
#------------------------------------------------------------------------------
# FITTING DATABASE
#------------------------------------------------------------------------------
qoi_db = QoiDatabase()
qoi_db.add_qoi(qoi_name="MgO_NaCl.a0",
               qoi_type="a11_min_all",
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=4.246)
qoi_db.add_qoi(qoi_name="MgO_NaCl.c11",
               qoi_type="c11",
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=277.0)
qoi_db.add_qoi(qoi_name="MgO_NaCl.c12",
               qoi_type="c12",
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=91.67)
qoi_db.add_qoi(qoi_name="MgO_NaCl.c44",
               qoi_type="c44",
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
Exemplo n.º 8
0
MgO_LewisCatlow['potential']['potential_type'] = 'buckingham'
MgO_LewisCatlow['potential']['symbols'] = ['Mg', 'O']
MgO_LewisCatlow['parameters'] = OrderedDict()
MgO_LewisCatlow['parameters']['chrg_Mg'] = +2.0
MgO_LewisCatlow['parameters']['chrg_O'] = -2.0
MgO_LewisCatlow['parameters']['MgMg_A'] = 0.0
MgO_LewisCatlow['parameters']['MgMg_rho'] = 0.5
MgO_LewisCatlow['parameters']['MgMg_C'] = 0.0
MgO_LewisCatlow['parameters']['MgO_A'] = 821.6
MgO_LewisCatlow['parameters']['MgO_rho'] = 0.3242
MgO_LewisCatlow['parameters']['MgO_C'] = 0.0
MgO_LewisCatlow['parameters']['OO_A'] = 2274.00
MgO_LewisCatlow['parameters']['OO_rho'] = 0.1490
MgO_LewisCatlow['parameters']['OO_C'] = 27.88

MgO_qoi_db_gga = QoiDatabase()
MgO_qoi_db_gga.add_qoi(qoi_name='MgO_NaCl.a0',
                       qoi_type='a11_min_all',
                       structures=OrderedDict([('ideal', 'MgO_NaCl')]),
                       target=4.246)
MgO_qoi_db_gga.add_qoi(qoi_name='MgO_NaCl.c11',
                       qoi_type='c11',
                       structures=OrderedDict([('ideal', 'MgO_NaCl')]),
                       target=277.00)
MgO_qoi_db_gga.add_qoi(qoi_name='MgO_NaCl.c12',
                       qoi_type='c12',
                       structures=OrderedDict([('ideal', 'MgO_NaCl')]),
                       target=91.67)
MgO_qoi_db_gga.add_qoi(qoi_name='MgO_NaCl.c44',
                       qoi_type='c44',
                       structures=OrderedDict([('ideal', 'MgO_NaCl')]),
#------------------------------------------------------------------------------
# STRUCTURE DATABASE DEFINITION
#------------------------------------------------------------------------------
structure_db = OrderedDict()
structure_db['structure_directory'] = 'structure_db'
structure_db['structures'] = OrderedDict()
structure_db['structures']['MgO_NaCl'] = 'MgO_NaCl_unit.gga.relax.vasp'
structure_db['structures']['MgO_NaCl_prim'] = 'MgO_NaCl_prim.gga.relax.vasp'
structure_db['structures']['MgO_NaCl_fr_a'] = 'MgO_NaCl_333_fr_a.vasp'
structure_db['structures']['MgO_NaCl_fr_c'] = 'MgO_NaCl_333_fr_c.vasp'
structure_db['structures']['MgO_NaCl_sch'] = 'MgO_NaCl_333_sch.vasp'
structure_db['structures']['MgO_NaCl_001s'] = 'MgO_NaCl_001s.vasp'
#------------------------------------------------------------------------------
# FITTING DATABASE
#------------------------------------------------------------------------------
qoi_db = QoiDatabase()
qoi_db.add_qoi(qoi_name='MgO_NaCl.a0',
               qoi_type='a11_min_all',
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=4.246)
qoi_db.add_qoi(qoi_name='MgO_NaCl.c11',
               qoi_type='c11',
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=277.00)
qoi_db.add_qoi(qoi_name='MgO_NaCl.c12',
               qoi_type='c12',
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=91.67)
qoi_db.add_qoi(qoi_name='MgO_NaCl.c44',
               qoi_type='c44',
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
Exemplo n.º 10
0
#MgO_parameter_constraints['OO_rho_gt_0']  = ['OO_rho > 0']
#MgO_parameter_constraints['OO_C_gt_0']  = ['OO_C > 0']

# <---------------- STRUCTURE DATABASE
Si_sw_structures = OrderedDict()
Si_sw_structures['structure_directory'] = 'test__PyposmatMonteCarloSampler'
Si_sw_structures['structures'] = OrderedDict()
Si_sw_structures['structures']['Si_dia'] = 'Si_dia_unit.vasp'

#<00--------------- QOI DATABASE
#Si reference database
# LDA-DFT reference data, originally from:
# Pizzagalli et al.  Phil. Mag A (2008) A 83 1191
# Taken from table
# Pizzagalli et al.  J Phys. Condens. Matter (2013) 055801
Si_sw_qoi_db = QoiDatabase()
# <----------------- STRUCTURAL PROPERTIES
Si_sw_qoi_db.add_qoi(qoi_name='Si_dia.Ecoh',
                     qoi_type='Ecoh_min_all',
                     structures=OrderedDict([('ideal', 'Si_dia')]),
                     target=-4.63)
Si_sw_qoi_db.add_qoi(qoi_name='Si_dia.a0',
                     qoi_type='a11_min_all',
                     structures=OrderedDict([('ideal', 'Si_dia')]),
                     target=5.43)
# <----------------- ELASTIC PROPERTIES
Si_sw_qoi_db.add_qoi(qoi_name='Si_dia.c11',
                     qoi_type='c11',
                     structures=OrderedDict([('ideal', 'Si_dia')]),
                     target=166.0)
Si_sw_qoi_db.add_qoi(qoi_name='Si_dia.c12',
Exemplo n.º 11
0
 def __init_QoiDatabase_from_OrderedDict(self, qoi_database_OrderedDict):
     assert isinstance(qoi_database_OrderedDict, OrderedDict)
     self.qoidb = QoiDatabase(qoi_database_OrderedDict)
Exemplo n.º 12
0
 def __init_QoiDatabase_from_file(self, qoi_database_filename):
     assert isinstance(qoi_database_filename, str)
     self.qoidb = QoiDatabase()
     self.qoidb.read(filename=qoi_database_filename)
Exemplo n.º 13
0
 def __init_QoiDatabase_from_None(self):
     self.qoidb = QoiDatabase()
Exemplo n.º 14
0
from pypospack.task import TaskManager
from pypospack.qoi import QoiDatabase,QoiManager
from pypospack.qoi import StackingFaultEnergyCalculation

NiAl_eam__Mishin2009 = OrderedDict()
NiAl_eam__Mishin2009['potential_type'] = 'eam'
NiAl_eam__Mishin2009['symbols'] = ['Ni,Al']
NiAl_eam__Mishin2009['setfl_filename'] = os.path.join('potential_db','Mishin-Ni-Al-2009.eam.alloy')
NiAl_eam__Mishin2009['reference'] = 'Purja Pun and Y. Mishin (2009).  Phil. Mag., 89(34-36)'

Ni_fcc_isf = OrderedDict()
Ni_fcc_isf['qoi_name'] = 'Ni_fcc.isf'
Ni_fcc_isf['qoi_type'] = 'E_stacking_fault'
Ni_fcc_isf['structures'] = OrderedDict([('defect','Ni_fcc_isf'),('ideal','Ni_fcc_111_unit')])
Ni_fcc_isf['target'] = 100.
Ni_qoi_db = QoiDatabase()
Ni_qoi_db.add_qoi(
        qoi_name=Ni_fcc_isf['qoi_name'],
        qoi_type=Ni_fcc_isf['qoi_type'],
        structures=Ni_fcc_isf['structures'],
        target=Ni_fcc_isf['target'])

Ni_structure_db = OrderedDict()
Ni_structure_db['structure_directory'] = 'structure_db'
Ni_structure_db['structures'] = OrderedDict()
Ni_structure_db['structures']['Ni_fcc_111_unit'] = 'Ni_fcc_111_unit.gga.relaxed.vasp'
Ni_structure_db['structures']['Ni_fcc_isf'] = 'Ni_fcc_isf.vasp'
Ni_structure_db['structures']['Ni_fcc_esf'] = 'Ni_fcc_esf.vasp'
Ni_structure_db['structures']['Ni_fcc_usf'] = 'Ni_fcc_usf.vasp'