Exemplo n.º 1
0
# Particle setup
#############################################################

volume = box_l * box_l * box_l
n_part = int(volume * density)

for i in range(n_part):
    system.part[i].pos = numpy.random.random(3) * system.box_l

analyze.distto(system, 0)

print(
    "Simulate {} particles in a cubic simulation box {} at density {}.".format(
        n_part, box_l, density).strip())
print("Interactions:\n")
act_min_dist = analyze.mindist(es)
print("Start with minimal distance {}".format(act_min_dist))

system.max_num_cells = 2744

# Assingn charge to particles
for i in range(n_part / 2 - 1):
    system.part[2 * i].q = -1.0
    system.part[2 * i + 1].q = 1.0
# P3M setup after charge assigned
#############################################################
p3m = electrostatics.P3M_GPU(bjerrum_length=1.0, accuracy=1e-2)
system.actors.add(p3m)

print("P3M parameter:\n")
p3m_params = p3m.getParams()
for i in range(n_part):
    system.part.add(id=i, pos=numpy.random.random(3) * system.box_l)

# Assingn charge to particles
for i in range(n_part / 2 - 1):
    system.part[2 * i].q = -1.0
    system.part[2 * i + 1].q = 1.0


# Warmup
#############################################################

lj_cap = 20
system.non_bonded_inter.set_force_cap(lj_cap)
i = 0
act_min_dist = analyze.mindist(system)
while (i < warm_n_times and act_min_dist < min_dist):
    integrate.integrate(warm_steps)
    # Warmup criterion
    act_min_dist = analyze.mindist(system)
    i += 1
    lj_cap = lj_cap + 10
    system.non_bonded_inter.set_force_cap(lj_cap)

lj_cap = 0
system.non_bonded_inter.set_force_cap(lj_cap)

# P3M setup after charge assigned
#############################################################
p3m = electrostatics.P3M(bjerrum_length=1.0, accuracy=1e-2)
system.actors.add(p3m)
Exemplo n.º 3
0
# Particle setup
#############################################################

volume = box_l * box_l * box_l
n_part = int(volume * density)

for i in range(n_part):
    system.part.add(id=i, pos=numpy.random.random(3) * system.box_l)

analyze.distto(system, 0)

print("Simulate {} particles in a cubic simulation box {} at density {}."
      .format(n_part, box_l, density).strip())
print("Interactions:\n")
act_min_dist = analyze.mindist(es)
print("Start with minimal distance {}".format(act_min_dist))

system.max_num_cells = 2744


# Assingn charge to particles
for i in range(n_part / 2 - 1):
    system.part[2 * i].q = -1.0
    system.part[2 * i + 1].q = 1.0

# P3M setup after charge assigned
#############################################################
p3m = electrostatics.P3M(bjerrum_length=1.0, accuracy=1e-2)
system.actors.add(p3m)
Exemplo n.º 4
0
# Particle setup
#############################################################

volume = box_l * box_l * box_l
n_part = int(volume * density)

for i in range(n_part):
    system.part.add(id=i, pos=numpy.random.random(3) * system.box_l)

analyze.distto(system, 0)

print(
    "Simulate {} particles in a cubic simulation box {} at density {}.".format(
        n_part, box_l, density).strip())
print("Interactions:\n")
act_min_dist = analyze.mindist(system)
print("Start with minimal distance {}".format(act_min_dist))

system.max_num_cells = 2744

mayavi = visualization.mayavi_live(system)

#############################################################
#  Warmup Integration                                       #
#############################################################

# open Observable file
obs_file = open("pylj_liquid.obs", "w")
obs_file.write("# Time\tE_tot\tE_kin\tE_pot\n")

print("""