I am trying to simulate the water and silicon interactions to get hands on lammps.
I have set the WATER variable to define where the water molecules go. However, when I create_atoms I get the error “Create_atoms region region does not exist”. I guess lammps recognise the WATER variable as region?
Could you please help me to find out the solution?
region WATER block -5 5 -5 5 10 50 units box
create_atoms 0 random 100 34564 region WATER mol WATER 25367 overlap 1.33
ERROR: Create_atoms region region does not exist (…/create_atoms.cpp:126)
Last command: create_atoms 0 random 100 34564 region WATER mol WATER 25367 overlap 1.33
Thank you
Please have a closer look at the documentation. There is no keyword “region”.
Now lammps can go through the input file. However, water molecules are missing in the dump file. With my own view I cannot find the mistake…
units real
atom_style full
boundary p p p
# Define the simulation box (ensure it covers the water and silicon regions)
region box block -5 5 -5 5 0 50
create_box 3 box bond/types 1 angle/types 1 &
extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
# Define atomic masses
mass 1 28.0855 # Silicon
mass 2 15.9994 # Oxygen (Water)
mass 3 1.008 # Hydrogen (Water)
# Silicon slab setup (using a diamond lattice for silicon)
lattice diamond 5.431
region silicon block -5 5 -5 5 0 10
create_atoms 1 region silicon
# Define hybrid pair style for both Lennard-Jones and Stillinger-Weber potentials
pair_style hybrid sw lj/cut/coul/cut 8.0
# Define Stillinger-Weber potential for silicon
pair_coeff * * sw Si.sw Si NULL NULL # Silicon interaction via SW potential
# Define Lennard-Jones for water and silicon-water interactions
pair_coeff 1 2 lj/cut/coul/cut 0.1521 3.1507 # Silicon-Oxygen interaction
pair_coeff 2 2 lj/cut/coul/cut 0.0 1.0 # Oxygen-Oxygen interaction in TIP3P
pair_coeff 2 3 lj/cut/coul/cut 0.0 1.0 # Oxygen-Hydrogen interaction in TIP3P
pair_coeff 1 3 lj/cut/coul/cut 0.0 1.0 # Silicon-Hydrogen interaction
pair_coeff 3 3 lj/cut/coul/cut 0.0 1.0 # Hydrogen-Hydrogen interaction
# Define the water molecule template from a file
molecule water tip3p.mol
# Define the water region above the silicon slab (expanded for more space)
region water block -8 8 -8 8 10 50 units box
# Create water molecules randomly in the 'water' region
create_atoms 0 random 100 34564 water mol water 25367 overlap 5.0
# Print the number of atoms after water molecule creation
variable natoms equal "count(all)"
print "Number of atoms after water molecule creation: ${natoms}"
# Group atoms by type
group silicon type 1
group oxygen type 2
group hydrogen type 3
# Print the number of atoms for each type
variable nSi equal count(silicon)
variable nO equal count(oxygen)
variable nH equal count(hydrogen)
print "Number of Silicon atoms: ${nSi}"
print "Number of Oxygen atoms: ${nO}"
print "Number of Hydrogen atoms: ${nH}"
# Apply a fix for time integration (NVT ensemble)
fix 1 all nvt temp 300.0 300.0 100.0
# Dump atomic trajectory every 1000 steps, include id and type
dump 1 all custom 1000 dump.silicon_water.lammpstrj id type xs ys zs
dump_modify 1 sort id
# Run the simulation for 20000 steps
run 20000
# Write final configuration
write_data final_silicon_water.data nocoeff
part of printed log:
...
38 Number of atoms after water molecule creation: 230
39 230 atoms in group silicon
40 0 atoms in group oxygen
41 0 atoms in group hydrogen
42 Number of Silicon atoms: 230
43 Number of Oxygen atoms: 0
44 Number of Hydrogen atoms: 0
45 Neighbor list info ...
...
Your post has two problems:
- this is a different question from the topic you started. this is violating forum etiquette rules. questions about different problems should be posted as a new topic
- your post is badly formatted and thus very difficult to read. just look at it. can you read it well? Please have a look at the forum guidelines which explain how to correctly quote text in forum posts.
I will open another post with the correct format.
Thank you for the advice.