def data(i): lmp1 = lammps() polymer = PyLammps(ptr=lmp1) x = 60 y = 30 z = 30 t = 1 polymer.units("lj") polymer.dimension(3) polymer.atom_style("bond") polymer.bond_style("harmonic") polymer.pair_style("lj/cut", 3) polymer.read_data("data.polymer") polymer.region("void cylinder x", 15, 15, 2, 29, 31) polymer.pair_coeff(1, 2, 2.5, 3) polymer.pair_coeff(1, 3, 2.5, 1.12) polymer.pair_coeff(2, 3, 2.5, 1.12) polymer.velocity("all create", t, 97287) polymer.group("polymer type", 1, 2) polymer.group("first type", 1) polymer.region("box block", 0, x, 0, y, 0, z) polymer.region("spherein sphere", 29, 15, 15, 2) polymer.region("boxin block", 27, 29, 13, 17, 13, 17) polymer.region("hemiin intersect", 2, "boxin spherein") x0 = polymer.atoms[0].position[0] y0 = polymer.atoms[0].position[1] z0 = polymer.atoms[0].position[2] r = lambda x0, y0, z0: np.sqrt((x0 - 29)**2 + (y0 - 15)**2 + (z0 - 15)**2) fx = lambda x0, y0, z0: 5 * (x0 - 29) / r(x0, y0, z0) fy = lambda x0, y0, z0: 5 * (y0 - 15) / r(x0, y0, z0) fz = lambda x0, y0, z0: 5 * (z0 - 15) / r(x0, y0, z0) polymer.fix(1, "polymer nve") polymer.fix(2, "polymer langevin", t, t, 1.5, np.random.randint(2, high=200000)) polymer.fix(3, "polymer spring tether", 10, i, "NULL NULL", 0) polymer.timestep(0.01) polymer.compute("com polymer com") polymer.variable("ftotal equal fcm(polymer,x)") polymer.variable("c equal c_com[1]") polymer.thermo_style("custom v_ftotal v_c") polymer.thermo(1) polymer.run(500000) l = polymer.runs[0][0][1][20000:] + [i] u = [np.mean(polymer.runs[0][0][0][20000:]), i] np.savetxt("trial%dmean.txt" % i, u) np.savetxt("trial%dall.txt" % i, l) return u
verbose=args.verbose) else: py_lmp = PyLammps(cmdargs=['-echo', 'both'], comm=mpi_comm) py_lmp.log('"' + log_path + '"') rod_params = rods.Rod_params() if mpi_rank == 0: rod_params.from_file(args.cfg_file) rod_params = mpi_comm.bcast(rod_params, root=0) # CREATE BASE OBJECTS model = rods.Rod_model(rod_params) simulation = rods.Simulation(py_lmp, model, run_args.temp, seed, output_folder) py_lmp.units("lj") py_lmp.dimension(3) py_lmp.boundary("p p p") py_lmp.lattice("sc", 1 / (run_args.cell_size**3)) py_lmp.region("box", "block", -run_args.num_cells / 2, run_args.num_cells / 2, -run_args.num_cells / 2, run_args.num_cells / 2, -run_args.num_cells / 2, run_args.num_cells / 2) simulation.setup("box") simulation.create_rods(box=None) # ROD DYNAMICS py_lmp.fix("thermostat", "all", "langevin", run_args.temp, run_args.temp, run_args.damp, seed) #, "zero yes") simulation.set_rod_dynamics("nve", opt=["mol", model.rod_states[0]]) py_lmp.neigh_modify("every 1 delay 1")