Example #1
0
 def setup(self):
     self.bandpoints = ibz_points['hexagonal']
     self.bandpath = ['Gamma', 'M', 'K', 'Gamma']
     if self.pot == 1:
         debug("graphene potential chosen:SiC_1994.tersoff")
         self.potential = 'pair_style	tersoff\npair_coeff	* * %s/SiC_1994.tersoff  %s' % (
             config.lammpspot, ' '.join(['C' for i in self.elements]))
Example #2
0
 def submit(self):
     cmd = "cd %s;qsub %s 2>&1" % (self.path, self.filename)
     tl.debug(cmd)
     print(cmd)
     x = self.ssh_cmd('xggong', 'cluster', cmd)
     # assert not x.strip()==''
     tl.debug(x)
Example #3
0
 def submit(self):
     cmd = "cd %s;qsub %s 2>&1" % (self.path, self.filename)
     tl.debug(cmd)
     print(cmd)
     x = self.ssh_cmd('xggong', 'cluster', cmd)
     # assert not x.strip()==''
     tl.debug(x)
Example #4
0
def run():
    a = time.time()
    m = App().m  # before cd
    tl.debug('one vasprun mv etc.:%f s' % (time.time() - a))
    a = time.time()
    getVaspRun_lammps(m)
    tl.debug('one vasprun lmp:%f s' % (time.time() - a))
Example #5
0
 def check(self):
     jobdone = np.array(
         [tl.exists(job.path + "/done") for job in self.jobs])
     tl.debug('entering loop waiting for vasp...')
     while not jobdone.all():
         time.sleep(3)
         jobdone = np.array(
             [tl.exists(job.path + "/done") for job in self.jobs])
         # debug(paths[jobdone])
     tl.debug('done')
Example #6
0
 def check(self):
     jobdone = np.array(
         [tl.exists(job.path + "/done") for job in self.jobs])
     tl.debug('entering loop waiting for vasp...')
     while not jobdone.all():
         time.sleep(3)
         jobdone = np.array(
             [tl.exists(job.path + "/done") for job in self.jobs])
         # debug(paths[jobdone])
     tl.debug('done')
Example #7
0
 def setup(self):
     self.bandpoints = {
         'K': [0.5, 0.5, 0],
         'Gamma': [0, 0, 0],
         'X': [0.5, 0.0, 0],
         'Y': [0.0, 0.5, 0]
     }
     self.bandpath = ['X', 'Gamma', 'Y']
     tl.debug("graphene potential chosen:Si.tersoff.mod")
     self.potential = 'pair_style	tersoff/mod\n' +\
         'pair_coeff	* * %s/Si.tersoff.mod Si' % (
             config.lammpspot)
Example #8
0
    def run(self):
        m = self.m
        a = time.time()
        self.generate_supercells()
        debug('generate_supercells:%f s' % (time.time() - a))
        files = shell_exec("ls *-*").split('\n')
        assert len(files) > 0 and not files[0] == ""
        # self.runSPOSCAR()
        a = time.time()
        self.getvasprun(files)
        debug('getvasprun:%f s' % (time.time() - a))
        a = time.time()
        self.fc2()
        debug('force_constant:%f s' % (time.time() - a))

        if m.phofc:
            return self
        self.postp()
Example #9
0
    def run(self):
        m = self.m
        a = time.time()
        self.generate_supercells()
        debug('generate_supercells:%f s' % (time.time() - a))
        files = shell_exec("ls *-*").split('\n')
        assert len(files) > 0 and not files[0] == ""
        # self.runSPOSCAR()
        a = time.time()
        self.getvasprun(files)
        debug('getvasprun:%f s' % (time.time() - a))
        a = time.time()
        self.fc2()
        debug('force_constant:%f s' % (time.time() - a))

        if m.phofc:
            return self
        self.postp()
Example #10
0
    def generate(self):
        m = self.m
        self.minimizePOSCAR()
        a = time.time()
        self.generate_supercells()
        tl.debug('generate_supercells:%f s' % (time.time() - a))
        tl.shell_exec("rm *-*")
        tl.cp("SPOSCAR", "POSCAR001")
        a = time.time()
        files = ['POSCAR001']
        self.getvasprun(files)
        tl.debug('getvasprun:%f s' % (time.time() - a))
        a = time.time()
        self.force_constant()
        tl.debug('force_constant:%f s' % (time.time() - a))

        if m.phofc:
            return self
        self.postp()
Example #11
0
    def generate(self):
        m = self.m
        self.minimizePOSCAR()
        a = time.time()
        self.generate_supercells()
        tl.debug('generate_supercells:%f s' % (time.time() - a))
        tl.shell_exec("rm *-*")
        tl.cp("SPOSCAR", "POSCAR001")
        a = time.time()
        files = ['POSCAR001']
        self.getvasprun(files)
        tl.debug('getvasprun:%f s' % (time.time() - a))
        a = time.time()
        self.force_constant()
        tl.debug('force_constant:%f s' % (time.time() - a))

        if m.phofc:
            return self
        self.postp()
Example #12
0
 def ssh_cmd(self, user, ip, cmd):
     passwd = 'AdminYu@224'
     ssh = pexpect.spawn('ssh %s@%s "%s"' % (user, ip, cmd))
     try:
         i = ssh.expect(
             ['password:'******'continue connecting (yes/no)?'], timeout=5)
         if i == 0:
             ssh.sendline(passwd)
         elif i == 1:
             ssh.sendline('yes')
             ssh.expect('password: ')
             ssh.sendline(passwd)
     except pexpect.EOF:
         tl.debug("EOF")
     except pexpect.TIMEOUT:
         tl.debug("TIMEOUT")
     else:
         r = ssh.read()
         tl.debug(r)
         ssh.close()
Example #13
0
 def ssh_cmd(self, user, ip, cmd):
     passwd = 'AdminYu@224'
     ssh = pexpect.spawn('ssh %s@%s "%s"' % (user, ip, cmd))
     try:
         i = ssh.expect(['password:'******'continue connecting (yes/no)?'],
                        timeout=5)
         if i == 0:
             ssh.sendline(passwd)
         elif i == 1:
             ssh.sendline('yes')
             ssh.expect('password: ')
             ssh.sendline(passwd)
     except pexpect.EOF:
         tl.debug("EOF")
     except pexpect.TIMEOUT:
         tl.debug("TIMEOUT")
     else:
         r = ssh.read()
         tl.debug(r)
         ssh.close()
Example #14
0
    def generate(self):
        m = self.m
        hook = Hook()
        if m.method == 'nvt':
            nvtDevice(hook, m)
        elif m.method == 'muller':
            mpDevice(hook, m)
        elif m.method == 'inject':
            ijDevice(hook, m)
        elif m.method == 'greenkubo':
            gkDevice(hook, m)
        tl.debug("tcfactor=" + str(m.tcfactor))
        # settings
        print("units %s" % m.units)
        print("dimension 3")
        pbcx = pbcy = pbcz = 's'
        if m.xp == 1:
            pbcx = 'p'
        if m.yp == 1:
            pbcy = 'p'
        if m.zp == 1:
            pbcz = 'p'
        print("boundary %s %s %s" % (pbcx, pbcy, pbcz))
        print("atom_style atomic")
        print("read_restart   minimize/restart.minimize")
        print("change_box	all	boundary %s %s %s" % (pbcx, pbcy, pbcz))
        print("lattice fcc 5")  # needed to define the regions
        print("thermo %d" % m.dumpRate)
        print("thermo_modify     lost warn")
        print("timestep %f" % m.timestep)
        # regions and groups
        hook.doAction('region')
        # computes
        print("compute           ke  all  ke/atom")
        print("compute           pe  all  pe/atom")
        print("compute         stress all stress/atom NULL virial")
        print("compute jflux all heat/flux ke pe stress")
        hook.doAction('compute')
        # variables
        hook.doAction('variable')
        # init atoms to T
        print(m.masses)
        print(m.potential)
        print("reset_timestep 0")
        print("velocity all create %f %d mom yes rot yes dist gaussian" %
              (m.T, m.seed))
        if m.dimension == 1:
            print("velocity  all set NULL 0.0 0.0 units box")
        elif m.dimension == 2:
            print("velocity  all set NULL NULL 0.0 units box")
        hook.doAction('equ')

        # /* 定时输出dump文件并按id排序*/
        if (m.dumpxyz):
            print("dump dump1 all atom %d dump.lammpstrj" % (m.dumpRate))
            print("dump_modify  dump1 sort id")
        print("run %d" % m.equTime)
        print("unfix getEqu")
        print("reset_timestep 0")
        hook.doAction('elimination')
        print("fix    flux_out  all  ave/time  1 " +
              "%d  %d  c_jflux[1]  c_jflux[2] c_jflux[3] file  flux.txt " %
              (m.aveRate, m.aveRate))
        print("variable T_atom atom c_ke/(1.5*%f)" % m.kb)
        print("fix  T_atom  all  ave/atom  1  %d  %d  v_T_atom " %
              (m.aveRate, m.aveRate))
        print("dump dump_T all custom %d dump.T type xs ys zs f_T_atom" %
              (m.dumpRate))
        hook.doAction('temp')
        hook.doAction('flux')
        hook.doAction('swap')

        # /* 定时输出速度文件用于计算速度关联函数*/
        if (m.dumpv):
            print("dump dump2 all custom %d dump.velocity type vx vy vz" %
                  (m.dumpRate))
            print("dump_modify  dump2 sort id")
        if m.dimension == 1:
            print("fix   1d1 all setforce NULL 0. 0.")
        print("run	%d" % (m.runTime))