Error in using lattice custom command

Hello. I have been learning LAMMPS not for a long time, so I may have misunderstandings of the language.
I am currently trying to calculate lattice constant for Cobalt as the way the tutorial did.
Only difference is that since Cobalt has a HCP structure, I have to use lattice custom command to get the proper structure.

From the Materials project data base, I found the structure information of Cobalt as following;

cell_length_a 2.50078315
cell_length_b 2.500783155
cell_length_c 4.03333112
cell_angle_alpha 90
cell_angle_beta 90
cell_angle_gamma 120
(atom_site_fract_x, atom_site_fract_y, atom_site_fract_z)=
1st atom (0.333333 0.666667 0.25)
2nd atom (0.666667 0.333333 0.75)

I did calculation for a1,a2, and a3 assuming that a1=(1,0,0).

I used an eam/alloy file type of potential function which has Ni and Co data.(Mishin-Ni-Co-2013.eam.alloy)

When I run the simulation, it gives me an error saying that
‘ERROR: No basis atoms in lattice (…/lattice.cpp:220)’

I guess I did something wrong while I used lattice custom command, but cannot figure it out. Any comment is very welcome.

Thanks,

The command lines for LAMMPS I used is as following;

---------- Initialize Simulation ---------------------

clear
units metal
dimension 3
boundary p p p
atom_style atomic
atom_modify map array

---------- Create Atoms ---------------------

lattice custom ${latconst}
region box block 0 1 0 1 0 1 units lattice
create_box 1 box

lattice custom ${latconst} a1 1.0 0.0 0.0 a2 -0.5 0.866 0.0 a3 0.0 0.0 1.612 &
basis 0.333 0.666 0.25 basis 0.666 0.333 0.75

create_atoms 1 box
replicate 1 1 1

---------- Define Interatomic Potential ---------------------

pair_style eam/alloy
pair_coeff * * Mishin-Ni-Co-2013.eam.alloy Co
neighbor 2.0 bin
neigh_modify delay 10 check yes

---------- Define Settings ---------------------

compute eng all pe/atom
compute eatoms all reduce sum c_eng

---------- Run Minimization ---------------------

reset_timestep 0
fix 1 all box/relax iso 0.0 vmax 0.001
thermo 10
thermo_style custom step pe lx ly lz press pxx pyy pzz c_eatoms
min_style cg
minimize 1e-25 1e-25 5000 10000

variable natoms equal “count(all)”
variable teng equal “c_eatoms”
variable lengthx equal “lx”
variable lengthy equal “ly”
variable lengthz equal “lz”
variable ecoh equal “v_teng/v_natoms”
variable ha1 equal “c_eng[1]”
variable ha2 equal “c_eng[2]”
variable ha3 equal “c_eng[3]”
variable ha4 equal “c_eng[4]”

print “Total energy (eV) = {teng};" print "Number of atoms = {natoms};”
print “Lattice constant x (Angstoms) = {lengthx};" print "Lattice constant y (Angstoms) = {lengthy};”
print “Lattice constant z (Angstoms) = {lengthz};" print "Cohesive energy (eV) = {ecoh};”
print “%% ecoh = {ecoh};" print "%% latc_x = {lengthx};”
print “%% latc_y = {lengthy};" print "%% latc_z = {lengthz};”
print “All done!”

Hello. I have been learning LAMMPS not for a long time, so I may have misunderstandings of the language.
I am currently trying to calculate lattice constant for Cobalt as the way the tutorial did.
Only difference is that since Cobalt has a HCP structure, I have to use lattice custom command to get the proper structure.

From the Materials project data base, I found the structure information of Cobalt as following;

cell_length_a 2.500783152.50078315
cell_length_b 2.5007831552.500783155
cell_length_c 4.03333112
cell_angle_alpha 90
cell_angle_beta 90
cell_angle_gamma 120
(atom_site_fract_x, atom_site_fract_y, atom_site_fract_z)=
1st atom (0.333333 0.666667 0.25)
2nd atom (0.666667 0.333333 0.75)

I did calculation for a1,a2, and a3 assuming that a1=(1,0,0).

I used an eam/alloy file type of potential function which has Ni and Co data.(Mishin-Ni-Co-2013.eam.alloy)

When I run the simulation, it gives me an error saying that
‘ERROR: No basis atoms in lattice (…/lattice.cpp:220)’

I guess I did something wrong while I used lattice custom command, but cannot figure it out. Any comment is very welcome.

Thanks,

The command lines for LAMMPS I used is as following;

---------- Initialize Simulation ---------------------

clear
units metal
dimension 3
boundary p p p
atom_style atomic
atom_modify map array

---------- Create Atoms ---------------------

lattice custom ${latconst}
region box block 0 1 0 1 0 1 units lattice
create_box 1 box

lattice custom ${latconst} a1 1.0 0.0 0.0 a2 -0.5 0.866 0.0 a3 0.0 0.0 1.612 &
basis 0.333 0.666 0.250.333 0.666 0.25 basis 0.666 0.333 0.75

create_atoms 1 box
replicate 1 1 1

---------- Define Interatomic Potential ---------------------

pair_style eam/alloy
pair_coeff * * Mishin-Ni-Co-2013.eam.alloy Co
neighbor 2.0 bin
neigh_modify delay 10 check yes

---------- Define Settings ---------------------

compute eng all pe/atom
compute eatoms all reduce sum c_eng

---------- Run Minimization ---------------------

reset_timestep 0
fix 1 all box/relax iso 0.0 vmax 0.001
thermo 10
thermo_style custom step pe lx ly lz press pxx pyy pzz c_eatoms
min_style cg
minimize 1e-25 1e-25 5000 1000025 5000 10000

variable natoms equal “count(all)”
variable teng equal “c_eatoms”
variable lengthx equal “lx”
variable lengthy equal “ly”
variable lengthz equal “lz”
variable ecoh equal “v_teng/v_natoms”
variable ha1 equal “c_eng[1]”
variable ha2 equal “c_eng[2]”
variable ha3 equal “c_eng[3]”
variable ha4 equal “c_eng[4]”

print “Total energy (eV) = {teng};" print "Number of atoms = {natoms};”
print “Lattice constant x (Angstoms) = {lengthx};" print "Lattice constant y (Angstoms) = {lengthy};”
print “Lattice constant z (Angstoms) = {lengthz};" print "Cohesive energy (eV) = {ecoh};”
print “%% ecoh = {ecoh};" print "%% latc_x = {lengthx};”
print “%% latc_y = {lengthy};" print "%% latc_z = {lengthz};”
print “All done!”

First, the lattice command does have an hcp option,though with a different unit cell and basis than you
are using. For a single element system I suggest
you use it. See the doc page for details.

Second, your command should work in principle.

attice custom ${latconst} a1 1.0 0.0 0.0 a2 -0.5 0.866 0.0 a3 0.0 0.0 1.612 &
basis 0.333 0.666 0.250.333 0.666 0.25 basis 0.666 0.333 0.75

you appear to have left out a basis keyword? Or have
some args run together? If you use -echo screen when
you run your script you should see the command the way
LAMMPS sees it. You should not get a “no basis atoms”
error if you have indeed defined basis atoms.

Steve