Problem with box size

214 views
Skip to first unread message

Nuno de Sousa

unread,
Oct 7, 2016, 5:52:32 AM10/7/16
to hoomd-users
Hello,

I start testing this software in the beginning of the week. 
However, I'm having some problems with the documentation.

I 'm trying to run a LJ fluid but I can't resize the box size. 

I'm using the following code:

box_edge = 60
r_min = 2

# initialize the execution context
context.initialize('--mode=cpu')

# Box of the system
box= data.boxdim(L=box_edge, xy=0.0, xz=0.0, yz=0.0)
 
system = init.create_lattice(unitcell=lattice.sc(a=r_min), n=10)
snapshot = system.take_snapshot(all=True)

# specify Lennard-Jones interactions between particle pairs
nl = md.nlist.cell()
lj = md.pair.lj(r_cut=3.0, nlist=nl)
lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=r_min/((2)**(1/6)))

# integrate with brownian dynamics
all = group.all();

md.integrate.mode_standard(dt=0.001)

result = md.integrate.langevin(group=all, kT=1.0, seed=5)

run(1e4, quiet = True)

However, when I print the system box by (system.box.Lx) appears 20 and not 60.

Another question (already asked but I could understand the answer) is: can we fixe the walls? Simulate a closed box? And a closed sphere?

Many thanks in advance

Joshua Anderson

unread,
Oct 7, 2016, 5:56:31 AM10/7/16
to hoomd...@googlegroups.com
You create a 10x10x10 simple cubic lattice with a=2. That sets your box dimension to 20. Nowhere do you  call update.box_resize, or make an assignment to system.box to change that. Thus, the behavior you see is expected.

HOOMD supports planar, spherical and cylindrical walls. See the documentation: http://hoomd-blue.readthedocs.io/en/stable/module-md-wall.html

------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
Phone: 734-647-8244
http://www-personal.umich.edu/~joaander/

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users+unsubscribe@googlegroups.com.
To post to this group, send email to hoomd...@googlegroups.com.
Visit this group at https://groups.google.com/group/hoomd-users.
For more options, visit https://groups.google.com/d/optout.

Nuno de Sousa

unread,
Oct 7, 2016, 6:02:38 AM10/7/16
to hoomd-users
Many thanks for your answer.

I'm going to copy the final script if anyone have the same problem.

Regards

box_edge = 60
r_min = 2

# initialize the execution context
context.initialize('--mode=cpu')
 
system = init.create_lattice(unitcell=lattice.sc(a=r_min), n=10)
snapshot = system.take_snapshot(all=True)

update.box_resize(L=box_edge)

# specify Lennard-Jones interactions between particle pairs
nl = md.nlist.cell()
lj = md.pair.lj(r_cut=3.0, nlist=nl)
lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=r_min/((2)**(1/6)))

# integrate with brownian dynamics
all = group.all();

md.integrate.mode_standard(dt=0.001)

result = md.integrate.langevin(group=all, kT=1.0, seed=5)

run(1e4, quiet = True)
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.

Nuno de Sousa

unread,
Oct 7, 2016, 12:23:18 PM10/7/16
to hoomd-users
A last question:

does anyone knows why this particle don't see the walls?
It seams that we walls are initiated.

box_edge = 19
r_min = 2

# initialize the execution context
context.initialize('--mode=cpu')

wallstructure=hoomd.md.wall.group()
wall_x = wallstructure.add_plane((box_edge/2, 0.0, 0.0),normal=(-1.0, 0.0, 0.0), inside=True)
wall_mx = wallstructure.add_plane((-box_edge/2, 0.0, 0.0),normal=(1.0, 0.0, 0.0), inside=True)
wall_y = wallstructure.add_plane((0.0, box_edge/2, 0.0),normal=(0.0, -1.0, 0.0), inside=True)
wall_my = wallstructure.add_plane((0.0, -box_edge/2, 0.0),normal=(0.0, 1.0, 0.0), inside=True)
wall_z = wallstructure.add_plane((0.0, 0.0, box_edge/2),normal=(0.0, 0.0, -1.0), inside=True)
wall_mz = wallstructure.add_plane((0.0, 0.0, -box_edge/2),normal=(0.0, 0.0, 1.0), inside=True)

#[wall_x,wall_mx,wall_y,wall_my,wall_z,wall_mz]
print(wallstructure)

# create a simple cubic lattice of 125 particles
system = init.create_lattice(unitcell=lattice.sc(a=r_min), n=1)
snapshot = system.take_snapshot(all=True)

# Box of the system
#update.box_resize(L=box_edge) # This works
system.box = hoomd.data.boxdim(L = box_edge)

# specify Lennard-Jones interactions between particle pairs
nl = md.nlist.cell()
lj = md.pair.lj(r_cut=3.0, nlist=nl)
lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=r_min/((2)**(1/6)))

# integrate with brownian dynamics
all = group.all();

md.integrate.mode_standard(dt=0.001)

#md.integrate.brownian(group=all, kT=0.1, seed=987)
result = md.integrate.langevin(group=all, kT=1.0000, seed=5)

#To output the data file
dump.dcd(filename="trajectory.dcd", period=100,overwrite=True)

# log the analysis of the file 
log = analyze.log(filename='test.txt', 
quantities=['time', 
'num_particles', 
'temperature', 
'potential_energy', 
'kinetic_energy'], period=100, overwrite = True) # header_prefix='#'

#log = analyze.log(filename=None, quantities=['num_particles'], period=100)
#N = log.query('num_particles')

# run 200,000 time steps
run(1e7, quiet = True)

Nuno de Sousa

unread,
Oct 7, 2016, 12:24:05 PM10/7/16
to hoomd-users
I want them to be rigid, like an infinite potential.


sexta-feira, 7 de Outubro de 2016 às 12:02:38 UTC+2, Nuno de Sousa escreveu:

Joshua Anderson

unread,
Oct 7, 2016, 12:37:29 PM10/7/16
to hoomd...@googlegroups.com
You define wallstructure and print it, but you do not apply a wall potential (i.e. wall.lj).

hoomd does not support hard walls for MD simulations (the hpmc component does for hard particle monte carlo).

------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
Phone: 734-647-8244
http://www-personal.umich.edu/~joaander/

To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users+unsubscribe@googlegroups.com.

Eric Irrgang

unread,
Oct 7, 2016, 1:36:21 PM10/7/16
to hoomd...@googlegroups.com
If the particles interact with each other with an LJ potential, doesn't it make sense to have the same repulsive potential when they interact with the wall? You can use an LJ wall, truncate and shift to have a WCA repulsion, which is pretty stiff anyway.

To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages