Exemplo n.º 1
0
 def testOptim(self):
     ff = PyXtal_FF(model={'system': ["Si"]}, logo=False)
     ff.run(mode='predict', mliap=bp_model)
     calc = PyXtalFFCalculator(ff=ff)
     si = bulk('Si', 'diamond', a=5.0, cubic=True)
     si.set_calculator(calc)
     si = optimize(si, box=True)
     self.assertTrue(abs(si.get_cell()[0][0] - 5.469) < 1e-2)
Exemplo n.º 2
0
                      metavar="file")

    (options, args) = parser.parse_args()

    # load calculator
    #calc = PyXtalFFCalculator(mliap=options.file, logo=False)
    ff = PyXtal_FF(model={'system': ["Si"]}, logo=False)
    ff.run(mode='predict', mliap=options.file)
    calc = PyXtalFFCalculator(ff=ff)

    # initial structure and calculator
    si = bulk('Si', 'diamond', a=5.0, cubic=True)
    si.set_calculator(calc)

    # geometry optimization
    si = optimize(si, box=True)
    print('equlirum cell para: ', si.get_cell()[0][0])
    print('equlirum energy: ', si.get_potential_energy())
    print('equlirum stress', -si.get_stress()/units.GPa)

    #Elastic Properties
    C, C_err = fit_elastic_constants(si, symmetry='cubic', optimizer=BFGS)
    C /= units.GPa

    print("Bulk modulus, Shear modulus, Young's modulus, Poisson's ratio")
    k1, g1, e1, v1, k2, g2, e2, v2, k3, g3, e3, v3 = elastic_properties(C)
    print(k1, g1, e1, v1)
    print(k2, g2, e2, v2)
    print(k3, g3, e3, v3)

    # Phonon properties