示例#1
0
def get_log_data(ia, T, key, Wis=range(1, 20)):

    path = '/space/tohekorh/ShearSlide/files/%s_%i/%s/' % (ia, T, key)
    data = []
    print path
    for x in os.walk(path):

        folder = x[0]
        if folder != path:
            print folder
            if query_yes_no('Take this folder?', default="yes"):
                W = int(folder.split('=')[1])
                if W in Wis:
                    for filen in os.listdir(folder):
                        if filen[-6:] == '.simul':
                            print filen
                            if query_yes_no('Take this file?', default="yes"):
                                fPath = folder + '/' + filen
                                Wval, L, wi, li, v = read_simul_params_file(
                                    fPath)[:5]

                                if wi != W: raise

                                logpath = fPath[:-6] + '.log'
                                trajpath = fPath[:-6] + '.traj'
                                atoms = PickleTrajectory(trajpath, 'r')[-1]
                                natoms = len(atoms)

                                data.append([
                                    wi, li, Wval, L, natoms, v,
                                    np.loadtxt(logpath)
                                ])

    return data
示例#2
0
def get_log_data(ia, T, key, Wis=range(1, 20)):

    path = "/space/tohekorh/ShearSlide/files/%s_%i/%s/" % (ia, T, key)
    data = []
    print path
    for x in os.walk(path):

        folder = x[0]
        if folder != path:
            print folder
            if query_yes_no("Take this folder?", default="yes"):
                W = int(folder.split("=")[1])
                if W in Wis:
                    for filen in os.listdir(folder):
                        if filen[-6:] == ".simul":
                            print filen
                            if query_yes_no("Take this file?", default="yes"):
                                fPath = folder + "/" + filen
                                Wval, L, wi, li, v = read_simul_params_file(fPath)[:5]

                                if wi != W:
                                    raise

                                logpath = fPath[:-6] + ".log"
                                trajpath = fPath[:-6] + ".traj"
                                atoms = PickleTrajectory(trajpath, "r")[-1]
                                natoms = len(atoms)

                                data.append([wi, li, Wval, L, natoms, v, np.loadtxt(logpath)])

    return data
示例#3
0
def hyster_study(edge, folder=None):

    if folder == None: folder = os.getcwd()

    print folder
    for fileC in os.listdir(folder):
        if fileC[-6:] == '.simul':
            fileC = folder + fileC
            _, length, _, _, v, T, dt, fric, dtheta, \
            thresZ, interval, deltaY, theta, M, edge   =   read_simul_params_file(fileC)
            mdfile = fileC[:-6] + '.traj'
            traj = PickleTrajectory(mdfile, 'r')
            atoms_init = traj[0]


            constraints, _, twist, rend_b, rend_t  =   get_constraints(atoms_init, edge, \
                                                                   bond, None, key = 'twist_p')

            #constraints, _, rend_b, rend_t     =   get_constraints(atoms_init, edge, \
            #                                                       bond, None, key = 'twist_p')
            atoms = traj[-1]
            atoms.set_constraint(constraints)

            vels = (traj[-2].positions - traj[-1].positions) / (interval * dt)
            atoms.set_velocities(vels)

            calc = LAMMPS(parameters=get_lammps_params())
            atoms.set_calculator(calc)

            view(atoms)
            dyn = Langevin(atoms, dt * units.fs, T * units.kB, fric)
            twist.set_angle(theta)
            dyn.run(10 * interval)
            view(atoms)

            traj_new = PickleTrajectory(fileC[:-6] + '_hyst.traj', 'w', atoms)
            mdlogf = fileC[:-6] + '_hyst.log'



            do_dynamics(mdlogf, atoms, dyn, rend_b, rend_t, v, dt, deltaY, \
                        theta, dtheta, length, thresZ, \
                        interval, traj_new, M, twist)

            mdhystf = fileC[:-6] + '_hyst.traj'
            logfile = fileC[:-6] + '.log'

            append_files(logfile, mdlogf, logfile[:-4] + '_comp.log')
            call([
                'ase-gui', mdfile, mdhystf, '-o', logfile[:-4] + '_comp.traj'
            ])
示例#4
0
def hyster_study(edge, folder = None):

    if folder == None:  folder  =   os.getcwd()
        
    print folder
    for fileC in os.listdir(folder):
        if fileC[-6:] == '.simul':
            fileC       =   folder + fileC
            _, length, _, _, v, T, dt, fric, dtheta, \
            thresZ, interval, deltaY, theta, M, edge   =   read_simul_params_file(fileC)
            mdfile      =   fileC[:-6] + '.traj'
            traj        =   PickleTrajectory(mdfile, 'r')
            atoms_init  =   traj[0]
            
            
            constraints, _, twist, rend_b, rend_t  =   get_constraints(atoms_init, edge, \
                                                                   bond, None, key = 'twist_p')
            
            #constraints, _, rend_b, rend_t     =   get_constraints(atoms_init, edge, \
            #                                                       bond, None, key = 'twist_p')
            atoms       =   traj[-1]
            atoms.set_constraint(constraints)
            
            
            
            vels        =   (traj[-2].positions - traj[-1].positions) / (interval * dt)
            atoms.set_velocities(vels)
            
            calc        =   LAMMPS(parameters=get_lammps_params()) 
            atoms.set_calculator(calc)
            
            view(atoms)
            dyn         =   Langevin(atoms, dt*units.fs, T*units.kB, fric)
            twist.set_angle(theta)
            dyn.run(10 * interval)
            view(atoms)
            
            traj_new=   PickleTrajectory(fileC[:-6] + '_hyst.traj', 'w', atoms)
            mdlogf  =   fileC[:-6] + '_hyst.log'
            
            
            
            do_dynamics(mdlogf, atoms, dyn, rend_b, rend_t, v, dt, deltaY, \
                        theta, dtheta, length, thresZ, \
                        interval, traj_new, M, twist)
            
            mdhystf =   fileC[:-6] + '_hyst.traj'
            logfile =   fileC[:-6] + '.log'
            
            append_files(logfile, mdlogf, logfile[:-4] + '_comp.log')
            call(['ase-gui', mdfile, mdhystf, '-o', logfile[:-4] + '_comp.traj'])            
示例#5
0
def get_datas(ia, T, key):

    path = '/space/tohekorh/ShearSlide/files/%s_%i/%s/' % (ia, T, key)
    data = []
    print path
    for x in os.walk(path):

        folder = x[0]
        if folder != path:
            print folder
            if query_yes_no('Take this folder?', default="yes"):
                W = int(folder.split('=')[1])
                for filen in os.listdir(folder):
                    if filen[-6:] == '.simul':
                        print filen
                        if query_yes_no('Take this file?', default="yes"):
                            fPath = folder + '/' + filen
                            wf, L, width_i, _, v, _, _, _, _, \
                            _, _, _, _,_, _   =   \
                                        read_simul_params_file(fPath)

                            if width_i != W:
                                print width_i, W
                                raise

                            logpath = fPath[:-6] + '.log'
                            with open(logpath, 'r') as f:
                                lines = f.readlines()
                                for i in range(0, len(lines)):
                                    line = lines[i]
                                    if line[:7] == '# Kink!':
                                        ne = lines[
                                            i -
                                            1]  # you may want to check that i < len(lines)
                                        shift_b, Rad_b, theta_b = ne.split(
                                            ' ')[1:4]
                                        Rad_b = float(L) / float(theta_b)

                                    elif line[:15] == '# Kink vanished':
                                        ne = lines[
                                            i -
                                            1]  # you may want to check that i < len(lines)
                                        shift_d, Rad_d, theta_d = ne.split(
                                            ' ')[1:4]
                                        Rad_d = float(L) / float(theta_d)

                                        break
                                data.append([wf, L, v, Rad_b, Rad_d])

    return data
示例#6
0
def get_datas(ia, T, key):

    path = "/space/tohekorh/ShearSlide/files/%s_%i/%s/" % (ia, T, key)
    data = []
    print path
    for x in os.walk(path):

        folder = x[0]
        if folder != path:
            print folder
            if query_yes_no("Take this folder?", default="yes"):
                W = int(folder.split("=")[1])
                for filen in os.listdir(folder):
                    if filen[-6:] == ".simul":
                        print filen
                        if query_yes_no("Take this file?", default="yes"):
                            fPath = folder + "/" + filen
                            wf, L, width_i, _, v, _, _, _, _, _, _, _, _, _, _ = read_simul_params_file(fPath)

                            if width_i != W:
                                print width_i, W
                                raise

                            logpath = fPath[:-6] + ".log"
                            with open(logpath, "r") as f:
                                lines = f.readlines()
                                for i in range(0, len(lines)):
                                    line = lines[i]
                                    if line[:7] == "# Kink!":
                                        ne = lines[i - 1]  # you may want to check that i < len(lines)
                                        shift_b, Rad_b, theta_b = ne.split(" ")[1:4]
                                        Rad_b = float(L) / float(theta_b)

                                    elif line[:15] == "# Kink vanished":
                                        ne = lines[i - 1]  # you may want to check that i < len(lines)
                                        shift_d, Rad_d, theta_d = ne.split(" ")[1:4]
                                        Rad_d = float(L) / float(theta_d)

                                        break
                                data.append([wf, L, v, Rad_b, Rad_d])

    return data