mirror of https://github.com/lammps/lammps.git
add check for compatible lattice command when calling create_atoms
without this check it is possibly to use the dimension keyword after using lattice and then create atoms with an unsuitable lattice setting
This commit is contained in:
parent
7e558e4628
commit
5c5774c8a4
|
@ -71,6 +71,20 @@ void CreateAtoms::command(int narg, char **arg)
|
|||
error->all(FLERR,"Cannot create_atoms after "
|
||||
"reading restart file with per-atom info");
|
||||
|
||||
// check for compatible lattice
|
||||
|
||||
int latsty = domain->lattice->style;
|
||||
if (domain->dimension == 2) {
|
||||
if (latsty == Lattice::SC || latsty == Lattice::BCC
|
||||
|| latsty == Lattice::FCC || latsty == Lattice::HCP
|
||||
|| latsty == Lattice::DIAMOND)
|
||||
error->all(FLERR,"Lattice style incompatible with simulation dimension");
|
||||
} else {
|
||||
if (latsty == Lattice::SQ ||latsty == Lattice::SQ2
|
||||
|| latsty == Lattice::HEX)
|
||||
error->all(FLERR,"Lattice style incompatible with simulation dimension");
|
||||
}
|
||||
|
||||
// parse arguments
|
||||
|
||||
if (narg < 2) error->all(FLERR,"Illegal create_atoms command");
|
||||
|
|
Loading…
Reference in New Issue