示例#1
0
    def reduce(self, nd, *pn):
        from aces.qpointsyaml import phononyaml
        pya = phononyaml("qpoints/qpoints.yaml")
        nq = pya.nqpoint
        nbr = pya.nbranch
        import h5py
        nma = h5py.File('lifenma.h5')
        q = np.array(nma['/q/0/0'])
        n = len(q)
        v = np.zeros([nq * nbr, n])

        def onedir(dir, num):
            for idir in num:
                print(idir)
                nma = h5py.File(dir + '/%d/lifenma.h5' % idir)
                for i in range(nq):
                    for j in range(nbr):
                        node = '/q/%d/%d' % (i, j)
                        v[i * nbr + j, :] += np.array(nma[node])
            return len(num)

        N = 0
        for i in range(nd):
            dir, num = pn[i * 2:i * 2 + 2]
            N += onedir(dir, num)
        # N+=onedir('../q3.1',30)
        # N+=onedir('../q3.2',90)
        v /= N
        if tl.exists('phis.h5'):
            tl.passthru('rm phis.h5')
        phis = h5py.File('phis.h5')
        for i in range(nq):
            for j in range(nbr):
                node = '/%d/%d' % (i, j)
                phis[node] = v[i * nbr + j, :]
示例#2
0
    def reduce(self, nd, *pn):
        from aces.qpointsyaml import phononyaml
        pya = phononyaml("qpoints/qpoints.yaml")
        nq = pya.nqpoint
        nbr = pya.nbranch
        import h5py
        nma = h5py.File('lifenma.h5')
        q = np.array(nma['/q/0/0'])
        n = len(q)
        v = np.zeros([nq * nbr, n])

        def onedir(dir, num):
            for idir in num:
                print(idir)
                nma = h5py.File(dir + '/%d/lifenma.h5' % idir)
                for i in range(nq):
                    for j in range(nbr):
                        node = '/q/%d/%d' % (i, j)
                        v[i * nbr + j, :] += np.array(nma[node])
            return len(num)

        N = 0
        for i in range(nd):
            dir, num = pn[i * 2:i * 2 + 2]
            N += onedir(dir, num)
        # N+=onedir('../q3.1',30)
        # N+=onedir('../q3.2',90)
        v /= N
        if tl.exists('phis.h5'):
            tl.passthru('rm phis.h5')
        phis = h5py.File('phis.h5')
        for i in range(nq):
            for j in range(nbr):
                node = '/%d/%d' % (i, j)
                phis[node] = v[i * nbr + j, :]
示例#3
0
 def getvasprun(self, files):
     m = self.m
     maindir = pwd()
     if m.engine == "vasp":
         calculator = self.getVaspRun_vasp
     elif m.engine == "lammps":
         calculator = self.getVaspRun_lammps
     self.jm = jobManager()
     for file in files:
         print(file)
         dir = "dirs/dir_" + file
         mkdir(dir)
         mv(file, dir + '/POSCAR')
         cd(dir)
         calculator()
         cd(maindir)
     self.jm.run()
     if m.th:
         mkdir(m.pbsname)
         self.thcode(files, m.pbsname)
         cp("dirs", m.pbsname)
         passthru("tar zcf %s.tar.gz %s" % (m.pbsname, m.pbsname))
     print('start check')
     self.jm.check()
     if m.engine == "lammps1":
         from multiprocessing.dummy import Pool
         pool = Pool()
         pool.map_async(lammpsvasprun, files)
         pool.close()
         pool.join()
示例#4
0
文件: epw.py 项目: vanceeasleaf/aces
 def runepw1(self):
     m = self.m
     subcores = m.cores
     epw = config.mpirun + str(subcores) + \
         config.epw + " -npool " + str(subcores)
     cmd3 = epw + " <epw1.in > epw1.out"
     tl.passthru(cmd3)
示例#5
0
 def runepw1(self):
     m = self.m
     subcores = m.cores
     epw = config.mpirun + str(subcores) + \
         config.epw + " -npool " + str(subcores)
     cmd3 = epw + " <epw1.in > epw1.out"
     tl.passthru(cmd3)
示例#6
0
 def getvasprun(self, files):
     m = self.m
     maindir = pwd()
     if m.engine == "vasp":
         calculator = self.getVaspRun_vasp
     elif m.engine == "lammps":
         calculator = self.getVaspRun_lammps
     self.jm = jobManager()
     for file in files:
         print(file)
         dir = "dirs/dir_" + file
         mkdir(dir)
         mv(file, dir + '/POSCAR')
         cd(dir)
         calculator()
         cd(maindir)
     self.jm.run()
     if m.th:
         mkdir(m.pbsname)
         self.thcode(files, m.pbsname)
         cp("dirs", m.pbsname)
         passthru("tar zcf %s.tar.gz %s" % (m.pbsname, m.pbsname))
     print('start check')
     self.jm.check()
     if m.engine == "lammps1":
         from multiprocessing.dummy import Pool
         pool = Pool()
         pool.map_async(lammpsvasprun, files)
         pool.close()
         pool.join()
示例#7
0
def run(name):
	path=home(name)
	if not exists(path):
		workdir=shell_exec('pwd')
		cd(dirname(path))
		passthru("make")
		cd(workdir)
	passthru(path)
示例#8
0
文件: epw.py 项目: vanceeasleaf/aces
 def runbol(self):
     self.getwin()
     p = config.espresso + "bin/postw90.x"
     if not tl.exists(p):
         print("p not exists")
         return
     postw90 = self.getx("postw90", pool=False)
     tl.passthru(postw90 + " diam")
示例#9
0
 def runet(self):
     tl.cd('et')
     m = self.m
     if(m.soc):
         tl.passthru(config.x_trans_vasp + " BoltzTrap_vasp  -so")
     else:
         tl.passthru(config.x_trans_vasp + " BoltzTrap_vasp")
     tl.cd('..')
示例#10
0
 def runbol(self):
     self.getwin()
     p = config.espresso + "bin/postw90.x"
     if not tl.exists(p):
         print("p not exists")
         return
     postw90 = self.getx("postw90", pool=False)
     tl.passthru(postw90 + " diam")
示例#11
0
文件: epw.py 项目: vanceeasleaf/aces
 def rerunepw(self):
     m = self.m
     subcores = m.cores
     if not tl.exists('epw.in'):
         self.getepwin()
     epw = config.mpirun + str(subcores) + \
         config.epw + " -npool " + str(subcores)
     cmd3 = epw + " <epw.in > epw.out"
     tl.passthru(cmd3)
示例#12
0
 def caltc(self):
     m = self.m
     tl.passthru(config.phono3py + '  --dim="' + m.dim +
                 '" -c POSCAR --mesh="' + ' '.join(map(str, m.kpoints)) +
                 '" --fc3 --fc2  --thm --br')
     filename = "kappa-m%s.hdf5" % ''.join(map(str, m.kpoints))
     tl.passthru(config.pypath + 'kaccum   --mesh="' +
                 ' '.join(map(str, m.kpoints)) + '"  POSCAR ' + filename +
                 ' |tee kaccum.dat')
示例#13
0
 def rerunepw(self):
     m = self.m
     subcores = m.cores
     if not tl.exists('epw.in'):
         self.getepwin()
     epw = config.mpirun + str(subcores) + \
         config.epw + " -npool " + str(subcores)
     cmd3 = epw + " <epw.in > epw.out"
     tl.passthru(cmd3)
示例#14
0
    def modulation(self):
        m = self.m
        conf = """
        DIM = %s
        MODULATION = 1 1 1, 0 0 0 0 1 0
        ATOM_NAME = %s
        FORCE_CONSTANTS = READ
        """ % (m.dim, ' '.join(m.elements))
        write(conf, 'modulation.conf')

        passthru(config.phonopy + "--tolerance=1e-4    modulation.conf")
示例#15
0
 def getV(self):
     if not exists('groupv'):
         mkdir('groupv')
     cd('groupv')
     cp('../FORCE_CONSTANTS', '.')
     cp('../POSCAR', '.')
     cp('../disp.yaml', '.')
     self.generate_vconf()
     passthru(config.phonopy + "--tolerance=1e-4    v.conf")
     self.drawV()
     cd('..')
示例#16
0
    def modulation(self):
        m = self.m
        conf = """
        DIM = %s
        MODULATION = 1 1 1, 0 0 0 0 1 0
        ATOM_NAME = %s
        FORCE_CONSTANTS = READ
        """ % (m.dim, ' '.join(m.elements))
        write(conf, 'modulation.conf')

        passthru(config.phonopy + "--tolerance=1e-4    modulation.conf")
示例#17
0
 def getV(self):
     if not exists('groupv'):
         mkdir('groupv')
     cd('groupv')
     cp('../FORCE_CONSTANTS', '.')
     cp('../POSCAR', '.')
     cp('../disp.yaml', '.')
     self.generate_vconf()
     passthru(config.phonopy + "--tolerance=1e-4    v.conf")
     self.drawV()
     cd('..')
示例#18
0
 def force_constant(self, files):
     cmd = config.phono3py + "--cf3 "
     for file in files:
         dir = "dirs/dir_" + file
         cmd += dir + '/vasprun.xml '
     tl.write(cmd, 'post.sh')
     # generate FORCE_SETS
     tl.passthru("sh post.sh")
     m = self.m
     print("Create fc2.hdf and fc3.hdf")
     tl.passthru(config.phono3py + "-c POSCAR --dim='%s'" % (m.dim))
示例#19
0
    def animate(self):
        m = self.m
        conf = """
        DIM = %s
        ANIME = 0 5 20
        ANIME_TYPE = xyz
        ATOM_NAME = %s
        FORCE_CONSTANTS = READ
        """ % (m.dim, ' '.join(m.elements))
        write(conf, 'animate.conf')

        passthru(config.phonopy + "--tolerance=1e-4    animate.conf")
示例#20
0
    def animate(self):
        m = self.m
        conf = """
        DIM = %s
        ANIME = 0 5 20
        ANIME_TYPE = xyz
        ATOM_NAME = %s
        FORCE_CONSTANTS = READ
        """ % (m.dim, ' '.join(m.elements))
        write(conf, 'animate.conf')

        passthru(config.phonopy + "--tolerance=1e-4    animate.conf")
示例#21
0
 def force_constant(self, files):
     cmd = config.phonopy + "-f "
     if exists("dir_SPOSCAR/vasprun.xml"):
         cmd = config.phonopy + "--fz dir_SPOSCAR/vasprun.xml "
     for file in files:
         dir = "dirs/dir_" + file
         cmd += dir + '/vasprun.xml '
     # generate FORCE_SETS
     passthru(cmd)
     m = self.m
     # Create FORCE_CONSTANTS
     passthru(config.phonopy + "--tolerance=1e-4  --writefc --dim='%s'" %
              (m.dim))
示例#22
0
 def force_constant(self, files):
     cmd = config.phonopy + "-f "
     if exists("dir_SPOSCAR/vasprun.xml"):
         cmd = config.phonopy + "--fz dir_SPOSCAR/vasprun.xml "
     for file in files:
         dir = "dirs/dir_" + file
         cmd += dir + '/vasprun.xml '
     # generate FORCE_SETS
     passthru(cmd)
     m = self.m
     # Create FORCE_CONSTANTS
     passthru(config.phonopy + "--tolerance=1e-4  --writefc --dim='%s'" %
              (m.dim))
示例#23
0
    def phanados(self):
        from aces.tools import read
        m = self.m
        s = """20
        1
        1
        %s
        2
        y
        
        1000
        y
        phana.dos.txt
        0
        """ % tl.toString(m.kpoints)
        s = s.replace(r'^\s+', '')
        tl.write(s, 'phana.dos.in')

        tl.passthru(config.phana + 'phonon.bin.%d <phana.dos.in' % m.Ctime)
        s = read('pdos.gnuplot')
        s = s.replace('pdos.eps', 'phana.dos.eps')
        tl.write(s, 'phana.dos.gnuplot')
        tl.passthru('rm pdos.gnuplot')
        tl.passthru('gnuplot phana.dos.gnuplot')
        tl.passthru('convert -rotate 90 phana.dos.eps phana.dos.png')
示例#24
0
    def sheng(self):

        self.writeFC()
        m = self.m
        from aces.runners.shengbte import runner as shengbte
        a = shengbte(m)
        tl.mkcd('SHENG')
        tl.cp('../FORCE_CONSTANTS_2ND', '.')
        tl.cp('../FORCE_CONSTANTS_3RD', '.')
        a.getControl()
        # Thermal conductivity calculation
        print("START SHENGBTE...")
        # passthru(config.mpirun+" %s "%m.cores+config.shengbte)
        tl.passthru(config.shengbte)
示例#25
0
    def phana(self):
        from aces.tools import read
        m = self.m
        bp = m.bandpath
        bpp = m.bandpoints
        v = ""
        for i in range(len(bp) - 1):
            v += "%s\n%s\n101\n" % (tl.toString(bpp[bp[i]]),
                                    tl.toString(bpp[bp[i + 1]]))
        s = """20
        1
        2
        phana.band.txt
        %sq
        0
        """ % v
        s = s.replace(r'^\s+', '')
        tl.write(s, 'phana.in')

        tl.passthru(config.phana + 'phonon.bin.%d <phana.in' % m.Ctime)
        s = read('pdisp.gnuplot')
        s = s.replace('pdisp.eps', 'phana.band.eps')
        tl.write(s, 'phana.band.gnuplot')
        tl.passthru('rm pdisp.gnuplot')
        tl.passthru('gnuplot phana.band.gnuplot')
        tl.passthru('convert -rotate 90 phana.band.eps phana.band.png')
示例#26
0
 def __exit__(self, type, value, trace):
     if self.legend:
         setLegend(pl, ncol=self.ncol)
     pl.savefig(self.filename, bbox_inches='tight', transparent=True)
     pl.close()
     if self.filename.find(".eps") > 0:
         try:
             import aces.tools as tl
             cmd = "convert %s %s" % (self.filename,
                                      self.filename.replace(
                                          ".eps",
                                          ".png"))
             tl.passthru(cmd)
         except Exception as e:
             print(e)
示例#27
0
 def getvqpoints(self, q):
     self.generate_vqconf(q)
     passthru(config.phonopy + "--tolerance=1e-4  q.conf")
     data = parseyaml('qpoints.yaml')
     file = open("v.txt", 'w')
     for phonon in data['phonon']:
         qp = phonon['q-position']
         for band in phonon['band']:
             frequency = band['frequency']
             v = np.array(band['group_velocity'])
             v = np.linalg.norm(v)
             print >> file, "%s\t%f\t%f" % ('\t'.join(map(
                 str, qp)), frequency, v)
     file.close()
     v = np.loadtxt('v.txt')
     plot((v[:, 3], 'Frequency (THz)'),
          (v[:, 4], 'Group Velocity (Angstrom/ps)'),
          'v_freq.png',
          grid=True,
          scatter=True)
示例#28
0
 def getvqpoints(self, q):
     self.generate_vqconf(q)
     passthru(config.phonopy + "--tolerance=1e-4  q.conf")
     data = parseyaml('qpoints.yaml')
     file = open("v.txt", 'w')
     for phonon in data['phonon']:
         qp = phonon['q-position']
         for band in phonon['band']:
             frequency = band['frequency']
             v = np.array(band['group_velocity'])
             v = np.linalg.norm(v)
             print >> file, "%s\t%f\t%f" % ('\t'.join(map(str, qp)),
                                            frequency, v)
     file.close()
     v = np.loadtxt('v.txt')
     plot(
         (v[:, 3], 'Frequency (THz)'), (v[:, 4],
                                        'Group Velocity (Angstrom/ps)'),
         'v_freq.png',
         grid=True,
         scatter=True)
示例#29
0
 def run_anphonin(self):
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " band.in > band.out")
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " dos.in > dos.out")
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " tc.in > tc.out")
示例#30
0
 def run_anphonin(self):
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " band.in > band.out")
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " dos.in > dos.out")
     tl.passthru(config.mpirun + str(self.m.cores) + config.anphon +
                 " tc.in > tc.out")
示例#31
0
def writePOTCAR(options, elements):
    dir = 'pot'  # LDA
    # paw:PAW-LDA
    # paw_gga:PAW-GGA-PW91
    # paw_pbe:PAW-GGA-PBE
    # pot:USPP-LDA
    # pot_GGA:USPP-GGA
    if not options.paw:
        if options.gga:
            dir = 'pot_GGA'
        else:
            dir = 'pot'
    else:
        if not options.gga:
            dir = 'paw'
        else:
            if options.pbe:
                dir = 'paw_pbe'
            else:
                dir = 'paw_gga'
    tl.passthru('cat "" >POTCAR')
    for ele in elements:
        file = config.vasppot + "/%s/%s/POTCAR" % (dir, ele)
        z = False
        if not tl.exists(file):
            file += '.Z'
            z = True
        assert tl.exists(file)
        if z:
            tl.passthru('zcat %s >> POTCAR' % file)
        else:
            tl.passthru('cat %s >> POTCAR' % file)
示例#32
0
def writePOTCAR(options, elements):
    dir = 'pot'  # LDA
    # paw:PAW-LDA
    # paw_gga:PAW-GGA-PW91
    # paw_pbe:PAW-GGA-PBE
    # pot:USPP-LDA
    # pot_GGA:USPP-GGA
    if not options.paw:
        if options.gga:
            dir = 'pot_GGA'
        else:
            dir = 'pot'
    else:
        if not options.gga:
            dir = 'paw'
        else:
            if options.pbe:
                dir = 'paw_pbe'
            else:
                dir = 'paw_gga'
    tl.passthru('cat "" >POTCAR')
    for ele in elements:
        file = config.vasppot + "/%s/%s/POTCAR" % (dir, ele)
        z = False
        if not tl.exists(file):
            file += '.Z'
            z = True
        assert tl.exists(file)
        if z:
            tl.passthru('zcat %s >> POTCAR' % file)
        else:
            tl.passthru('cat %s >> POTCAR' % file)
示例#33
0
文件: epw.py 项目: vanceeasleaf/aces
 def runw(self):
     self.getwin()
     wannier = self.getx("wannier90", pa=False)
     tl.passthru(wannier + " -pp diam")
     pw2w = self.getx("pw2wannier90", pool=False)
     tl.passthru(pw2w + "<diam.pw2wan >pw2wan.out")
     tl.passthru(wannier + "  diam")
     self.runbol()
示例#34
0
 def runw(self):
     self.getwin()
     wannier = self.getx("wannier90", pa=False)
     tl.passthru(wannier + " -pp diam")
     pw2w = self.getx("pw2wannier90", pool=False)
     tl.passthru(pw2w + "<diam.pw2wan >pw2wan.out")
     tl.passthru(wannier + "  diam")
     self.runbol()
示例#35
0
    def generate(self):
        m = self.m
        coordination = self.phontsAtoms()
        content0 = "species %d\n" % (len(m.elements)) + m.phontsmasses + """
D3_cutoff %f
kpoints %s 1
delta 0.005
numerical_2der T
numerical_3der T
iter_steps 3
pdos 0. 70. 200 10.
temp 60. 400. 10
AbInitio  T F
FP_interface LAMMPS
#phonons_only T
Lattice  1.0
%s
end
""" % (m.shengcut, m.toString(m.kpoints), coordination)
        tl.write(content0, 'phonons_input.dat')
        tl.passthru(config.phonts)  # generate many displacement files
        tl.mkdir('lammps')
        tl.cd('lammps')
        content = "units %s\n" % m.units
        content += """atom_style      charge
dimension       3
boundary        p p p
read_data       GENERIC
%s
%s
neighbor        1.1 bin
neigh_modify    every 1 delay 1 check yes
dump 1 all custom 1 *.dump id  fx fy fz
dump_modify 1 format "%%d %%30.20f %%30.20f %%30.20f"
dump_modify  1 sort id
run 0
""" % (m.masses, m.potential)
        tl.shell_exec("mv ../*.str .")
        strs = tl.shell_exec("ls *.str").split("\n")
        for str in strs:
            dir = str.replace("str", "dir")
            tl.mkdir(dir)
            tl.write(content.replace("GENERIC", str), dir + "/in")
            tl.mv(str, "%s/%s" % (dir, str))
            tl.cd(dir)
            tl.passthru(config.lammps + " <in >out.dat")
            tl.cd('..')
        dirs = tl.shell_exec("ls |grep dir").split("\n")
        for dir in dirs:
            print(dir)
            tl.cp(dir + "/0.dump", "../" + dir.replace("dir", "out"))
        tl.cp("1.0000.dir/out.dat", "../1.0000.out")
        tl.cd('..')
        content0 = content0.replace('AbInitio  T F', 'AbInitio  F T')
        tl.write(content0, 'phonons_input.dat')
        tl.passthru(config.phonts)
示例#36
0
    def generate(self):
        m = self.m
        coordination = self.phontsAtoms()
        content0 = "species %d\n" % (len(m.elements)) + m.phontsmasses + """
D3_cutoff %f
kpoints %s 1
delta 0.005
numerical_2der T
numerical_3der T
iter_steps 3
pdos 0. 70. 200 10.
temp 60. 400. 10
AbInitio  T F
FP_interface LAMMPS
#phonons_only T
Lattice  1.0
%s
end
""" % (m.shengcut, m.toString(m.kpoints), coordination)
        tl.write(content0, 'phonons_input.dat')
        tl.passthru(config.phonts)  # generate many displacement files
        tl.mkdir('lammps')
        tl.cd('lammps')
        content = "units %s\n" % m.units
        content += """atom_style      charge
dimension       3
boundary        p p p
read_data       GENERIC
%s
%s
neighbor        1.1 bin
neigh_modify    every 1 delay 1 check yes
dump 1 all custom 1 *.dump id  fx fy fz
dump_modify 1 format "%%d %%30.20f %%30.20f %%30.20f"
dump_modify  1 sort id
run 0
""" % (m.masses, m.potential)
        tl.shell_exec("mv ../*.str .")
        strs = tl.shell_exec("ls *.str").split("\n")
        for str in strs:
            dir = str.replace("str", "dir")
            tl.mkdir(dir)
            tl.write(content.replace("GENERIC", str), dir + "/in")
            tl.mv(str, "%s/%s" % (dir, str))
            tl.cd(dir)
            tl.passthru(config.lammps + " <in >out.dat")
            tl.cd('..')
        dirs = tl.shell_exec("ls |grep dir").split("\n")
        for dir in dirs:
            print(dir)
            tl.cp(dir + "/0.dump", "../" + dir.replace("dir", "out"))
        tl.cp("1.0000.dir/out.dat", "../1.0000.out")
        tl.cd('..')
        content0 = content0.replace('AbInitio  T F', 'AbInitio  F T')
        tl.write(content0, 'phonons_input.dat')
        tl.passthru(config.phonts)
示例#37
0
文件: build.py 项目: xiexingzhu/aces
if __name__=='__main__':
	from aces.tools import passthru
	from aces import config
	passthru(config.python+"setup.py build --build-lib=. --build-platlib=.")
示例#38
0
 def runph(self):
     if not tl.exists('ph.in'):
         self.getphin()
     ph = self.getx("ph")
     tl.passthru(ph + " < ph.in   > ph.out ")
示例#39
0
 def runnscf(self):
     if not tl.exists('nscf.in'):
         self.getnscfin()
     pw = self.getx("pw")
     tl.passthru(pw + " <nscf.in > nscf.out")
示例#40
0
 def getfcs(self):
     tl.passthru(config.alm + "< fit.in > fit.out")
     assert tl.exists("alm.fcs")
     assert tl.exists("alm.xml")
示例#41
0
 def displacements(self):
     tl.passthru(config.alm + "< alm.in > alm.out")
     files = tl.shell_exec("ls *pattern*").split()
     tl.passthru(config.almdisp + self.m.toString(files))
示例#42
0
 def pix(self, cmd):
     if tl.exists('dy.h5'):
         v = "-lv dy.h5"
     else:
         v = "dynaphopy.lammpstrj"
     tl.passthru("dynaphopy in.dy %s -ts %f %s" % (v, self.m.timestep, cmd))
示例#43
0
 def generate_supercells(self):
     m = self.m
     # generate supercells
     tl.passthru(config.phono3py + "-d --dim='%s' -c POSCAR" % (m.dim))
示例#44
0
 def getfcs(self):
     tl.passthru(config.alm + "< fit.in > fit.out")
     assert tl.exists("alm.fcs")
     assert tl.exists("alm.xml")
示例#45
0
文件: epw.py 项目: vanceeasleaf/aces
 def runph(self):
     if not tl.exists('ph.in'):
         self.getphin()
     ph = self.getx("ph")
     tl.passthru(ph + " < ph.in   > ph.out ")
示例#46
0
文件: epw.py 项目: vanceeasleaf/aces
 def runnscf(self):
     if not tl.exists('nscf.in'):
         self.getnscfin()
     pw = self.getx("pw")
     tl.passthru(pw + " <nscf.in > nscf.out")
示例#47
0
 def calculateLife(self, eigen, iqp, ibr):
     q = self.modeSed(eigen, iqp, ibr)
     if tl.exists('velocity.h5md'):
         tl.passthru('rm velocity.h5md')
     k, freq, vec = eigen
     return self.modefit(iqp, ibr, k, freq, q)
示例#48
0
 def force_constant(self):
     cmd = config.phonopy + "--fc dirs/dir_POSCAR001/vasprun.xml"
     tl.passthru(cmd)
示例#49
0
 def generate_supercells3(self):
     # generate supercells
     cmd = config.thirdorder + "sow" + self.getcut()
     print(cmd)
     passthru(cmd)
示例#50
0
 def displacements(self):
     tl.passthru(config.alm + "< alm.in > alm.out")
     files = tl.shell_exec("ls *pattern*").split()
     tl.passthru(config.almdisp + self.m.toString(files))
示例#51
0
 def runsheng(self):
     # Thermal conductivity calculation
     m = self.m
     print("START SHENGBTE...")
     passthru(config.mpirun + " %s " % (m.nodes * m.procs) +
              config.shengbte)
示例#52
0
    def generate(self):
        m = self.m
        self.get_structure()
        f = open("strain.lmp", "w")
        print >> f, "units %s" % m.units
        print >> f, "dimension 3"
        pbcx = "f"
        if m.vStrain:
            pbcx = "s"
        pbcy = pbcz = 's'
        if m.xp == 1:
            pbcx = 'p'
        if m.yp == 1:
            pbcy = 'p'
        if m.zp == 1:
            pbcz = 'p'
        print >> f, "boundary %s %s %s" % (pbcx, pbcy, pbcz)
        print >> f, "atom_style atomic"
        print >> f, "read_data   strain_structure"
        print >> f, "change_box	all	boundary %s %s %s" % (pbcx, pbcy, pbcz)
        print >> f, "lattice fcc 5"  # needed to define the regions
        print >> f, "thermo %d" % m.dumpRate
        print >> f, "thermo_modify     lost warn"
        print >> f, m.masses
        print >> f, m.potential
        print >> f, "timestep %f" % m.timestep
        print >> f, "reset_timestep 0"

        box = m.box
        deta = m.deta
        wfix = m.wfix
        xlo, xhi, ylo, yhi, zlo, zhi, lx, ly, lz = box
        fixl1 = xlo - deta
        fixl2 = fixl1 + deta * wfix
        fixr2 = xhi + deta
        fixr1 = fixr2 - deta * wfix
        if m.vStrain:
            runTime, content = self.vDeform()
        else:
            runTime, content = self.deform()
        print >> f, "region	stayl	block   %s  %s INF  INF INF  INF units box" % (
            fixl1, fixl2)
        print >> f, "region	stayr	block   %s  %s INF INF   INF  INF units box" % (
            fixr1, fixr2)
        print >> f, "region   stay    union  2 stayl stayr"
        print >> f, "region	main	block   %s  %s INF INF   INF  INF units box" % (
            fixl2, fixr1)
        print >> f, "group   stayl    region  stayl"
        print >> f, "group   stayr    region  stayr"
        print >> f, "group   stay    region  stay"
        print >> f, "group   main    region  main"
        print >> f, "velocity stay set 0 0 0"
        print >> f, "velocity main create %f %d mom yes rot yes dist gaussian" % (
            m.T, m.seed)
        #print >>f,"velocity stay set NULL 0 0"
        #print >>f,"fix force stay setforce  NULL 0 0"
        print >> f, "fix getEqu  main  nvt temp %f %f %f" % (m.T, m.T, m.dtime)
        print >> f, "dump dump1 all atom %d dump.lammpstrj" % (max(
            runTime / 1000, 1))
        print >> f, "dump_modify  dump1 sort id"
        print >> f, "run %d" % m.equTime
        print >> f, "unfix getEqu"

        print >> f, "reset_timestep 0"
        print >> f, "fix nve main nve"
        print >> f, "compute    disp all displace/atom"
        print >> f, "compute    s1 all stress/atom NULL"
        print >> f, "compute    rr stayr com"
        print >> f, "compute    rl stayl com"
        print >> f, "fix  2  main temp/berendsen %f %f 1" % (m.T, m.T)
        print >> f, "fix s all ave/atom 1 %d %d c_disp[1] c_s1[1] c_s1[2] c_s1[3] c_s1[4] c_s1[5] c_s1[6]" % (
            m.strainStep, m.strainStep)
        print >> f, "dump 1 all custom %d dump.tensile id  type xs ys zs f_s[1] f_s[1] f_s[2] f_s[3] f_s[4] f_s[5] f_s[6] f_s[7]" % m.strainStep
        print >> f, "dump_modify  1 sort id"
        print >> f, "variable lx equal c_rr[1]-c_rl[1]"
        print >> f, "variable pxx equal pxx"
        print >> f, "fix p all ave/time 1 %d %d v_lx v_pxx file  strain_stress.txt" % (
            m.strainStep, m.strainStep)
        #print >>f,"dump lala main custom %s velocity.txt id type vx vy vz"%m.Cinterval
        print >> f, content
        f.close()
        tl.passthru(config.mpirun + "  %s " % self.m.cores + config.lammps +
                    " <strain.lmp  >out.dat")
        self.post()