qzhu2017 / PyXtal

A code to generate atomic structure with symmetry
MIT License
234 stars 59 forks source link

Add MD support to DFTB #211

Closed qzhu2017 closed 1 year ago

qzhu2017 commented 1 year ago

Example:

qzhu2017 commented 1 year ago
from pyxtal.db import database
from pyxtal.interface.dftb import DFTB
import os
skf_dir = os.environ['DFTB_PREFIX'] + 'pbc-0-3/'

# Set the crystal model
code = 'ACSALA'
db = database('../bending_organics/dataset/ht.db')
atoms = db.get_pyxtal(code).to_ase()
print(atoms)

my = DFTB(atoms, skf_dir, folder=code, use_omp=True)
struc, energy = my.run('relax')
print("Relax: {:12.4f}".format(energy))

my = DFTB(struc*2, skf_dir, folder=code, use_omp=True)
md_params = {
             'temperature': 350,
             'MDRestartFrequency': 100,
            }
struc, energy = my.run('npt', step=0, md_params=md_params)
res = "{:8.4f} ".format(struc.cell[0,0])
res += "{:8.4f} ".format(struc.cell[1,1])
res += "{:8.4f} ".format(struc.cell[2,2])
res += "{:12.4f}".format(energy)
print(res)