예제 #1
0
def opt_and_md(struc='cl20',
               file='card.gen',
               supercell=[1, 1, 1],
               T=3000,
               step=20000,
               wall=False,
               restart=None,
               psp=None,
               functional='REVPBE',
               restart_nve='WAVEFUNCTION COORDINATES LATEST',
               ncpu=12):
    if file == 'card.gen':
        get_structure(struc=struc,
                      supercell=supercell,
                      output='dftb',
                      recover=True,
                      center=True)
    A = read(file)
    run_cpmd(A,
             res_opt=restart,
             res_md=restart_nve,
             wall=wall,
             psp=psp,
             functional=functional,
             ncpu=ncpu)
예제 #2
0
def collect_data(strucs=['cl20mol', 'hmxmol'], T=200, step=20000, np=12):
    ''' gather datas '''
    root = getcwd()
    restart_l = 'WAVEFUNCTION COORDINATES VELOCITIES CELL ACCUMULATORS NOSEE NOSEP LATEST'
    for s in strucs:
        for i in range(5):
            dirc = s + '_' + str(i)
            system('mkdir ' + dirc)
            chdir(dirc)
            if i == 0:
                system('cp ../*.psp ./')
                get_structure(struc=s,
                              output='dftb',
                              recover=True,
                              center=True)
                A = read('card.gen')
                write_cpmd_inp(A, runtype='wvopt', restart=None)
                print('*  optimizing wave functions of %s ...' % s)
                system('mpirun -n %d cpmd inp-wvopt>wv.out' % np)
                write_cpmd_inp(A,
                               runtype='md',
                               ensemble='nve',
                               T=T,
                               step=step,
                               restart=restart_l)
            else:
                system('cp ../' + s + '_' + str(i - 1) + '/*.psp ./')
                system('cp ../' + s + '_' + str(i - 1) + '/RESTART.1 ./')
                system('cp ../' + s + '_' + str(i - 1) + '/LATEST ./')
                write_cpmd_inp(A, runtype='wvopt', restart=restart_l)
                print('*  optimizing wave functions of %s ...' % s)
                system('mpirun -n %d cpmd inp-wvopt>wv.out' % np)

                write_cpmd_inp(A,
                               runtype='md',
                               ensemble='nvt',
                               T=T,
                               step=step,
                               restart=restart_l)
            print('*  Car-Parinnello MD simulations ...')
            system('mpirun -n %d cpmd inp-nvt>nvt.out' % np)
            chdir(root)
예제 #3
0
            if not il == 0:
                cell.append([float(l[0]), float(l[1]), float(l[2])])
            il += 1
        if readlat and il < 2:
            if not il == 0:
                cell = [[float(l[0]), 0.0, 0.0],
                        [0.0, float(l[1]) * float(l[0]), 0.0],
                        [0.0, 0.0, float(l[2]) * float(l[0])]]
            il += 1
    finp.close()
    return cell


if __name__ == '__main__':
    from emdk import get_structure, emdk
    from ase.io import read, write
    from ase import Atoms
    from cpmd import write_cpmd_inp
    supercell = [1, 1, 1]
    struc = 'cl20mol'

    get_structure(struc=struc, output='dftb', recover=True, center=True)
    # emdk(cardtype='xyz',cardfile='siesta.xyz',
    #  cell=[[10.0,0.0,0.0],[0.0,10.0,0.0],[0.0,0.0,10.0]],
    #  output='dftb',
    #  center='.True.',log='log')

    A = read('card.gen')
    write_cpmd_inp(A, runtype='md', ensemble='nve')
    # write_cpmd_inp(A,runtype='md',ensemble='nvt',restart=True)