In many cases, you can use the "lattice", "region" and "create_atoms"
commands which come with LAMMPS. However if you need some bonded
interactions within each unit cell, for example for ice or calcite,
then you probably need to create a data file.
A data file which explicitly defines the positions of all the atoms.
I like this approach because files can be visualized in VMD using
topotools. You can create a data file using several scripts including
moltemplate or topotools.
The "ice_crystal" and"aluminum_crystal_strain" examples distributed
with moltemplate all contain 3-d crystals. The "ice_crystal" example
is most relevant to your situation, but I will attempt to write a very
quick and somewhat inadequate tutorial here, given the limited time I
have now:
Generally, if you want to do this using moltemplate to make a crystal,
you probably should define a unit-cell. Then you can use the "new"
command to make copies of this object. This does not have to be the
canonical (simplest, smallest) unit cell, and it does not need to be
rectangular. It needs to be a repeating subunit. It must have a
"Data Atoms" section containing atom coordinates and atomic charge.It
also usually contains a "Data Masses" section, an "In Settings" or
"Data Pair Coeffs" section defining pairwise forces between atoms in
the crystal, and "Data Bonds", "Data Angles", and associated coeffs
for these interactions, if you need bonds between atoms.
Here is a simple example of a unit cell for Aluminum (using atom_style
full) named "AlCell"
AlCell {
write("Data Atoms") {
$atom:AlC $mol @atom:Al 0.0 0.000 0.000 0.000
$atom:AlX $mol @atom:Al 0.0 0.000 2.025 2.025
$atom:AlY $mol @atom:Al 0.0 2.025 0.000 2.025
$atom:AlZ $mol @atom:Al 0.0 2.025 2.025 0.000
}
write_once("In Settings") {
pair_coeff * * Al99.eam.alloy Al
}
write_once("Data Masses") {
@atom:Al 27.0
}
write_once("In Init") {
units metal
atom_style full
pair_style eam/alloy
}
}
(Notes: The "$mol" molecule-counter is a place-holder. You could put
anything in its place. The "In Init" section is optional.)
After you have defined the unit cell, you can stack them together to
build a larger crystal. Suppose you want to build a larger crystal
containing Na*Nb*Nc copies of the unit cell. (Na, Nb, Nc are
integers).
In general you would use this command:
cells = new UnitCell
[Na].move(ax, ay, az)
[Nb].move(bx, by, bz)
[Nc].move(cx, cy, cz)
...where
ax, ay, az
bx, by, bz
cx, cy, cz
are the x,y,z numeric coordinates of the a, b, and c lattice vectors.
These do not need to be orthogonal. The coordinates of the atoms in
the "Data Atoms" section are moved in these directions. You can apply
additional transformations to these atoms later to shift the position
of the center of the crystal:
cells[*][*][*].move(x0, y0, z0)
------- Example1 ---------
Here is an example, creating a simple 3-D hexagonal periodic
arrangement of water molecules. This is the diamond-shaped water box
shown on the web page here:
http://www.moltemplate.org/images/nanotube+water/water_side_nopbc.jpg
http://www.moltemplate.org/images/nanotube+water/nanotube+walls+water_top_nopbc_t=0.jpg
(This happens not a stable arrangement. It will melt immediately.
In this example, the water molecules are defined in the "spce.lt"
file. We use them to make a box of water this way:
import "spce.lt"
# Create a hexagonal box of water.
wat = new SPCE [9].move(3.5526287, 0, 0 )
[9].move(1.77631435, 3.3133, 0 )
[6].move( 0, 0, 3.45)
# Optional: Center the water box at the origin.
wat[*][*][*].move(-23.9802437, -14.90985, 11.47)
------- Example 2 -------
Suppose, you have a more complicated crystal containing multiple
molecules in each unit cell. In that case you can use the "new"
command within the definition of the unit cell to make multiple copies
of the molecule. Then, after you have defined the unit-cell you can
use the "new" command again to make multiple copies of that unit cell.
This is what I did in the ice example.
I am reposting the "ice" unit cell I posted for you earlier. The file
"spce_ice_rect8.lt" (see attached), defines an object named
"SpceIceRect8" containing 8 water molecules using "wat = new
SPCE[2][2][2]". The [2][2][2] was optional. I could have also used
"wat = new SPCE[8]" (It is a little bit confusing because in this
case, I did not use "move" commands to specify their location.
Instead it was easier to simply overwrite their coordinates by
defining a new "Data Atoms" section inside "SpceIceRect8". That works
too) Then, in "system.lt" (see attached), I created 3x2x2=12 copies
of this unit cell using:
cells = new SpceIceRect8 [3].move(4.521, 0.0, 0.0)
[2].move( 0.0, 7.832, 0.0)
[2].move( 0.0, 0.0, 7.362)
I don't know if this helps, but it is the best I can do given the
limited internet access I have right now. I will have limited
internet access for a few days.
Cheers
Andrew
spce.lt (1.43 KB)
spce_ice_rect8.lt (3.43 KB)
system.lt (281 Bytes)