From c7b39283b1067a103450535a2d70b8f17870fe26 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Oct 2020 05:58:39 -0400 Subject: [PATCH 01/10] need to transfer molecule templates when using "replicate" --- src/replicate.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/replicate.cpp b/src/replicate.cpp index 7a8b5d28c2..296e099208 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -43,9 +43,6 @@ void Replicate::command(int narg, char **arg) error->all(FLERR,"Replicate command before simulation box is defined"); if (narg < 3 || narg > 4) error->all(FLERR,"Illegal replicate command"); - if (atom->molecular == Atom::TEMPLATE) - error->all(FLERR,"Cannot use replicate command with atom style template"); - int me = comm->me; int nprocs = comm->nprocs; @@ -162,6 +159,20 @@ void Replicate::command(int narg, char **arg) else atom = new Atom(lmp); atom->settings(old); + + // transfer molecule templates. needs to be done early for atom style template + + if (old->nmolecule) { + atom->molecules = (Molecule **) memory->smalloc((old->nmolecule)*sizeof(Molecule *), + "atom::molecules"); + atom->nmolecule = old->nmolecule; + for (int i = 0; i < old->nmolecule; ++i) + atom->molecules[i] = old->molecules[i]; + memory->sfree(old->molecules); + old->molecules = nullptr; + old->nmolecule = 0; + } + atom->create_avec(old->atom_style,old->avec->nargcopy,old->avec->argcopy,0); // check that new system will not be too large @@ -749,17 +760,19 @@ void Replicate::command(int narg, char **arg) error->all(FLERR,"Replicate did not assign all atoms correctly"); if (me == 0) { + const char *molstyle = ""; + if (atom->molecular == Atom::TEMPLATE) molstyle = "template "; if (atom->nbonds) { - utils::logmesg(lmp,fmt::format(" {} bonds\n",atom->nbonds)); + utils::logmesg(lmp,fmt::format(" {} {}bonds\n",atom->nbonds,molstyle)); } if (atom->nangles) { - utils::logmesg(lmp,fmt::format(" {} angles\n",atom->nangles)); + utils::logmesg(lmp,fmt::format(" {} {}angles\n",atom->nangles,molstyle)); } if (atom->ndihedrals) { - utils::logmesg(lmp,fmt::format(" {} dihedrals\n",atom->ndihedrals)); + utils::logmesg(lmp,fmt::format(" {} {}dihedrals\n",atom->ndihedrals,molstyle)); } if (atom->nimpropers) { - utils::logmesg(lmp,fmt::format(" {} impropers\n",atom->nimpropers)); + utils::logmesg(lmp,fmt::format(" {} {}impropers\n",atom->nimpropers,molstyle)); } } From f2b9db0de42227abbfbc3a2588a145762ceeb520 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Oct 2020 06:21:54 -0400 Subject: [PATCH 02/10] update atom style tester to test replicate for atom style template --- unittest/formats/test_atom_styles.cpp | 1544 ++++++++++++++----------- 1 file changed, 842 insertions(+), 702 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 2dcefab6dd..0bc4833fea 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -3480,193 +3480,193 @@ TEST_F(AtomStyleTest, template) lmp->input->one("atom_style template twomols"); lmp->input->one("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - EXPECT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 0); - EXPECT_EQ(lmp->atom->nlocal, 0); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_EQ(lmp->atom->nmax, 1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->nellipsoids, 0); - EXPECT_EQ(lmp->atom->nlines, 0); - EXPECT_EQ(lmp->atom->ntris, 0); - EXPECT_EQ(lmp->atom->nbodies, 0); - EXPECT_EQ(lmp->atom->nbonds, 0); - EXPECT_EQ(lmp->atom->nangles, 0); - EXPECT_EQ(lmp->atom->ndihedrals, 0); - EXPECT_EQ(lmp->atom->nimpropers, 0); - EXPECT_EQ(lmp->atom->ntypes, 0); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->ndihedraltypes, 0); - EXPECT_EQ(lmp->atom->nimpropertypes, 0); - EXPECT_EQ(lmp->atom->bond_per_atom, 0); - EXPECT_EQ(lmp->atom->angle_per_atom, 0); - EXPECT_EQ(lmp->atom->dihedral_per_atom, 0); - EXPECT_EQ(lmp->atom->improper_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_bond_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_angle_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_improper_per_atom, 0); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 0); + ASSERT_EQ(lmp->atom->nlocal, 0); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_EQ(lmp->atom->nmax, 1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->nellipsoids, 0); + ASSERT_EQ(lmp->atom->nlines, 0); + ASSERT_EQ(lmp->atom->ntris, 0); + ASSERT_EQ(lmp->atom->nbodies, 0); + ASSERT_EQ(lmp->atom->nbonds, 0); + ASSERT_EQ(lmp->atom->nangles, 0); + ASSERT_EQ(lmp->atom->ndihedrals, 0); + ASSERT_EQ(lmp->atom->nimpropers, 0); + ASSERT_EQ(lmp->atom->ntypes, 0); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->ndihedraltypes, 0); + ASSERT_EQ(lmp->atom->nimpropertypes, 0); + ASSERT_EQ(lmp->atom->bond_per_atom, 0); + ASSERT_EQ(lmp->atom->angle_per_atom, 0); + ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->improper_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - EXPECT_EQ(lmp->atom->sphere_flag, 0); - EXPECT_EQ(lmp->atom->ellipsoid_flag, 0); - EXPECT_EQ(lmp->atom->line_flag, 0); - EXPECT_EQ(lmp->atom->tri_flag, 0); - EXPECT_EQ(lmp->atom->body_flag, 0); - EXPECT_EQ(lmp->atom->peri_flag, 0); - EXPECT_EQ(lmp->atom->electron_flag, 0); - EXPECT_EQ(lmp->atom->wavepacket_flag, 0); - EXPECT_EQ(lmp->atom->sph_flag, 0); - EXPECT_EQ(lmp->atom->molecule_flag, 1); - EXPECT_EQ(lmp->atom->molindex_flag, 0); - EXPECT_EQ(lmp->atom->molatom_flag, 0); - EXPECT_EQ(lmp->atom->q_flag, 0); - EXPECT_EQ(lmp->atom->mu_flag, 0); - EXPECT_EQ(lmp->atom->rmass_flag, 0); - EXPECT_EQ(lmp->atom->radius_flag, 0); - EXPECT_EQ(lmp->atom->omega_flag, 0); - EXPECT_EQ(lmp->atom->torque_flag, 0); - EXPECT_EQ(lmp->atom->angmom_flag, 0); - EXPECT_EQ(lmp->atom->vfrac_flag, 0); - EXPECT_EQ(lmp->atom->spin_flag, 0); - EXPECT_EQ(lmp->atom->eradius_flag, 0); - EXPECT_EQ(lmp->atom->ervel_flag, 0); - EXPECT_EQ(lmp->atom->erforce_flag, 0); - EXPECT_EQ(lmp->atom->cs_flag, 0); - EXPECT_EQ(lmp->atom->csforce_flag, 0); - EXPECT_EQ(lmp->atom->vforce_flag, 0); - EXPECT_EQ(lmp->atom->ervelforce_flag, 0); - EXPECT_EQ(lmp->atom->etag_flag, 0); - EXPECT_EQ(lmp->atom->rho_flag, 0); - EXPECT_EQ(lmp->atom->esph_flag, 0); - EXPECT_EQ(lmp->atom->cv_flag, 0); - EXPECT_EQ(lmp->atom->vest_flag, 0); - EXPECT_EQ(lmp->atom->dpd_flag, 0); - EXPECT_EQ(lmp->atom->edpd_flag, 0); - EXPECT_EQ(lmp->atom->tdpd_flag, 0); - EXPECT_EQ(lmp->atom->mesont_flag, 0); - EXPECT_EQ(lmp->atom->sp_flag, 0); - EXPECT_EQ(lmp->atom->x0_flag, 0); - EXPECT_EQ(lmp->atom->smd_flag, 0); - EXPECT_EQ(lmp->atom->damage_flag, 0); - EXPECT_EQ(lmp->atom->contact_radius_flag, 0); - EXPECT_EQ(lmp->atom->smd_data_9_flag, 0); - EXPECT_EQ(lmp->atom->smd_stress_flag, 0); - EXPECT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - EXPECT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - EXPECT_EQ(lmp->atom->pdscale, 1.0); + ASSERT_EQ(lmp->atom->sphere_flag, 0); + ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); + ASSERT_EQ(lmp->atom->line_flag, 0); + ASSERT_EQ(lmp->atom->tri_flag, 0); + ASSERT_EQ(lmp->atom->body_flag, 0); + ASSERT_EQ(lmp->atom->peri_flag, 0); + ASSERT_EQ(lmp->atom->electron_flag, 0); + ASSERT_EQ(lmp->atom->wavepacket_flag, 0); + ASSERT_EQ(lmp->atom->sph_flag, 0); + ASSERT_EQ(lmp->atom->molecule_flag, 1); + ASSERT_EQ(lmp->atom->molindex_flag, 0); + ASSERT_EQ(lmp->atom->molatom_flag, 0); + ASSERT_EQ(lmp->atom->q_flag, 0); + ASSERT_EQ(lmp->atom->mu_flag, 0); + ASSERT_EQ(lmp->atom->rmass_flag, 0); + ASSERT_EQ(lmp->atom->radius_flag, 0); + ASSERT_EQ(lmp->atom->omega_flag, 0); + ASSERT_EQ(lmp->atom->torque_flag, 0); + ASSERT_EQ(lmp->atom->angmom_flag, 0); + ASSERT_EQ(lmp->atom->vfrac_flag, 0); + ASSERT_EQ(lmp->atom->spin_flag, 0); + ASSERT_EQ(lmp->atom->eradius_flag, 0); + ASSERT_EQ(lmp->atom->ervel_flag, 0); + ASSERT_EQ(lmp->atom->erforce_flag, 0); + ASSERT_EQ(lmp->atom->cs_flag, 0); + ASSERT_EQ(lmp->atom->csforce_flag, 0); + ASSERT_EQ(lmp->atom->vforce_flag, 0); + ASSERT_EQ(lmp->atom->ervelforce_flag, 0); + ASSERT_EQ(lmp->atom->etag_flag, 0); + ASSERT_EQ(lmp->atom->rho_flag, 0); + ASSERT_EQ(lmp->atom->esph_flag, 0); + ASSERT_EQ(lmp->atom->cv_flag, 0); + ASSERT_EQ(lmp->atom->vest_flag, 0); + ASSERT_EQ(lmp->atom->dpd_flag, 0); + ASSERT_EQ(lmp->atom->edpd_flag, 0); + ASSERT_EQ(lmp->atom->tdpd_flag, 0); + ASSERT_EQ(lmp->atom->mesont_flag, 0); + ASSERT_EQ(lmp->atom->sp_flag, 0); + ASSERT_EQ(lmp->atom->x0_flag, 0); + ASSERT_EQ(lmp->atom->smd_flag, 0); + ASSERT_EQ(lmp->atom->damage_flag, 0); + ASSERT_EQ(lmp->atom->contact_radius_flag, 0); + ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); + ASSERT_EQ(lmp->atom->smd_stress_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); + ASSERT_EQ(lmp->atom->pdscale, 1.0); - EXPECT_NE(lmp->atom->tag, nullptr); - EXPECT_NE(lmp->atom->type, nullptr); - EXPECT_NE(lmp->atom->mask, nullptr); - EXPECT_NE(lmp->atom->image, nullptr); - EXPECT_NE(lmp->atom->x, nullptr); - EXPECT_NE(lmp->atom->v, nullptr); - EXPECT_NE(lmp->atom->f, nullptr); - EXPECT_EQ(lmp->atom->q, nullptr); - EXPECT_EQ(lmp->atom->mu, nullptr); - EXPECT_EQ(lmp->atom->omega, nullptr); - EXPECT_EQ(lmp->atom->angmom, nullptr); - EXPECT_EQ(lmp->atom->torque, nullptr); - EXPECT_EQ(lmp->atom->radius, nullptr); - EXPECT_EQ(lmp->atom->rmass, nullptr); - EXPECT_EQ(lmp->atom->ellipsoid, nullptr); - EXPECT_EQ(lmp->atom->line, nullptr); - EXPECT_EQ(lmp->atom->tri, nullptr); - EXPECT_EQ(lmp->atom->body, nullptr); - EXPECT_NE(lmp->atom->molecule, nullptr); - EXPECT_NE(lmp->atom->molindex, nullptr); - EXPECT_NE(lmp->atom->molatom, nullptr); - EXPECT_EQ(lmp->atom->num_bond, nullptr); - EXPECT_EQ(lmp->atom->bond_type, nullptr); - EXPECT_EQ(lmp->atom->bond_atom, nullptr); - EXPECT_EQ(lmp->atom->num_angle, nullptr); - EXPECT_EQ(lmp->atom->angle_type, nullptr); - EXPECT_EQ(lmp->atom->angle_atom1, nullptr); - EXPECT_EQ(lmp->atom->angle_atom2, nullptr); - EXPECT_EQ(lmp->atom->angle_atom3, nullptr); - EXPECT_EQ(lmp->atom->num_dihedral, nullptr); - EXPECT_EQ(lmp->atom->dihedral_type, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom1, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom2, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom3, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom4, nullptr); - EXPECT_EQ(lmp->atom->num_improper, nullptr); - EXPECT_EQ(lmp->atom->improper_type, nullptr); - EXPECT_EQ(lmp->atom->improper_atom1, nullptr); - EXPECT_EQ(lmp->atom->improper_atom2, nullptr); - EXPECT_EQ(lmp->atom->improper_atom3, nullptr); - EXPECT_EQ(lmp->atom->improper_atom4, nullptr); - EXPECT_EQ(lmp->atom->maxspecial, 1); - EXPECT_EQ(lmp->atom->nspecial, nullptr); - EXPECT_EQ(lmp->atom->special, nullptr); - EXPECT_EQ(lmp->atom->vfrac, nullptr); - EXPECT_EQ(lmp->atom->s0, nullptr); - EXPECT_EQ(lmp->atom->x0, nullptr); - EXPECT_EQ(lmp->atom->sp, nullptr); - EXPECT_EQ(lmp->atom->fm, nullptr); - EXPECT_EQ(lmp->atom->fm_long, nullptr); - EXPECT_EQ(lmp->atom->spin, nullptr); - EXPECT_EQ(lmp->atom->eradius, nullptr); - EXPECT_EQ(lmp->atom->ervel, nullptr); - EXPECT_EQ(lmp->atom->erforce, nullptr); - EXPECT_EQ(lmp->atom->ervelforce, nullptr); - EXPECT_EQ(lmp->atom->cs, nullptr); - EXPECT_EQ(lmp->atom->csforce, nullptr); - EXPECT_EQ(lmp->atom->vforce, nullptr); - EXPECT_EQ(lmp->atom->etag, nullptr); - EXPECT_EQ(lmp->atom->uCond, nullptr); - EXPECT_EQ(lmp->atom->uMech, nullptr); - EXPECT_EQ(lmp->atom->uChem, nullptr); - EXPECT_EQ(lmp->atom->uCG, nullptr); - EXPECT_EQ(lmp->atom->uCGnew, nullptr); - EXPECT_EQ(lmp->atom->duChem, nullptr); - EXPECT_EQ(lmp->atom->dpdTheta, nullptr); - EXPECT_EQ(lmp->atom->cc, nullptr); - EXPECT_EQ(lmp->atom->cc_flux, nullptr); - EXPECT_EQ(lmp->atom->edpd_temp, nullptr); - EXPECT_EQ(lmp->atom->edpd_flux, nullptr); - EXPECT_EQ(lmp->atom->edpd_cv, nullptr); - EXPECT_EQ(lmp->atom->length, nullptr); - EXPECT_EQ(lmp->atom->buckling, nullptr); - EXPECT_EQ(lmp->atom->bond_nt, nullptr); - EXPECT_EQ(lmp->atom->contact_radius, nullptr); - EXPECT_EQ(lmp->atom->smd_data_9, nullptr); - EXPECT_EQ(lmp->atom->smd_stress, nullptr); - EXPECT_EQ(lmp->atom->eff_plastic_strain, nullptr); - EXPECT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - EXPECT_EQ(lmp->atom->damage, nullptr); - EXPECT_EQ(lmp->atom->rho, nullptr); - EXPECT_EQ(lmp->atom->drho, nullptr); - EXPECT_EQ(lmp->atom->esph, nullptr); - EXPECT_EQ(lmp->atom->desph, nullptr); - EXPECT_EQ(lmp->atom->cv, nullptr); - EXPECT_EQ(lmp->atom->vest, nullptr); - EXPECT_EQ(lmp->atom->nmolecule, 2); - EXPECT_NE(lmp->atom->molecules, nullptr); - EXPECT_EQ(lmp->atom->nivector, 0); - EXPECT_EQ(lmp->atom->ndvector, 0); - EXPECT_EQ(lmp->atom->iname, nullptr); - EXPECT_EQ(lmp->atom->dname, nullptr); - EXPECT_EQ(lmp->atom->mass, nullptr); - EXPECT_EQ(lmp->atom->mass_setflag, nullptr); - EXPECT_EQ(lmp->atom->nextra_grow, 0); - EXPECT_EQ(lmp->atom->nextra_restart, 0); - EXPECT_EQ(lmp->atom->nextra_border, 0); - EXPECT_EQ(lmp->atom->nextra_grow_max, 0); - EXPECT_EQ(lmp->atom->nextra_restart_max, 0); - EXPECT_EQ(lmp->atom->nextra_border_max, 0); - EXPECT_EQ(lmp->atom->nextra_store, 0); - EXPECT_EQ(lmp->atom->extra_grow, nullptr); - EXPECT_EQ(lmp->atom->extra_restart, nullptr); - EXPECT_EQ(lmp->atom->extra_border, nullptr); - EXPECT_EQ(lmp->atom->extra, nullptr); - EXPECT_EQ(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->map_style, 3); - EXPECT_EQ(lmp->atom->map_user, 0); - EXPECT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_NE(lmp->atom->tag, nullptr); + ASSERT_NE(lmp->atom->type, nullptr); + ASSERT_NE(lmp->atom->mask, nullptr); + ASSERT_NE(lmp->atom->image, nullptr); + ASSERT_NE(lmp->atom->x, nullptr); + ASSERT_NE(lmp->atom->v, nullptr); + ASSERT_NE(lmp->atom->f, nullptr); + ASSERT_EQ(lmp->atom->q, nullptr); + ASSERT_EQ(lmp->atom->mu, nullptr); + ASSERT_EQ(lmp->atom->omega, nullptr); + ASSERT_EQ(lmp->atom->angmom, nullptr); + ASSERT_EQ(lmp->atom->torque, nullptr); + ASSERT_EQ(lmp->atom->radius, nullptr); + ASSERT_EQ(lmp->atom->rmass, nullptr); + ASSERT_EQ(lmp->atom->ellipsoid, nullptr); + ASSERT_EQ(lmp->atom->line, nullptr); + ASSERT_EQ(lmp->atom->tri, nullptr); + ASSERT_EQ(lmp->atom->body, nullptr); + ASSERT_NE(lmp->atom->molecule, nullptr); + ASSERT_NE(lmp->atom->molindex, nullptr); + ASSERT_NE(lmp->atom->molatom, nullptr); + ASSERT_EQ(lmp->atom->num_bond, nullptr); + ASSERT_EQ(lmp->atom->bond_type, nullptr); + ASSERT_EQ(lmp->atom->bond_atom, nullptr); + ASSERT_EQ(lmp->atom->num_angle, nullptr); + ASSERT_EQ(lmp->atom->angle_type, nullptr); + ASSERT_EQ(lmp->atom->angle_atom1, nullptr); + ASSERT_EQ(lmp->atom->angle_atom2, nullptr); + ASSERT_EQ(lmp->atom->angle_atom3, nullptr); + ASSERT_EQ(lmp->atom->num_dihedral, nullptr); + ASSERT_EQ(lmp->atom->dihedral_type, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); + ASSERT_EQ(lmp->atom->num_improper, nullptr); + ASSERT_EQ(lmp->atom->improper_type, nullptr); + ASSERT_EQ(lmp->atom->improper_atom1, nullptr); + ASSERT_EQ(lmp->atom->improper_atom2, nullptr); + ASSERT_EQ(lmp->atom->improper_atom3, nullptr); + ASSERT_EQ(lmp->atom->improper_atom4, nullptr); + ASSERT_EQ(lmp->atom->maxspecial, 1); + ASSERT_EQ(lmp->atom->nspecial, nullptr); + ASSERT_EQ(lmp->atom->special, nullptr); + ASSERT_EQ(lmp->atom->vfrac, nullptr); + ASSERT_EQ(lmp->atom->s0, nullptr); + ASSERT_EQ(lmp->atom->x0, nullptr); + ASSERT_EQ(lmp->atom->sp, nullptr); + ASSERT_EQ(lmp->atom->fm, nullptr); + ASSERT_EQ(lmp->atom->fm_long, nullptr); + ASSERT_EQ(lmp->atom->spin, nullptr); + ASSERT_EQ(lmp->atom->eradius, nullptr); + ASSERT_EQ(lmp->atom->ervel, nullptr); + ASSERT_EQ(lmp->atom->erforce, nullptr); + ASSERT_EQ(lmp->atom->ervelforce, nullptr); + ASSERT_EQ(lmp->atom->cs, nullptr); + ASSERT_EQ(lmp->atom->csforce, nullptr); + ASSERT_EQ(lmp->atom->vforce, nullptr); + ASSERT_EQ(lmp->atom->etag, nullptr); + ASSERT_EQ(lmp->atom->uCond, nullptr); + ASSERT_EQ(lmp->atom->uMech, nullptr); + ASSERT_EQ(lmp->atom->uChem, nullptr); + ASSERT_EQ(lmp->atom->uCG, nullptr); + ASSERT_EQ(lmp->atom->uCGnew, nullptr); + ASSERT_EQ(lmp->atom->duChem, nullptr); + ASSERT_EQ(lmp->atom->dpdTheta, nullptr); + ASSERT_EQ(lmp->atom->cc, nullptr); + ASSERT_EQ(lmp->atom->cc_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_temp, nullptr); + ASSERT_EQ(lmp->atom->edpd_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_cv, nullptr); + ASSERT_EQ(lmp->atom->length, nullptr); + ASSERT_EQ(lmp->atom->buckling, nullptr); + ASSERT_EQ(lmp->atom->bond_nt, nullptr); + ASSERT_EQ(lmp->atom->contact_radius, nullptr); + ASSERT_EQ(lmp->atom->smd_data_9, nullptr); + ASSERT_EQ(lmp->atom->smd_stress, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); + ASSERT_EQ(lmp->atom->damage, nullptr); + ASSERT_EQ(lmp->atom->rho, nullptr); + ASSERT_EQ(lmp->atom->drho, nullptr); + ASSERT_EQ(lmp->atom->esph, nullptr); + ASSERT_EQ(lmp->atom->desph, nullptr); + ASSERT_EQ(lmp->atom->cv, nullptr); + ASSERT_EQ(lmp->atom->vest, nullptr); + ASSERT_EQ(lmp->atom->nmolecule, 2); + ASSERT_NE(lmp->atom->molecules, nullptr); + ASSERT_EQ(lmp->atom->nivector, 0); + ASSERT_EQ(lmp->atom->ndvector, 0); + ASSERT_EQ(lmp->atom->iname, nullptr); + ASSERT_EQ(lmp->atom->dname, nullptr); + ASSERT_EQ(lmp->atom->mass, nullptr); + ASSERT_EQ(lmp->atom->mass_setflag, nullptr); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); + ASSERT_EQ(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->map_style, 3); + ASSERT_EQ(lmp->atom->map_user, 0); + ASSERT_EQ(lmp->atom->map_tag_max, -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 4 box bond/types 2 angle/types 2 "); @@ -3687,34 +3687,34 @@ TEST_F(AtomStyleTest, template) lmp->input->one("angle_coeff * 109.0"); lmp->input->one("pair_coeff * *"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - EXPECT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nellipsoids, 0); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_EQ(lmp->atom->nextra_grow, 0); - EXPECT_EQ(lmp->atom->nextra_restart, 0); - EXPECT_EQ(lmp->atom->nextra_border, 0); - EXPECT_EQ(lmp->atom->nextra_grow_max, 0); - EXPECT_EQ(lmp->atom->nextra_restart_max, 0); - EXPECT_EQ(lmp->atom->nextra_border_max, 0); - EXPECT_EQ(lmp->atom->nextra_store, 0); - EXPECT_EQ(lmp->atom->extra_grow, nullptr); - EXPECT_EQ(lmp->atom->extra_restart, nullptr); - EXPECT_EQ(lmp->atom->extra_border, nullptr); - EXPECT_EQ(lmp->atom->extra, nullptr); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nellipsoids, 0); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); - EXPECT_NE(lmp->atom->mass, nullptr); - EXPECT_NE(lmp->atom->mass_setflag, nullptr); + ASSERT_NE(lmp->atom->mass, nullptr); + ASSERT_NE(lmp->atom->mass_setflag, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("write_data test_atom_styles.data"); @@ -3729,66 +3729,66 @@ TEST_F(AtomStyleTest, template) lmp->input->one("atom_modify map array"); lmp->input->one("read_data test_atom_styles.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - EXPECT_NE(lmp->atom->avec, nullptr); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); + ASSERT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_NE(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); - EXPECT_EQ(lmp->atom->map_user, 1); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_NE(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); + ASSERT_EQ(lmp->atom->map_user, 1); + ASSERT_EQ(lmp->atom->map_tag_max, 12); auto molecule = lmp->atom->molecule; auto molindex = lmp->atom->molindex; auto molatom = lmp->atom->molatom; - EXPECT_EQ(molecule[GETIDX(1)], 1); - EXPECT_EQ(molecule[GETIDX(2)], 1); - EXPECT_EQ(molecule[GETIDX(3)], 1); - EXPECT_EQ(molecule[GETIDX(4)], 2); - EXPECT_EQ(molecule[GETIDX(5)], 2); - EXPECT_EQ(molecule[GETIDX(6)], 2); - EXPECT_EQ(molecule[GETIDX(7)], 3); - EXPECT_EQ(molecule[GETIDX(8)], 3); - EXPECT_EQ(molecule[GETIDX(9)], 3); - EXPECT_EQ(molecule[GETIDX(10)], 0); - EXPECT_EQ(molecule[GETIDX(11)], 0); - EXPECT_EQ(molecule[GETIDX(12)], 0); - EXPECT_EQ(molindex[GETIDX(1)], 0); - EXPECT_EQ(molindex[GETIDX(2)], 0); - EXPECT_EQ(molindex[GETIDX(3)], 0); - EXPECT_EQ(molindex[GETIDX(4)], 0); - EXPECT_EQ(molindex[GETIDX(5)], 0); - EXPECT_EQ(molindex[GETIDX(6)], 0); - EXPECT_EQ(molindex[GETIDX(7)], 0); - EXPECT_EQ(molindex[GETIDX(8)], 0); - EXPECT_EQ(molindex[GETIDX(9)], 0); - EXPECT_EQ(molindex[GETIDX(10)], -1); - EXPECT_EQ(molindex[GETIDX(11)], -1); - EXPECT_EQ(molindex[GETIDX(12)], -1); - EXPECT_EQ(molatom[GETIDX(1)], 0); - EXPECT_EQ(molatom[GETIDX(2)], 1); - EXPECT_EQ(molatom[GETIDX(3)], 2); - EXPECT_EQ(molatom[GETIDX(4)], 0); - EXPECT_EQ(molatom[GETIDX(5)], 1); - EXPECT_EQ(molatom[GETIDX(6)], 2); - EXPECT_EQ(molatom[GETIDX(7)], 0); - EXPECT_EQ(molatom[GETIDX(8)], 1); - EXPECT_EQ(molatom[GETIDX(9)], 2); - EXPECT_EQ(molatom[GETIDX(10)], -1); - EXPECT_EQ(molatom[GETIDX(11)], -1); - EXPECT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molecule[GETIDX(1)], 1); + ASSERT_EQ(molecule[GETIDX(2)], 1); + ASSERT_EQ(molecule[GETIDX(3)], 1); + ASSERT_EQ(molecule[GETIDX(4)], 2); + ASSERT_EQ(molecule[GETIDX(5)], 2); + ASSERT_EQ(molecule[GETIDX(6)], 2); + ASSERT_EQ(molecule[GETIDX(7)], 3); + ASSERT_EQ(molecule[GETIDX(8)], 3); + ASSERT_EQ(molecule[GETIDX(9)], 3); + ASSERT_EQ(molecule[GETIDX(10)], 0); + ASSERT_EQ(molecule[GETIDX(11)], 0); + ASSERT_EQ(molecule[GETIDX(12)], 0); + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(7)], 0); + ASSERT_EQ(molindex[GETIDX(8)], 0); + ASSERT_EQ(molindex[GETIDX(9)], 0); + ASSERT_EQ(molindex[GETIDX(10)], -1); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], 0); + ASSERT_EQ(molatom[GETIDX(8)], 1); + ASSERT_EQ(molatom[GETIDX(9)], 2); + ASSERT_EQ(molatom[GETIDX(10)], -1); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -3801,54 +3801,54 @@ TEST_F(AtomStyleTest, template) lmp->input->one("atom_modify map array"); lmp->input->one("read_data test_atom_styles.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - EXPECT_NE(lmp->atom->avec, nullptr); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); + ASSERT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_NE(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); - EXPECT_EQ(lmp->atom->map_user, 1); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_NE(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); + ASSERT_EQ(lmp->atom->map_user, 1); + ASSERT_EQ(lmp->atom->map_tag_max, 12); molecule = lmp->atom->molecule; molindex = lmp->atom->molindex; molatom = lmp->atom->molatom; - EXPECT_EQ(molindex[GETIDX(1)], 0); - EXPECT_EQ(molindex[GETIDX(2)], 0); - EXPECT_EQ(molindex[GETIDX(3)], 0); - EXPECT_EQ(molindex[GETIDX(4)], 0); - EXPECT_EQ(molindex[GETIDX(5)], 0); - EXPECT_EQ(molindex[GETIDX(6)], 0); - EXPECT_EQ(molindex[GETIDX(7)], 0); - EXPECT_EQ(molindex[GETIDX(8)], 0); - EXPECT_EQ(molindex[GETIDX(9)], 0); - EXPECT_EQ(molindex[GETIDX(10)], -1); - EXPECT_EQ(molindex[GETIDX(11)], -1); - EXPECT_EQ(molindex[GETIDX(12)], -1); - EXPECT_EQ(molatom[GETIDX(1)], 0); - EXPECT_EQ(molatom[GETIDX(2)], 1); - EXPECT_EQ(molatom[GETIDX(3)], 2); - EXPECT_EQ(molatom[GETIDX(4)], 0); - EXPECT_EQ(molatom[GETIDX(5)], 1); - EXPECT_EQ(molatom[GETIDX(6)], 2); - EXPECT_EQ(molatom[GETIDX(7)], 0); - EXPECT_EQ(molatom[GETIDX(8)], 1); - EXPECT_EQ(molatom[GETIDX(9)], 2); - EXPECT_EQ(molatom[GETIDX(10)], -1); - EXPECT_EQ(molatom[GETIDX(11)], -1); - EXPECT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(7)], 0); + ASSERT_EQ(molindex[GETIDX(8)], 0); + ASSERT_EQ(molindex[GETIDX(9)], 0); + ASSERT_EQ(molindex[GETIDX(10)], -1); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], 0); + ASSERT_EQ(molatom[GETIDX(8)], 1); + ASSERT_EQ(molatom[GETIDX(9)], 2); + ASSERT_EQ(molatom[GETIDX(10)], -1); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); auto x = lmp->atom->x; auto v = lmp->atom->v; @@ -3899,18 +3899,18 @@ TEST_F(AtomStyleTest, template) EXPECT_NEAR(v[GETIDX(12)][0], 0.0, EPSILON); EXPECT_NEAR(v[GETIDX(12)][1], 0.0, EPSILON); EXPECT_NEAR(v[GETIDX(12)][2], 0.0, EPSILON); - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(7)], 1); - EXPECT_EQ(type[GETIDX(8)], 2); - EXPECT_EQ(type[GETIDX(9)], 2); - EXPECT_EQ(type[GETIDX(10)], 3); - EXPECT_EQ(type[GETIDX(11)], 3); - EXPECT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(7)], 1); + ASSERT_EQ(type[GETIDX(8)], 2); + ASSERT_EQ(type[GETIDX(9)], 2); + ASSERT_EQ(type[GETIDX(10)], 3); + ASSERT_EQ(type[GETIDX(11)], 3); + ASSERT_EQ(type[GETIDX(12)], 4); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("group two id 7:10"); @@ -3919,50 +3919,119 @@ TEST_F(AtomStyleTest, template) lmp->input->one("clear"); lmp->input->one("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); lmp->input->one("read_restart test_atom_styles.restart"); - // FIXME. - // lmp->input->one("replicate 1 1 2 bbox"); + lmp->input->one("replicate 1 1 2 bbox"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - EXPECT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 8); - EXPECT_EQ(lmp->atom->nlocal, 8); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->q_flag, 0); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_EQ(lmp->atom->tag_consecutive(), 0); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 16); + ASSERT_EQ(lmp->atom->nbonds, 8); + ASSERT_EQ(lmp->atom->nangles, 4); + ASSERT_EQ(lmp->atom->nlocal, 16); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->q_flag, 0); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->tag_consecutive(), 0); + ASSERT_EQ(lmp->atom->map_tag_max, 24); type = lmp->atom->type; molecule = lmp->atom->molecule; molindex = lmp->atom->molindex; molatom = lmp->atom->molatom; - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(11)], 3); - EXPECT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(11)], 3); + ASSERT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(13)], 1); + ASSERT_EQ(type[GETIDX(14)], 2); + ASSERT_EQ(type[GETIDX(15)], 2); + ASSERT_EQ(type[GETIDX(16)], 1); + ASSERT_EQ(type[GETIDX(17)], 2); + ASSERT_EQ(type[GETIDX(18)], 2); + ASSERT_EQ(type[GETIDX(23)], 3); + ASSERT_EQ(type[GETIDX(24)], 4); + + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molindex[GETIDX(13)], 0); + ASSERT_EQ(molindex[GETIDX(14)], 0); + ASSERT_EQ(molindex[GETIDX(15)], 0); + ASSERT_EQ(molindex[GETIDX(16)], 0); + ASSERT_EQ(molindex[GETIDX(17)], 0); + ASSERT_EQ(molindex[GETIDX(18)], 0); + ASSERT_EQ(molindex[GETIDX(23)], -1); + ASSERT_EQ(molindex[GETIDX(24)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(13)], 0); + ASSERT_EQ(molatom[GETIDX(14)], 1); + ASSERT_EQ(molatom[GETIDX(15)], 2); + ASSERT_EQ(molatom[GETIDX(16)], 0); + ASSERT_EQ(molatom[GETIDX(17)], 1); + ASSERT_EQ(molatom[GETIDX(18)], 2); + ASSERT_EQ(molatom[GETIDX(23)], -1); + ASSERT_EQ(molatom[GETIDX(24)], -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("reset_atom_ids"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_tag_max, 8); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_tag_max, 16); - type = lmp->atom->type; - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(7)], 4); - EXPECT_EQ(type[GETIDX(8)], 3); + type = lmp->atom->type; + molecule = lmp->atom->molecule; + molindex = lmp->atom->molindex; + molatom = lmp->atom->molatom; + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(7)], 4); + ASSERT_EQ(type[GETIDX(8)], 3); + ASSERT_EQ(type[GETIDX(9)], 1); + ASSERT_EQ(type[GETIDX(10)], 2); + ASSERT_EQ(type[GETIDX(11)], 2); + ASSERT_EQ(type[GETIDX(12)], 1); + ASSERT_EQ(type[GETIDX(13)], 2); + ASSERT_EQ(type[GETIDX(14)], 2); + ASSERT_EQ(type[GETIDX(15)], 4); + ASSERT_EQ(type[GETIDX(16)], 3); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], -1); + ASSERT_EQ(molatom[GETIDX(8)], -1); + ASSERT_EQ(molatom[GETIDX(9)], 0); + ASSERT_EQ(molatom[GETIDX(10)], 1); + ASSERT_EQ(molatom[GETIDX(11)], 2); + ASSERT_EQ(molatom[GETIDX(12)], 0); + ASSERT_EQ(molatom[GETIDX(13)], 1); + ASSERT_EQ(molatom[GETIDX(14)], 2); + ASSERT_EQ(molatom[GETIDX(15)], -1); + ASSERT_EQ(molatom[GETIDX(16)], -1); } TEST_F(AtomStyleTest, template_charge) @@ -3983,191 +4052,191 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - EXPECT_EQ(lmp->atom->natoms, 0); - EXPECT_EQ(lmp->atom->nlocal, 0); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_EQ(lmp->atom->nmax, 1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->nellipsoids, 0); - EXPECT_EQ(lmp->atom->nlines, 0); - EXPECT_EQ(lmp->atom->ntris, 0); - EXPECT_EQ(lmp->atom->nbodies, 0); - EXPECT_EQ(lmp->atom->nbonds, 0); - EXPECT_EQ(lmp->atom->nangles, 0); - EXPECT_EQ(lmp->atom->ndihedrals, 0); - EXPECT_EQ(lmp->atom->nimpropers, 0); - EXPECT_EQ(lmp->atom->ntypes, 0); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->ndihedraltypes, 0); - EXPECT_EQ(lmp->atom->nimpropertypes, 0); - EXPECT_EQ(lmp->atom->bond_per_atom, 0); - EXPECT_EQ(lmp->atom->angle_per_atom, 0); - EXPECT_EQ(lmp->atom->dihedral_per_atom, 0); - EXPECT_EQ(lmp->atom->improper_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_bond_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_angle_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - EXPECT_EQ(lmp->atom->extra_improper_per_atom, 0); + ASSERT_EQ(lmp->atom->natoms, 0); + ASSERT_EQ(lmp->atom->nlocal, 0); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_EQ(lmp->atom->nmax, 1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->nellipsoids, 0); + ASSERT_EQ(lmp->atom->nlines, 0); + ASSERT_EQ(lmp->atom->ntris, 0); + ASSERT_EQ(lmp->atom->nbodies, 0); + ASSERT_EQ(lmp->atom->nbonds, 0); + ASSERT_EQ(lmp->atom->nangles, 0); + ASSERT_EQ(lmp->atom->ndihedrals, 0); + ASSERT_EQ(lmp->atom->nimpropers, 0); + ASSERT_EQ(lmp->atom->ntypes, 0); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->ndihedraltypes, 0); + ASSERT_EQ(lmp->atom->nimpropertypes, 0); + ASSERT_EQ(lmp->atom->bond_per_atom, 0); + ASSERT_EQ(lmp->atom->angle_per_atom, 0); + ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->improper_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - EXPECT_EQ(lmp->atom->sphere_flag, 0); - EXPECT_EQ(lmp->atom->ellipsoid_flag, 0); - EXPECT_EQ(lmp->atom->line_flag, 0); - EXPECT_EQ(lmp->atom->tri_flag, 0); - EXPECT_EQ(lmp->atom->body_flag, 0); - EXPECT_EQ(lmp->atom->peri_flag, 0); - EXPECT_EQ(lmp->atom->electron_flag, 0); - EXPECT_EQ(lmp->atom->wavepacket_flag, 0); - EXPECT_EQ(lmp->atom->sph_flag, 0); - EXPECT_EQ(lmp->atom->molecule_flag, 1); - EXPECT_EQ(lmp->atom->molindex_flag, 0); - EXPECT_EQ(lmp->atom->molatom_flag, 0); - EXPECT_EQ(lmp->atom->q_flag, 1); - EXPECT_EQ(lmp->atom->mu_flag, 0); - EXPECT_EQ(lmp->atom->rmass_flag, 0); - EXPECT_EQ(lmp->atom->radius_flag, 0); - EXPECT_EQ(lmp->atom->omega_flag, 0); - EXPECT_EQ(lmp->atom->torque_flag, 0); - EXPECT_EQ(lmp->atom->angmom_flag, 0); - EXPECT_EQ(lmp->atom->vfrac_flag, 0); - EXPECT_EQ(lmp->atom->spin_flag, 0); - EXPECT_EQ(lmp->atom->eradius_flag, 0); - EXPECT_EQ(lmp->atom->ervel_flag, 0); - EXPECT_EQ(lmp->atom->erforce_flag, 0); - EXPECT_EQ(lmp->atom->cs_flag, 0); - EXPECT_EQ(lmp->atom->csforce_flag, 0); - EXPECT_EQ(lmp->atom->vforce_flag, 0); - EXPECT_EQ(lmp->atom->ervelforce_flag, 0); - EXPECT_EQ(lmp->atom->etag_flag, 0); - EXPECT_EQ(lmp->atom->rho_flag, 0); - EXPECT_EQ(lmp->atom->esph_flag, 0); - EXPECT_EQ(lmp->atom->cv_flag, 0); - EXPECT_EQ(lmp->atom->vest_flag, 0); - EXPECT_EQ(lmp->atom->dpd_flag, 0); - EXPECT_EQ(lmp->atom->edpd_flag, 0); - EXPECT_EQ(lmp->atom->tdpd_flag, 0); - EXPECT_EQ(lmp->atom->mesont_flag, 0); - EXPECT_EQ(lmp->atom->sp_flag, 0); - EXPECT_EQ(lmp->atom->x0_flag, 0); - EXPECT_EQ(lmp->atom->smd_flag, 0); - EXPECT_EQ(lmp->atom->damage_flag, 0); - EXPECT_EQ(lmp->atom->contact_radius_flag, 0); - EXPECT_EQ(lmp->atom->smd_data_9_flag, 0); - EXPECT_EQ(lmp->atom->smd_stress_flag, 0); - EXPECT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - EXPECT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - EXPECT_EQ(lmp->atom->pdscale, 1.0); + ASSERT_EQ(lmp->atom->sphere_flag, 0); + ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); + ASSERT_EQ(lmp->atom->line_flag, 0); + ASSERT_EQ(lmp->atom->tri_flag, 0); + ASSERT_EQ(lmp->atom->body_flag, 0); + ASSERT_EQ(lmp->atom->peri_flag, 0); + ASSERT_EQ(lmp->atom->electron_flag, 0); + ASSERT_EQ(lmp->atom->wavepacket_flag, 0); + ASSERT_EQ(lmp->atom->sph_flag, 0); + ASSERT_EQ(lmp->atom->molecule_flag, 1); + ASSERT_EQ(lmp->atom->molindex_flag, 0); + ASSERT_EQ(lmp->atom->molatom_flag, 0); + ASSERT_EQ(lmp->atom->q_flag, 1); + ASSERT_EQ(lmp->atom->mu_flag, 0); + ASSERT_EQ(lmp->atom->rmass_flag, 0); + ASSERT_EQ(lmp->atom->radius_flag, 0); + ASSERT_EQ(lmp->atom->omega_flag, 0); + ASSERT_EQ(lmp->atom->torque_flag, 0); + ASSERT_EQ(lmp->atom->angmom_flag, 0); + ASSERT_EQ(lmp->atom->vfrac_flag, 0); + ASSERT_EQ(lmp->atom->spin_flag, 0); + ASSERT_EQ(lmp->atom->eradius_flag, 0); + ASSERT_EQ(lmp->atom->ervel_flag, 0); + ASSERT_EQ(lmp->atom->erforce_flag, 0); + ASSERT_EQ(lmp->atom->cs_flag, 0); + ASSERT_EQ(lmp->atom->csforce_flag, 0); + ASSERT_EQ(lmp->atom->vforce_flag, 0); + ASSERT_EQ(lmp->atom->ervelforce_flag, 0); + ASSERT_EQ(lmp->atom->etag_flag, 0); + ASSERT_EQ(lmp->atom->rho_flag, 0); + ASSERT_EQ(lmp->atom->esph_flag, 0); + ASSERT_EQ(lmp->atom->cv_flag, 0); + ASSERT_EQ(lmp->atom->vest_flag, 0); + ASSERT_EQ(lmp->atom->dpd_flag, 0); + ASSERT_EQ(lmp->atom->edpd_flag, 0); + ASSERT_EQ(lmp->atom->tdpd_flag, 0); + ASSERT_EQ(lmp->atom->mesont_flag, 0); + ASSERT_EQ(lmp->atom->sp_flag, 0); + ASSERT_EQ(lmp->atom->x0_flag, 0); + ASSERT_EQ(lmp->atom->smd_flag, 0); + ASSERT_EQ(lmp->atom->damage_flag, 0); + ASSERT_EQ(lmp->atom->contact_radius_flag, 0); + ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); + ASSERT_EQ(lmp->atom->smd_stress_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); + ASSERT_EQ(lmp->atom->pdscale, 1.0); - EXPECT_NE(lmp->atom->tag, nullptr); - EXPECT_NE(lmp->atom->type, nullptr); - EXPECT_NE(lmp->atom->mask, nullptr); - EXPECT_NE(lmp->atom->image, nullptr); - EXPECT_NE(lmp->atom->x, nullptr); - EXPECT_NE(lmp->atom->v, nullptr); - EXPECT_NE(lmp->atom->f, nullptr); - EXPECT_NE(lmp->atom->q, nullptr); - EXPECT_EQ(lmp->atom->mu, nullptr); - EXPECT_EQ(lmp->atom->omega, nullptr); - EXPECT_EQ(lmp->atom->angmom, nullptr); - EXPECT_EQ(lmp->atom->torque, nullptr); - EXPECT_EQ(lmp->atom->radius, nullptr); - EXPECT_EQ(lmp->atom->rmass, nullptr); - EXPECT_EQ(lmp->atom->ellipsoid, nullptr); - EXPECT_EQ(lmp->atom->line, nullptr); - EXPECT_EQ(lmp->atom->tri, nullptr); - EXPECT_EQ(lmp->atom->body, nullptr); - EXPECT_NE(lmp->atom->molecule, nullptr); - EXPECT_NE(lmp->atom->molindex, nullptr); - EXPECT_NE(lmp->atom->molatom, nullptr); - EXPECT_EQ(lmp->atom->num_bond, nullptr); - EXPECT_EQ(lmp->atom->bond_type, nullptr); - EXPECT_EQ(lmp->atom->bond_atom, nullptr); - EXPECT_EQ(lmp->atom->num_angle, nullptr); - EXPECT_EQ(lmp->atom->angle_type, nullptr); - EXPECT_EQ(lmp->atom->angle_atom1, nullptr); - EXPECT_EQ(lmp->atom->angle_atom2, nullptr); - EXPECT_EQ(lmp->atom->angle_atom3, nullptr); - EXPECT_EQ(lmp->atom->num_dihedral, nullptr); - EXPECT_EQ(lmp->atom->dihedral_type, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom1, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom2, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom3, nullptr); - EXPECT_EQ(lmp->atom->dihedral_atom4, nullptr); - EXPECT_EQ(lmp->atom->num_improper, nullptr); - EXPECT_EQ(lmp->atom->improper_type, nullptr); - EXPECT_EQ(lmp->atom->improper_atom1, nullptr); - EXPECT_EQ(lmp->atom->improper_atom2, nullptr); - EXPECT_EQ(lmp->atom->improper_atom3, nullptr); - EXPECT_EQ(lmp->atom->improper_atom4, nullptr); - EXPECT_EQ(lmp->atom->maxspecial, 1); - EXPECT_EQ(lmp->atom->nspecial, nullptr); - EXPECT_EQ(lmp->atom->special, nullptr); - EXPECT_EQ(lmp->atom->vfrac, nullptr); - EXPECT_EQ(lmp->atom->s0, nullptr); - EXPECT_EQ(lmp->atom->x0, nullptr); - EXPECT_EQ(lmp->atom->sp, nullptr); - EXPECT_EQ(lmp->atom->fm, nullptr); - EXPECT_EQ(lmp->atom->fm_long, nullptr); - EXPECT_EQ(lmp->atom->spin, nullptr); - EXPECT_EQ(lmp->atom->eradius, nullptr); - EXPECT_EQ(lmp->atom->ervel, nullptr); - EXPECT_EQ(lmp->atom->erforce, nullptr); - EXPECT_EQ(lmp->atom->ervelforce, nullptr); - EXPECT_EQ(lmp->atom->cs, nullptr); - EXPECT_EQ(lmp->atom->csforce, nullptr); - EXPECT_EQ(lmp->atom->vforce, nullptr); - EXPECT_EQ(lmp->atom->etag, nullptr); - EXPECT_EQ(lmp->atom->uCond, nullptr); - EXPECT_EQ(lmp->atom->uMech, nullptr); - EXPECT_EQ(lmp->atom->uChem, nullptr); - EXPECT_EQ(lmp->atom->uCG, nullptr); - EXPECT_EQ(lmp->atom->uCGnew, nullptr); - EXPECT_EQ(lmp->atom->duChem, nullptr); - EXPECT_EQ(lmp->atom->dpdTheta, nullptr); - EXPECT_EQ(lmp->atom->cc, nullptr); - EXPECT_EQ(lmp->atom->cc_flux, nullptr); - EXPECT_EQ(lmp->atom->edpd_temp, nullptr); - EXPECT_EQ(lmp->atom->edpd_flux, nullptr); - EXPECT_EQ(lmp->atom->edpd_cv, nullptr); - EXPECT_EQ(lmp->atom->length, nullptr); - EXPECT_EQ(lmp->atom->buckling, nullptr); - EXPECT_EQ(lmp->atom->bond_nt, nullptr); - EXPECT_EQ(lmp->atom->contact_radius, nullptr); - EXPECT_EQ(lmp->atom->smd_data_9, nullptr); - EXPECT_EQ(lmp->atom->smd_stress, nullptr); - EXPECT_EQ(lmp->atom->eff_plastic_strain, nullptr); - EXPECT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - EXPECT_EQ(lmp->atom->damage, nullptr); - EXPECT_EQ(lmp->atom->rho, nullptr); - EXPECT_EQ(lmp->atom->drho, nullptr); - EXPECT_EQ(lmp->atom->esph, nullptr); - EXPECT_EQ(lmp->atom->desph, nullptr); - EXPECT_EQ(lmp->atom->cv, nullptr); - EXPECT_EQ(lmp->atom->vest, nullptr); - EXPECT_EQ(lmp->atom->nmolecule, 2); - EXPECT_NE(lmp->atom->molecules, nullptr); - EXPECT_EQ(lmp->atom->nivector, 0); - EXPECT_EQ(lmp->atom->ndvector, 0); - EXPECT_EQ(lmp->atom->iname, nullptr); - EXPECT_EQ(lmp->atom->dname, nullptr); - EXPECT_EQ(lmp->atom->mass, nullptr); - EXPECT_EQ(lmp->atom->mass_setflag, nullptr); - EXPECT_EQ(lmp->atom->nextra_grow, 0); - EXPECT_EQ(lmp->atom->nextra_restart, 0); - EXPECT_EQ(lmp->atom->nextra_border, 0); - EXPECT_EQ(lmp->atom->nextra_grow_max, 0); - EXPECT_EQ(lmp->atom->nextra_restart_max, 0); - EXPECT_EQ(lmp->atom->nextra_border_max, 0); - EXPECT_EQ(lmp->atom->nextra_store, 0); - EXPECT_EQ(lmp->atom->extra_grow, nullptr); - EXPECT_EQ(lmp->atom->extra_restart, nullptr); - EXPECT_EQ(lmp->atom->extra_border, nullptr); - EXPECT_EQ(lmp->atom->extra, nullptr); - EXPECT_EQ(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->map_style, 3); - EXPECT_EQ(lmp->atom->map_user, 0); - EXPECT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_NE(lmp->atom->tag, nullptr); + ASSERT_NE(lmp->atom->type, nullptr); + ASSERT_NE(lmp->atom->mask, nullptr); + ASSERT_NE(lmp->atom->image, nullptr); + ASSERT_NE(lmp->atom->x, nullptr); + ASSERT_NE(lmp->atom->v, nullptr); + ASSERT_NE(lmp->atom->f, nullptr); + ASSERT_NE(lmp->atom->q, nullptr); + ASSERT_EQ(lmp->atom->mu, nullptr); + ASSERT_EQ(lmp->atom->omega, nullptr); + ASSERT_EQ(lmp->atom->angmom, nullptr); + ASSERT_EQ(lmp->atom->torque, nullptr); + ASSERT_EQ(lmp->atom->radius, nullptr); + ASSERT_EQ(lmp->atom->rmass, nullptr); + ASSERT_EQ(lmp->atom->ellipsoid, nullptr); + ASSERT_EQ(lmp->atom->line, nullptr); + ASSERT_EQ(lmp->atom->tri, nullptr); + ASSERT_EQ(lmp->atom->body, nullptr); + ASSERT_NE(lmp->atom->molecule, nullptr); + ASSERT_NE(lmp->atom->molindex, nullptr); + ASSERT_NE(lmp->atom->molatom, nullptr); + ASSERT_EQ(lmp->atom->num_bond, nullptr); + ASSERT_EQ(lmp->atom->bond_type, nullptr); + ASSERT_EQ(lmp->atom->bond_atom, nullptr); + ASSERT_EQ(lmp->atom->num_angle, nullptr); + ASSERT_EQ(lmp->atom->angle_type, nullptr); + ASSERT_EQ(lmp->atom->angle_atom1, nullptr); + ASSERT_EQ(lmp->atom->angle_atom2, nullptr); + ASSERT_EQ(lmp->atom->angle_atom3, nullptr); + ASSERT_EQ(lmp->atom->num_dihedral, nullptr); + ASSERT_EQ(lmp->atom->dihedral_type, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); + ASSERT_EQ(lmp->atom->num_improper, nullptr); + ASSERT_EQ(lmp->atom->improper_type, nullptr); + ASSERT_EQ(lmp->atom->improper_atom1, nullptr); + ASSERT_EQ(lmp->atom->improper_atom2, nullptr); + ASSERT_EQ(lmp->atom->improper_atom3, nullptr); + ASSERT_EQ(lmp->atom->improper_atom4, nullptr); + ASSERT_EQ(lmp->atom->maxspecial, 1); + ASSERT_EQ(lmp->atom->nspecial, nullptr); + ASSERT_EQ(lmp->atom->special, nullptr); + ASSERT_EQ(lmp->atom->vfrac, nullptr); + ASSERT_EQ(lmp->atom->s0, nullptr); + ASSERT_EQ(lmp->atom->x0, nullptr); + ASSERT_EQ(lmp->atom->sp, nullptr); + ASSERT_EQ(lmp->atom->fm, nullptr); + ASSERT_EQ(lmp->atom->fm_long, nullptr); + ASSERT_EQ(lmp->atom->spin, nullptr); + ASSERT_EQ(lmp->atom->eradius, nullptr); + ASSERT_EQ(lmp->atom->ervel, nullptr); + ASSERT_EQ(lmp->atom->erforce, nullptr); + ASSERT_EQ(lmp->atom->ervelforce, nullptr); + ASSERT_EQ(lmp->atom->cs, nullptr); + ASSERT_EQ(lmp->atom->csforce, nullptr); + ASSERT_EQ(lmp->atom->vforce, nullptr); + ASSERT_EQ(lmp->atom->etag, nullptr); + ASSERT_EQ(lmp->atom->uCond, nullptr); + ASSERT_EQ(lmp->atom->uMech, nullptr); + ASSERT_EQ(lmp->atom->uChem, nullptr); + ASSERT_EQ(lmp->atom->uCG, nullptr); + ASSERT_EQ(lmp->atom->uCGnew, nullptr); + ASSERT_EQ(lmp->atom->duChem, nullptr); + ASSERT_EQ(lmp->atom->dpdTheta, nullptr); + ASSERT_EQ(lmp->atom->cc, nullptr); + ASSERT_EQ(lmp->atom->cc_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_temp, nullptr); + ASSERT_EQ(lmp->atom->edpd_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_cv, nullptr); + ASSERT_EQ(lmp->atom->length, nullptr); + ASSERT_EQ(lmp->atom->buckling, nullptr); + ASSERT_EQ(lmp->atom->bond_nt, nullptr); + ASSERT_EQ(lmp->atom->contact_radius, nullptr); + ASSERT_EQ(lmp->atom->smd_data_9, nullptr); + ASSERT_EQ(lmp->atom->smd_stress, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); + ASSERT_EQ(lmp->atom->damage, nullptr); + ASSERT_EQ(lmp->atom->rho, nullptr); + ASSERT_EQ(lmp->atom->drho, nullptr); + ASSERT_EQ(lmp->atom->esph, nullptr); + ASSERT_EQ(lmp->atom->desph, nullptr); + ASSERT_EQ(lmp->atom->cv, nullptr); + ASSERT_EQ(lmp->atom->vest, nullptr); + ASSERT_EQ(lmp->atom->nmolecule, 2); + ASSERT_NE(lmp->atom->molecules, nullptr); + ASSERT_EQ(lmp->atom->nivector, 0); + ASSERT_EQ(lmp->atom->ndvector, 0); + ASSERT_EQ(lmp->atom->iname, nullptr); + ASSERT_EQ(lmp->atom->dname, nullptr); + ASSERT_EQ(lmp->atom->mass, nullptr); + ASSERT_EQ(lmp->atom->mass_setflag, nullptr); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); + ASSERT_EQ(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->map_style, 3); + ASSERT_EQ(lmp->atom->map_user, 0); + ASSERT_EQ(lmp->atom->map_tag_max, -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 4 box bond/types 2 angle/types 2 "); @@ -4200,33 +4269,33 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nellipsoids, 0); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->q_flag, 1); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_EQ(lmp->atom->nextra_grow, 0); - EXPECT_EQ(lmp->atom->nextra_restart, 0); - EXPECT_EQ(lmp->atom->nextra_border, 0); - EXPECT_EQ(lmp->atom->nextra_grow_max, 0); - EXPECT_EQ(lmp->atom->nextra_restart_max, 0); - EXPECT_EQ(lmp->atom->nextra_border_max, 0); - EXPECT_EQ(lmp->atom->nextra_store, 0); - EXPECT_EQ(lmp->atom->extra_grow, nullptr); - EXPECT_EQ(lmp->atom->extra_restart, nullptr); - EXPECT_EQ(lmp->atom->extra_border, nullptr); - EXPECT_EQ(lmp->atom->extra, nullptr); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nellipsoids, 0); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->q_flag, 1); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); - EXPECT_NE(lmp->atom->mass, nullptr); - EXPECT_NE(lmp->atom->mass_setflag, nullptr); + ASSERT_NE(lmp->atom->mass, nullptr); + ASSERT_NE(lmp->atom->mass_setflag, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("write_data test_atom_styles.data"); @@ -4241,66 +4310,66 @@ TEST_F(AtomStyleTest, template_charge) lmp->input->one("atom_modify map array"); lmp->input->one("read_data test_atom_styles.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); - EXPECT_NE(lmp->atom->avec, nullptr); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_NE(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); - EXPECT_EQ(lmp->atom->map_user, 1); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_NE(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); + ASSERT_EQ(lmp->atom->map_user, 1); + ASSERT_EQ(lmp->atom->map_tag_max, 12); auto molecule = lmp->atom->molecule; auto molindex = lmp->atom->molindex; auto molatom = lmp->atom->molatom; - EXPECT_EQ(molecule[GETIDX(1)], 1); - EXPECT_EQ(molecule[GETIDX(2)], 1); - EXPECT_EQ(molecule[GETIDX(3)], 1); - EXPECT_EQ(molecule[GETIDX(4)], 2); - EXPECT_EQ(molecule[GETIDX(5)], 2); - EXPECT_EQ(molecule[GETIDX(6)], 2); - EXPECT_EQ(molecule[GETIDX(7)], 3); - EXPECT_EQ(molecule[GETIDX(8)], 3); - EXPECT_EQ(molecule[GETIDX(9)], 3); - EXPECT_EQ(molecule[GETIDX(10)], 0); - EXPECT_EQ(molecule[GETIDX(11)], 0); - EXPECT_EQ(molecule[GETIDX(12)], 0); - EXPECT_EQ(molindex[GETIDX(1)], 0); - EXPECT_EQ(molindex[GETIDX(2)], 0); - EXPECT_EQ(molindex[GETIDX(3)], 0); - EXPECT_EQ(molindex[GETIDX(4)], 0); - EXPECT_EQ(molindex[GETIDX(5)], 0); - EXPECT_EQ(molindex[GETIDX(6)], 0); - EXPECT_EQ(molindex[GETIDX(7)], 0); - EXPECT_EQ(molindex[GETIDX(8)], 0); - EXPECT_EQ(molindex[GETIDX(9)], 0); - EXPECT_EQ(molindex[GETIDX(10)], -1); - EXPECT_EQ(molindex[GETIDX(11)], -1); - EXPECT_EQ(molindex[GETIDX(12)], -1); - EXPECT_EQ(molatom[GETIDX(1)], 0); - EXPECT_EQ(molatom[GETIDX(2)], 1); - EXPECT_EQ(molatom[GETIDX(3)], 2); - EXPECT_EQ(molatom[GETIDX(4)], 0); - EXPECT_EQ(molatom[GETIDX(5)], 1); - EXPECT_EQ(molatom[GETIDX(6)], 2); - EXPECT_EQ(molatom[GETIDX(7)], 0); - EXPECT_EQ(molatom[GETIDX(8)], 1); - EXPECT_EQ(molatom[GETIDX(9)], 2); - EXPECT_EQ(molatom[GETIDX(10)], -1); - EXPECT_EQ(molatom[GETIDX(11)], -1); - EXPECT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molecule[GETIDX(1)], 1); + ASSERT_EQ(molecule[GETIDX(2)], 1); + ASSERT_EQ(molecule[GETIDX(3)], 1); + ASSERT_EQ(molecule[GETIDX(4)], 2); + ASSERT_EQ(molecule[GETIDX(5)], 2); + ASSERT_EQ(molecule[GETIDX(6)], 2); + ASSERT_EQ(molecule[GETIDX(7)], 3); + ASSERT_EQ(molecule[GETIDX(8)], 3); + ASSERT_EQ(molecule[GETIDX(9)], 3); + ASSERT_EQ(molecule[GETIDX(10)], 0); + ASSERT_EQ(molecule[GETIDX(11)], 0); + ASSERT_EQ(molecule[GETIDX(12)], 0); + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(7)], 0); + ASSERT_EQ(molindex[GETIDX(8)], 0); + ASSERT_EQ(molindex[GETIDX(9)], 0); + ASSERT_EQ(molindex[GETIDX(10)], -1); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], 0); + ASSERT_EQ(molatom[GETIDX(8)], 1); + ASSERT_EQ(molatom[GETIDX(9)], 2); + ASSERT_EQ(molatom[GETIDX(10)], -1); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("clear"); @@ -4313,54 +4382,54 @@ TEST_F(AtomStyleTest, template_charge) lmp->input->one("atom_modify map array"); lmp->input->one("read_data test_atom_styles.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); - EXPECT_NE(lmp->atom->avec, nullptr); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 12); - EXPECT_EQ(lmp->atom->nlocal, 12); - EXPECT_EQ(lmp->atom->nbonds, 6); - EXPECT_EQ(lmp->atom->nangles, 3); - EXPECT_EQ(lmp->atom->nbondtypes, 2); - EXPECT_EQ(lmp->atom->nangletypes, 2); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_NE(lmp->atom->sametag, nullptr); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); - EXPECT_EQ(lmp->atom->map_user, 1); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_EQ(lmp->atom->natoms, 12); + ASSERT_EQ(lmp->atom->nlocal, 12); + ASSERT_EQ(lmp->atom->nbonds, 6); + ASSERT_EQ(lmp->atom->nangles, 3); + ASSERT_EQ(lmp->atom->nbondtypes, 2); + ASSERT_EQ(lmp->atom->nangletypes, 2); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_NE(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); + ASSERT_EQ(lmp->atom->map_user, 1); + ASSERT_EQ(lmp->atom->map_tag_max, 12); molecule = lmp->atom->molecule; molindex = lmp->atom->molindex; molatom = lmp->atom->molatom; - EXPECT_EQ(molindex[GETIDX(1)], 0); - EXPECT_EQ(molindex[GETIDX(2)], 0); - EXPECT_EQ(molindex[GETIDX(3)], 0); - EXPECT_EQ(molindex[GETIDX(4)], 0); - EXPECT_EQ(molindex[GETIDX(5)], 0); - EXPECT_EQ(molindex[GETIDX(6)], 0); - EXPECT_EQ(molindex[GETIDX(7)], 0); - EXPECT_EQ(molindex[GETIDX(8)], 0); - EXPECT_EQ(molindex[GETIDX(9)], 0); - EXPECT_EQ(molindex[GETIDX(10)], -1); - EXPECT_EQ(molindex[GETIDX(11)], -1); - EXPECT_EQ(molindex[GETIDX(12)], -1); - EXPECT_EQ(molatom[GETIDX(1)], 0); - EXPECT_EQ(molatom[GETIDX(2)], 1); - EXPECT_EQ(molatom[GETIDX(3)], 2); - EXPECT_EQ(molatom[GETIDX(4)], 0); - EXPECT_EQ(molatom[GETIDX(5)], 1); - EXPECT_EQ(molatom[GETIDX(6)], 2); - EXPECT_EQ(molatom[GETIDX(7)], 0); - EXPECT_EQ(molatom[GETIDX(8)], 1); - EXPECT_EQ(molatom[GETIDX(9)], 2); - EXPECT_EQ(molatom[GETIDX(10)], -1); - EXPECT_EQ(molatom[GETIDX(11)], -1); - EXPECT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(7)], 0); + ASSERT_EQ(molindex[GETIDX(8)], 0); + ASSERT_EQ(molindex[GETIDX(9)], 0); + ASSERT_EQ(molindex[GETIDX(10)], -1); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], 0); + ASSERT_EQ(molatom[GETIDX(8)], 1); + ASSERT_EQ(molatom[GETIDX(9)], 2); + ASSERT_EQ(molatom[GETIDX(10)], -1); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); auto x = lmp->atom->x; auto v = lmp->atom->v; @@ -4424,18 +4493,18 @@ TEST_F(AtomStyleTest, template_charge) EXPECT_NEAR(q[GETIDX(10)], 0.7, EPSILON); EXPECT_NEAR(q[GETIDX(11)], -0.35, EPSILON); EXPECT_NEAR(q[GETIDX(12)], -0.35, EPSILON); - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(7)], 1); - EXPECT_EQ(type[GETIDX(8)], 2); - EXPECT_EQ(type[GETIDX(9)], 2); - EXPECT_EQ(type[GETIDX(10)], 3); - EXPECT_EQ(type[GETIDX(11)], 3); - EXPECT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(7)], 1); + ASSERT_EQ(type[GETIDX(8)], 2); + ASSERT_EQ(type[GETIDX(9)], 2); + ASSERT_EQ(type[GETIDX(10)], 3); + ASSERT_EQ(type[GETIDX(11)], 3); + ASSERT_EQ(type[GETIDX(12)], 4); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("group two id 7:10"); @@ -4444,49 +4513,120 @@ TEST_F(AtomStyleTest, template_charge) lmp->input->one("clear"); lmp->input->one("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); lmp->input->one("read_restart test_atom_styles.restart"); - // FIXME. - // lmp->input->one("replicate 1 1 2 bbox"); + lmp->input->one("replicate 1 1 2 bbox"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); - EXPECT_NE(lmp->atom->avec, nullptr); - EXPECT_EQ(lmp->atom->natoms, 8); - EXPECT_EQ(lmp->atom->nlocal, 8); - EXPECT_EQ(lmp->atom->nghost, 0); - EXPECT_NE(lmp->atom->nmax, -1); - EXPECT_EQ(lmp->atom->tag_enable, 1); - EXPECT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - EXPECT_EQ(lmp->atom->ntypes, 4); - EXPECT_EQ(lmp->atom->tag_consecutive(), 0); - EXPECT_EQ(lmp->atom->map_tag_max, 12); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 16); + + ASSERT_EQ(lmp->atom->nlocal, 16); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); + ASSERT_EQ(lmp->atom->ntypes, 4); + ASSERT_EQ(lmp->atom->nbonds, 8); + ASSERT_EQ(lmp->atom->nangles, 4); + ASSERT_EQ(lmp->atom->tag_consecutive(), 0); + ASSERT_EQ(lmp->atom->map_tag_max, 24); type = lmp->atom->type; molecule = lmp->atom->molecule; molindex = lmp->atom->molindex; molatom = lmp->atom->molatom; - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(11)], 3); - EXPECT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(11)], 3); + ASSERT_EQ(type[GETIDX(12)], 4); + ASSERT_EQ(type[GETIDX(13)], 1); + ASSERT_EQ(type[GETIDX(14)], 2); + ASSERT_EQ(type[GETIDX(15)], 2); + ASSERT_EQ(type[GETIDX(16)], 1); + ASSERT_EQ(type[GETIDX(17)], 2); + ASSERT_EQ(type[GETIDX(18)], 2); + ASSERT_EQ(type[GETIDX(23)], 3); + ASSERT_EQ(type[GETIDX(24)], 4); + + ASSERT_EQ(molindex[GETIDX(1)], 0); + ASSERT_EQ(molindex[GETIDX(2)], 0); + ASSERT_EQ(molindex[GETIDX(3)], 0); + ASSERT_EQ(molindex[GETIDX(4)], 0); + ASSERT_EQ(molindex[GETIDX(5)], 0); + ASSERT_EQ(molindex[GETIDX(6)], 0); + ASSERT_EQ(molindex[GETIDX(11)], -1); + ASSERT_EQ(molindex[GETIDX(12)], -1); + ASSERT_EQ(molindex[GETIDX(13)], 0); + ASSERT_EQ(molindex[GETIDX(14)], 0); + ASSERT_EQ(molindex[GETIDX(15)], 0); + ASSERT_EQ(molindex[GETIDX(16)], 0); + ASSERT_EQ(molindex[GETIDX(17)], 0); + ASSERT_EQ(molindex[GETIDX(18)], 0); + ASSERT_EQ(molindex[GETIDX(23)], -1); + ASSERT_EQ(molindex[GETIDX(24)], -1); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(11)], -1); + ASSERT_EQ(molatom[GETIDX(12)], -1); + ASSERT_EQ(molatom[GETIDX(13)], 0); + ASSERT_EQ(molatom[GETIDX(14)], 1); + ASSERT_EQ(molatom[GETIDX(15)], 2); + ASSERT_EQ(molatom[GETIDX(16)], 0); + ASSERT_EQ(molatom[GETIDX(17)], 1); + ASSERT_EQ(molatom[GETIDX(18)], 2); + ASSERT_EQ(molatom[GETIDX(23)], -1); + ASSERT_EQ(molatom[GETIDX(24)], -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("reset_atom_ids"); if (!verbose) ::testing::internal::GetCapturedStdout(); - EXPECT_EQ(lmp->atom->tag_consecutive(), 1); - EXPECT_EQ(lmp->atom->map_tag_max, 8); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_tag_max, 16); - type = lmp->atom->type; - EXPECT_EQ(type[GETIDX(1)], 1); - EXPECT_EQ(type[GETIDX(2)], 2); - EXPECT_EQ(type[GETIDX(3)], 2); - EXPECT_EQ(type[GETIDX(4)], 1); - EXPECT_EQ(type[GETIDX(5)], 2); - EXPECT_EQ(type[GETIDX(6)], 2); - EXPECT_EQ(type[GETIDX(7)], 4); - EXPECT_EQ(type[GETIDX(8)], 3); + + type = lmp->atom->type; + molecule = lmp->atom->molecule; + molindex = lmp->atom->molindex; + molatom = lmp->atom->molatom; + ASSERT_EQ(type[GETIDX(1)], 1); + ASSERT_EQ(type[GETIDX(2)], 2); + ASSERT_EQ(type[GETIDX(3)], 2); + ASSERT_EQ(type[GETIDX(4)], 1); + ASSERT_EQ(type[GETIDX(5)], 2); + ASSERT_EQ(type[GETIDX(6)], 2); + ASSERT_EQ(type[GETIDX(7)], 4); + ASSERT_EQ(type[GETIDX(8)], 3); + ASSERT_EQ(type[GETIDX(9)], 1); + ASSERT_EQ(type[GETIDX(10)], 2); + ASSERT_EQ(type[GETIDX(11)], 2); + ASSERT_EQ(type[GETIDX(12)], 1); + ASSERT_EQ(type[GETIDX(13)], 2); + ASSERT_EQ(type[GETIDX(14)], 2); + ASSERT_EQ(type[GETIDX(15)], 4); + ASSERT_EQ(type[GETIDX(16)], 3); + ASSERT_EQ(molatom[GETIDX(1)], 0); + ASSERT_EQ(molatom[GETIDX(2)], 1); + ASSERT_EQ(molatom[GETIDX(3)], 2); + ASSERT_EQ(molatom[GETIDX(4)], 0); + ASSERT_EQ(molatom[GETIDX(5)], 1); + ASSERT_EQ(molatom[GETIDX(6)], 2); + ASSERT_EQ(molatom[GETIDX(7)], -1); + ASSERT_EQ(molatom[GETIDX(8)], -1); + ASSERT_EQ(molatom[GETIDX(9)], 0); + ASSERT_EQ(molatom[GETIDX(10)], 1); + ASSERT_EQ(molatom[GETIDX(11)], 2); + ASSERT_EQ(molatom[GETIDX(12)], 0); + ASSERT_EQ(molatom[GETIDX(13)], 1); + ASSERT_EQ(molatom[GETIDX(14)], 2); + ASSERT_EQ(molatom[GETIDX(15)], -1); + ASSERT_EQ(molatom[GETIDX(16)], -1); } TEST_F(AtomStyleTest, bond) From 26a8d875e9c6a219aed786982a82075c0515448f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Oct 2020 14:52:22 -0400 Subject: [PATCH 03/10] whitespace fix --- unittest/formats/test_atom_styles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 0bc4833fea..7de1602ab8 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -4518,7 +4518,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 16); - + ASSERT_EQ(lmp->atom->nlocal, 16); ASSERT_EQ(lmp->atom->nghost, 0); ASSERT_NE(lmp->atom->nmax, -1); From 00557e00a43ea655f0cec37ce935a5785f17dbd1 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 12:08:09 -0500 Subject: [PATCH 04/10] Add AtomState struct and ASSERT helpers --- unittest/formats/test_atom_styles.cpp | 549 ++++++++++++++++---------- 1 file changed, 347 insertions(+), 202 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 7de1602ab8..fed52f8745 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -130,217 +130,361 @@ protected: } }; +// default class Atom state +struct AtomState { + std::string atom_style = "atomic"; + bigint natoms = 0; + int nlocal = 0; + int nghost = 0; + int nmax = 1; + int tag_enable = 1; + int molecular = Atom::ATOMIC; + bigint nellipsoids = 0; + bigint nlines = 0; + bigint ntris = 0; + bigint nbodies = 0; + bigint nbonds = 0; + bigint nangles = 0; + bigint ndihedrals = 0; + bigint nimpropers = 0; + int ntypes = 0; + int nbondtypes = 0; + int nangletypes = 0; + int ndihedraltypes = 0; + int nimpropertypes = 0; + int bond_per_atom = 0; + int angle_per_atom = 0; + int dihedral_per_atom = 0; + int improper_per_atom = 0; + int extra_bond_per_atom = 0; + int extra_angle_per_atom = 0; + int extra_dihedral_per_atom = 0; + int extra_improper_per_atom = 0; + + int sphere_flag = 0; + int ellipsoid_flag = 0; + int line_flag = 0; + int tri_flag = 0; + int body_flag = 0; + int peri_flag = 0; + int electron_flag = 0; + int wavepacket_flag = 0; + int sph_flag = 0; + int molecule_flag = 0; + int molindex_flag = 0; + int molatom_flag = 0; + int q_flag = 0; + int mu_flag = 0; + int rmass_flag = 0; + int radius_flag = 0; + int omega_flag = 0; + int torque_flag = 0; + int angmom_flag = 0; + int vfrac_flag = 0; + int spin_flag = 0; + int eradius_flag = 0; + int ervel_flag = 0; + int erforce_flag = 0; + int cs_flag = 0; + int csforce_flag = 0; + int vforce_flag = 0; + int ervelforce_flag = 0; + int etag_flag = 0; + int rho_flag = 0; + int esph_flag = 0; + int cv_flag = 0; + int vest_flag = 0; + int dpd_flag = 0; + int edpd_flag = 0; + int tdpd_flag = 0; + int mesont_flag = 0; + int sp_flag = 0; + int x0_flag = 0; + int smd_flag = 0; + int damage_flag = 0; + int contact_radius_flag = 0; + int smd_data_9_flag = 0; + int smd_stress_flag = 0; + int eff_plastic_strain_flag = 0; + int eff_plastic_strain_rate_flag = 0; + double pdscale = 1.0; + + + int maxspecial = 1; + + int nmolecule = 0; + + int nivector = 0; + int ndvector = 0; + + int nextra_grow = 0; + int nextra_restart = 0; + int nextra_border = 0; + int nextra_grow_max = 0; + int nextra_restart_max = 0; + int nextra_border_max = 0; + int nextra_store = 0; + + int map_style = Atom::MAP_NONE; + int map_user = 0; + tagint map_tag_max = -1; + + // properties X that aren't controlled by an equivalent X_flag + bool has_type = true; + bool has_mask = true; + bool has_image = true; + bool has_x = true; + bool has_v = true; + bool has_f = true; + + bool has_bonds = false; + bool has_angles = false; + bool has_dihedral = false; + bool has_improper = false; + + bool has_iname = false; + bool has_dname = false; + bool has_mass = false; + bool has_mass_setflag = false; +}; + +template +void ASSERT_ARRAY_ALLOCATED(const T * ptr, bool enabled) { + if (enabled) { + ASSERT_NE(ptr, nullptr); + } else { + ASSERT_EQ(ptr, nullptr); + } +} + +void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { + ASSERT_THAT(std::string(atom->atom_style), Eq(expected.atom_style)); + + ASSERT_NE(atom->avec, nullptr); + ASSERT_EQ(atom->natoms, expected.natoms); + ASSERT_EQ(atom->nlocal, expected.nlocal); + ASSERT_EQ(atom->nghost, expected.nghost); + ASSERT_EQ(atom->nmax, expected.nmax); + ASSERT_EQ(atom->tag_enable, expected.tag_enable); + ASSERT_EQ(atom->molecular, expected.molecular); + ASSERT_EQ(atom->nellipsoids, expected.nellipsoids); + ASSERT_EQ(atom->nlines, expected.nlines); + ASSERT_EQ(atom->ntris, expected.ntris); + ASSERT_EQ(atom->nbodies, expected.nbodies); + ASSERT_EQ(atom->nbonds, expected.nbonds); + ASSERT_EQ(atom->nangles, expected.nangles); + ASSERT_EQ(atom->ndihedrals, expected.ndihedrals); + ASSERT_EQ(atom->nimpropers, expected.nimpropers); + ASSERT_EQ(atom->ntypes, expected.ntypes); + ASSERT_EQ(atom->nbondtypes, expected.nbondtypes); + ASSERT_EQ(atom->nangletypes, expected.nangletypes); + ASSERT_EQ(atom->ndihedraltypes, expected.ndihedraltypes); + ASSERT_EQ(atom->nimpropertypes, expected.nimpropertypes); + ASSERT_EQ(atom->bond_per_atom, expected.bond_per_atom); + ASSERT_EQ(atom->angle_per_atom, expected.angle_per_atom); + ASSERT_EQ(atom->dihedral_per_atom, expected.dihedral_per_atom); + ASSERT_EQ(atom->improper_per_atom, expected.improper_per_atom); + ASSERT_EQ(atom->extra_bond_per_atom, expected.extra_bond_per_atom); + ASSERT_EQ(atom->extra_angle_per_atom, expected.extra_angle_per_atom); + ASSERT_EQ(atom->extra_dihedral_per_atom, expected.extra_dihedral_per_atom); + ASSERT_EQ(atom->extra_improper_per_atom, expected.extra_improper_per_atom); + + ASSERT_EQ(atom->sphere_flag, expected.sphere_flag); + ASSERT_EQ(atom->ellipsoid_flag, expected.ellipsoid_flag); + ASSERT_EQ(atom->line_flag, expected.line_flag); + ASSERT_EQ(atom->tri_flag, expected.tri_flag); + ASSERT_EQ(atom->body_flag, expected.body_flag); + ASSERT_EQ(atom->peri_flag, expected.peri_flag); + ASSERT_EQ(atom->electron_flag, expected.electron_flag); + ASSERT_EQ(atom->wavepacket_flag, expected.wavepacket_flag); + ASSERT_EQ(atom->sph_flag, expected.sph_flag); + ASSERT_EQ(atom->molecule_flag, expected.molecule_flag); + ASSERT_EQ(atom->molindex_flag, expected.molindex_flag); + ASSERT_EQ(atom->molatom_flag, expected.molatom_flag); + ASSERT_EQ(atom->q_flag, expected.q_flag); + ASSERT_EQ(atom->mu_flag, expected.mu_flag); + ASSERT_EQ(atom->rmass_flag, expected.rmass_flag); + ASSERT_EQ(atom->radius_flag, expected.radius_flag); + ASSERT_EQ(atom->omega_flag, expected.omega_flag); + ASSERT_EQ(atom->torque_flag, expected.torque_flag); + ASSERT_EQ(atom->angmom_flag, expected.angmom_flag); + ASSERT_EQ(atom->vfrac_flag, expected.vfrac_flag); + ASSERT_EQ(atom->spin_flag, expected.spin_flag); + ASSERT_EQ(atom->eradius_flag, expected.eradius_flag); + ASSERT_EQ(atom->ervel_flag, expected.ervel_flag); + ASSERT_EQ(atom->erforce_flag, expected.erforce_flag); + ASSERT_EQ(atom->cs_flag, expected.cs_flag); + ASSERT_EQ(atom->csforce_flag, expected.csforce_flag); + ASSERT_EQ(atom->vforce_flag, expected.vforce_flag); + ASSERT_EQ(atom->ervelforce_flag, expected.ervelforce_flag); + ASSERT_EQ(atom->etag_flag, expected.etag_flag); + ASSERT_EQ(atom->rho_flag, expected.rho_flag); + ASSERT_EQ(atom->esph_flag, expected.esph_flag); + ASSERT_EQ(atom->cv_flag, expected.cv_flag); + ASSERT_EQ(atom->vest_flag, expected.vest_flag); + ASSERT_EQ(atom->dpd_flag, expected.dpd_flag); + ASSERT_EQ(atom->edpd_flag, expected.edpd_flag); + ASSERT_EQ(atom->tdpd_flag, expected.tdpd_flag); + ASSERT_EQ(atom->mesont_flag, expected.mesont_flag); + ASSERT_EQ(atom->sp_flag, expected.sp_flag); + ASSERT_EQ(atom->x0_flag, expected.x0_flag); + ASSERT_EQ(atom->smd_flag, expected.smd_flag); + ASSERT_EQ(atom->damage_flag, expected.damage_flag); + ASSERT_EQ(atom->contact_radius_flag, expected.contact_radius_flag); + ASSERT_EQ(atom->smd_data_9_flag, expected.smd_data_9_flag); + ASSERT_EQ(atom->smd_stress_flag, expected.smd_stress_flag); + ASSERT_EQ(atom->eff_plastic_strain_flag, expected.eff_plastic_strain_flag); + ASSERT_EQ(atom->eff_plastic_strain_rate_flag, expected.eff_plastic_strain_rate_flag); + ASSERT_EQ(atom->pdscale, expected.pdscale); + + ASSERT_ARRAY_ALLOCATED(atom->tag, expected.tag_enable); + ASSERT_ARRAY_ALLOCATED(atom->type, expected.has_type); + ASSERT_ARRAY_ALLOCATED(atom->mask, expected.has_mask); + ASSERT_ARRAY_ALLOCATED(atom->image, expected.has_image); + + ASSERT_ARRAY_ALLOCATED(atom->x, expected.has_x); + ASSERT_ARRAY_ALLOCATED(atom->v, expected.has_v); + ASSERT_ARRAY_ALLOCATED(atom->f, expected.has_f); + ASSERT_ARRAY_ALLOCATED(atom->q, expected.q_flag); + ASSERT_ARRAY_ALLOCATED(atom->mu, expected.mu_flag); + + ASSERT_ARRAY_ALLOCATED(atom->omega, expected.omega_flag); + ASSERT_ARRAY_ALLOCATED(atom->angmom, expected.angmom_flag); + ASSERT_ARRAY_ALLOCATED(atom->torque, expected.torque_flag); + ASSERT_ARRAY_ALLOCATED(atom->radius, expected.radius_flag); + ASSERT_ARRAY_ALLOCATED(atom->rmass, expected.rmass_flag); + ASSERT_ARRAY_ALLOCATED(atom->ellipsoid, expected.ellipsoid_flag); + ASSERT_ARRAY_ALLOCATED(atom->line, expected.line_flag); + ASSERT_ARRAY_ALLOCATED(atom->tri, expected.tri_flag); + ASSERT_ARRAY_ALLOCATED(atom->body, expected.body_flag); + ASSERT_ARRAY_ALLOCATED(atom->molecule, expected.molecule_flag); + ASSERT_ARRAY_ALLOCATED(atom->molindex, expected.molindex_flag); + ASSERT_ARRAY_ALLOCATED(atom->molatom, expected.molatom_flag); + + ASSERT_ARRAY_ALLOCATED(atom->num_bond, expected.has_bonds); + ASSERT_ARRAY_ALLOCATED(atom->bond_type, expected.has_bonds); + ASSERT_ARRAY_ALLOCATED(atom->bond_atom, expected.has_bonds); + + ASSERT_ARRAY_ALLOCATED(atom->num_angle, expected.has_angles); + ASSERT_ARRAY_ALLOCATED(atom->angle_type, expected.has_angles); + ASSERT_ARRAY_ALLOCATED(atom->angle_atom1, expected.has_angles); + ASSERT_ARRAY_ALLOCATED(atom->angle_atom2, expected.has_angles); + ASSERT_ARRAY_ALLOCATED(atom->angle_atom3, expected.has_angles); + + ASSERT_ARRAY_ALLOCATED(atom->num_dihedral, expected.has_dihedral); + ASSERT_ARRAY_ALLOCATED(atom->dihedral_type, expected.has_dihedral); + ASSERT_ARRAY_ALLOCATED(atom->dihedral_atom1, expected.has_dihedral); + ASSERT_ARRAY_ALLOCATED(atom->dihedral_atom2, expected.has_dihedral); + ASSERT_ARRAY_ALLOCATED(atom->dihedral_atom3, expected.has_dihedral); + ASSERT_ARRAY_ALLOCATED(atom->dihedral_atom4, expected.has_dihedral); + + ASSERT_ARRAY_ALLOCATED(atom->num_improper, expected.has_improper); + ASSERT_ARRAY_ALLOCATED(atom->improper_type, expected.has_improper); + ASSERT_ARRAY_ALLOCATED(atom->improper_atom1, expected.has_improper); + ASSERT_ARRAY_ALLOCATED(atom->improper_atom2, expected.has_improper); + ASSERT_ARRAY_ALLOCATED(atom->improper_atom3, expected.has_improper); + ASSERT_ARRAY_ALLOCATED(atom->improper_atom4, expected.has_improper); + + ASSERT_EQ(atom->maxspecial, expected.maxspecial); + + // currently ignored + ASSERT_ARRAY_ALLOCATED(atom->nspecial, false); + ASSERT_ARRAY_ALLOCATED(atom->special, false); + ASSERT_ARRAY_ALLOCATED(atom->vfrac, false); + ASSERT_ARRAY_ALLOCATED(atom->s0, false); + ASSERT_ARRAY_ALLOCATED(atom->x0, false); + ASSERT_ARRAY_ALLOCATED(atom->sp, false); + ASSERT_ARRAY_ALLOCATED(atom->fm, false); + ASSERT_ARRAY_ALLOCATED(atom->fm_long, false); + ASSERT_ARRAY_ALLOCATED(atom->spin, false); + ASSERT_ARRAY_ALLOCATED(atom->eradius, false); + ASSERT_ARRAY_ALLOCATED(atom->ervel, false); + ASSERT_ARRAY_ALLOCATED(atom->erforce, false); + ASSERT_ARRAY_ALLOCATED(atom->ervelforce, false); + ASSERT_ARRAY_ALLOCATED(atom->cs, false); + ASSERT_ARRAY_ALLOCATED(atom->csforce, false); + ASSERT_ARRAY_ALLOCATED(atom->vforce, false); + ASSERT_ARRAY_ALLOCATED(atom->etag, false); + ASSERT_ARRAY_ALLOCATED(atom->uCond, false); + ASSERT_ARRAY_ALLOCATED(atom->uMech, false); + ASSERT_ARRAY_ALLOCATED(atom->uChem, false); + ASSERT_ARRAY_ALLOCATED(atom->uCG, false); + ASSERT_ARRAY_ALLOCATED(atom->uCGnew, false); + ASSERT_ARRAY_ALLOCATED(atom->duChem, false); + ASSERT_ARRAY_ALLOCATED(atom->dpdTheta, false); + ASSERT_ARRAY_ALLOCATED(atom->cc, false); + ASSERT_ARRAY_ALLOCATED(atom->cc_flux, false); + ASSERT_ARRAY_ALLOCATED(atom->edpd_temp, false); + ASSERT_ARRAY_ALLOCATED(atom->edpd_flux, false); + ASSERT_ARRAY_ALLOCATED(atom->edpd_cv, false); + ASSERT_ARRAY_ALLOCATED(atom->length, false); + ASSERT_ARRAY_ALLOCATED(atom->buckling, false); + ASSERT_ARRAY_ALLOCATED(atom->bond_nt, false); + ASSERT_ARRAY_ALLOCATED(atom->contact_radius, false); + ASSERT_ARRAY_ALLOCATED(atom->smd_data_9, false); + ASSERT_ARRAY_ALLOCATED(atom->smd_stress, false); + ASSERT_ARRAY_ALLOCATED(atom->eff_plastic_strain, false); + ASSERT_ARRAY_ALLOCATED(atom->eff_plastic_strain_rate, false); + ASSERT_ARRAY_ALLOCATED(atom->damage, false); + ASSERT_ARRAY_ALLOCATED(atom->rho, false); + ASSERT_ARRAY_ALLOCATED(atom->drho, false); + ASSERT_ARRAY_ALLOCATED(atom->esph, false); + ASSERT_ARRAY_ALLOCATED(atom->desph, false); + ASSERT_ARRAY_ALLOCATED(atom->cv, false); + ASSERT_ARRAY_ALLOCATED(atom->vest, false); + + ASSERT_EQ(atom->nmolecule, expected.nmolecule); + + ASSERT_ARRAY_ALLOCATED(atom->molecules, expected.molecule_flag); + + ASSERT_EQ(atom->nivector, expected.nivector); + ASSERT_EQ(atom->ndvector, expected.ndvector); + + ASSERT_ARRAY_ALLOCATED(atom->iname, expected.has_iname); + ASSERT_ARRAY_ALLOCATED(atom->dname, expected.has_dname); + ASSERT_ARRAY_ALLOCATED(atom->mass, expected.has_mass); + ASSERT_ARRAY_ALLOCATED(atom->mass_setflag, expected.has_mass_setflag); + + ASSERT_EQ(atom->nextra_grow, expected.nextra_grow); + ASSERT_EQ(atom->nextra_restart, expected.nextra_restart); + ASSERT_EQ(atom->nextra_border, expected.nextra_border); + ASSERT_EQ(atom->nextra_grow_max, expected.nextra_grow_max); + ASSERT_EQ(atom->nextra_restart_max, expected.nextra_restart_max); + ASSERT_EQ(atom->nextra_border_max, expected.nextra_border_max); + ASSERT_EQ(atom->nextra_store, expected.nextra_store); + + ASSERT_ARRAY_ALLOCATED(atom->extra_grow, false); + ASSERT_ARRAY_ALLOCATED(atom->extra_restart, false); + ASSERT_ARRAY_ALLOCATED(atom->extra_border, false); + ASSERT_ARRAY_ALLOCATED(atom->extra, false); + ASSERT_ARRAY_ALLOCATED(atom->sametag, false); + + ASSERT_EQ(atom->map_style, expected.map_style); + ASSERT_EQ(atom->map_user, expected.map_user); + ASSERT_EQ(atom->map_tag_max, expected.map_tag_max); +} + TEST_F(AtomStyleTest, atomic) { - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); + AtomState expected; + expected.atom_style = "atomic"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_EQ(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style charge"); lmp->input->one("atom_style atomic"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->ntypes, 0); - - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->q, nullptr); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_modify map hash"); @@ -353,6 +497,7 @@ TEST_F(AtomStyleTest, atomic) lmp->input->one("mass 2 2.4"); lmp->input->one("pair_coeff * *"); if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); From e6c844d7192b5779b51c430447404bffda552c77 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 13:11:16 -0500 Subject: [PATCH 05/10] Simplify template and template_charge test cases --- unittest/formats/test_atom_styles.cpp | 412 +++----------------------- 1 file changed, 39 insertions(+), 373 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index fed52f8745..5529176f4f 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -3625,193 +3625,24 @@ TEST_F(AtomStyleTest, template) lmp->input->one("atom_style template twomols"); lmp->input->one("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 2); - ASSERT_EQ(lmp->atom->nangletypes, 2); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_NE(lmp->atom->molindex, nullptr); - ASSERT_NE(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 2); - ASSERT_NE(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, 3); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + AtomState expected; + expected.atom_style = "template"; + expected.molecular = Atom::TEMPLATE; + expected.nbondtypes = 2; + expected.nangletypes = 2; + expected.tag_enable = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.molecule_flag = 1; + expected.molindex_flag = 1; + expected.molatom_flag = 1; + expected.nmolecule = 2; + expected.map_style = 3; if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 4 box bond/types 2 angle/types 2 "); @@ -4188,201 +4019,36 @@ TEST_F(AtomStyleTest, template_charge) lmp->input->one("atom_style hybrid template twomols charge"); lmp->input->one("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); + + AtomState expected; + expected.atom_style = "hybrid"; + expected.molecular = Atom::TEMPLATE; + expected.nbondtypes = 2; + expected.nangletypes = 2; + expected.tag_enable = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.molecule_flag = 1; + expected.molindex_flag = 1; + expected.molatom_flag = 1; + expected.q_flag = 1; + expected.nmolecule = 2; + expected.map_style = 3; + + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); + auto hybrid = (AtomVecHybrid *)lmp->atom->avec; ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_EQ(hybrid->nstyles, 2); ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("template")); ASSERT_THAT(std::string(hybrid->keywords[1]), Eq("charge")); - ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::TEMPLATE); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 2); - ASSERT_EQ(lmp->atom->nangletypes, 2); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 1); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_NE(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_NE(lmp->atom->molindex, nullptr); - ASSERT_NE(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 2); - ASSERT_NE(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, 3); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); - if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 4 box bond/types 2 angle/types 2 "); lmp->input->one("create_atoms 0 single -2.0 2.0 0.1 mol twomols 65234"); From 76e3639db2763f32c3eccae60a65c1431596a04b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 13:11:46 -0500 Subject: [PATCH 06/10] Set molindex_flag and molatom_flag --- src/MOLECULE/atom_vec_template.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MOLECULE/atom_vec_template.cpp b/src/MOLECULE/atom_vec_template.cpp index c01942eb5c..0aefc66e26 100644 --- a/src/MOLECULE/atom_vec_template.cpp +++ b/src/MOLECULE/atom_vec_template.cpp @@ -27,6 +27,8 @@ AtomVecTemplate::AtomVecTemplate(LAMMPS *lmp) : AtomVec(lmp) mass_type = PER_TYPE; atom->molecule_flag = 1; + atom->molindex_flag = 1; + atom->molatom_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings From 504e67502320bf5a3bc75b76afa849ae2f5b3b04 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 13:19:44 -0500 Subject: [PATCH 07/10] Splitting up long test methods --- unittest/formats/test_atom_styles.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 5529176f4f..88ebcbc669 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -464,7 +464,7 @@ void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { ASSERT_EQ(atom->map_tag_max, expected.map_tag_max); } -TEST_F(AtomStyleTest, atomic) +TEST_F(AtomStyleTest, atomic_is_default) { AtomState expected; expected.atom_style = "atomic"; @@ -478,6 +478,20 @@ TEST_F(AtomStyleTest, atomic) expected.has_f = true; ASSERT_ATOM_STATE_EQ(lmp->atom, expected); +} + +TEST_F(AtomStyleTest, atomic_after_charge) +{ + AtomState expected; + expected.atom_style = "atomic"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style charge"); @@ -485,7 +499,10 @@ TEST_F(AtomStyleTest, atomic) if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_ATOM_STATE_EQ(lmp->atom, expected); +} +TEST_F(AtomStyleTest, atomic) +{ if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_modify map hash"); lmp->input->one("create_box 2 box"); From 5d79ba12d753c588a164153510144ccf9b46c19a Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 15:14:28 -0500 Subject: [PATCH 08/10] Use macro for better message during failure --- unittest/formats/test_atom_styles.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 88ebcbc669..f516c7f4f8 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -248,14 +248,12 @@ struct AtomState { bool has_mass_setflag = false; }; -template -void ASSERT_ARRAY_ALLOCATED(const T * ptr, bool enabled) { - if (enabled) { - ASSERT_NE(ptr, nullptr); - } else { - ASSERT_EQ(ptr, nullptr); +#define ASSERT_ARRAY_ALLOCATED(ptr, enabled) \ + if (enabled) { \ + ASSERT_NE(ptr, nullptr); \ + } else { \ + ASSERT_EQ(ptr, nullptr); \ } -} void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { ASSERT_THAT(std::string(atom->atom_style), Eq(expected.atom_style)); From bfd71f330ba5418f29e6b36d66d6719b3c00a5d6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 17:03:52 -0500 Subject: [PATCH 09/10] Simplify other AtomStyles tests --- unittest/formats/test_atom_styles.cpp | 1838 +++---------------------- 1 file changed, 166 insertions(+), 1672 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index f516c7f4f8..d6acd78295 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -246,6 +246,9 @@ struct AtomState { bool has_dname = false; bool has_mass = false; bool has_mass_setflag = false; + + bool has_nspecial = false; + bool has_special = false; }; #define ASSERT_ARRAY_ALLOCATED(ptr, enabled) \ @@ -386,8 +389,8 @@ void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { ASSERT_EQ(atom->maxspecial, expected.maxspecial); // currently ignored - ASSERT_ARRAY_ALLOCATED(atom->nspecial, false); - ASSERT_ARRAY_ALLOCATED(atom->special, false); + ASSERT_ARRAY_ALLOCATED(atom->nspecial, expected.has_nspecial); + ASSERT_ARRAY_ALLOCATED(atom->special, expected.has_special); ASSERT_ARRAY_ALLOCATED(atom->vfrac, false); ASSERT_ARRAY_ALLOCATED(atom->s0, false); ASSERT_ARRAY_ALLOCATED(atom->x0, false); @@ -433,7 +436,7 @@ void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { ASSERT_EQ(atom->nmolecule, expected.nmolecule); - ASSERT_ARRAY_ALLOCATED(atom->molecules, expected.molecule_flag); + ASSERT_ARRAY_ALLOCATED(atom->molecules, expected.nmolecule > 0); ASSERT_EQ(atom->nivector, expected.nivector); ASSERT_EQ(atom->ndvector, expected.ndvector); @@ -695,193 +698,19 @@ TEST_F(AtomStyleTest, charge) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style charge"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 1); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_NE(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_EQ(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + AtomState expected; + expected.atom_style = "charge"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.has_type = true; + expected.has_image = true; + expected.has_mask = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.q_flag = 1; + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 2 box"); @@ -1046,193 +875,24 @@ TEST_F(AtomStyleTest, sphere) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style sphere"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 1); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 1); - ASSERT_EQ(lmp->atom->omega_flag, 1); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "sphere"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.sphere_flag = 1; + expected.rmass_flag = 1; + expected.radius_flag = 1; + expected.omega_flag = 1; + expected.torque_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_NE(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_NE(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_EQ(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 2 box"); @@ -1386,193 +1046,23 @@ TEST_F(AtomStyleTest, ellipsoid) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style ellipsoid"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("ellipsoid")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 1); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 1); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "ellipsoid"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.ellipsoid_flag = 1; + expected.rmass_flag = 1; + expected.angmom_flag = 1; + expected.torque_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_NE(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_NE(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_EQ(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box"); @@ -1894,193 +1384,26 @@ TEST_F(AtomStyleTest, line) lmp->input->one("dimension 2"); lmp->input->one("atom_style line"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("line")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 1); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 1); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 1); - ASSERT_EQ(lmp->atom->omega_flag, 1); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "line"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.sphere_flag = 1; + expected.molecule_flag = 1; + expected.line_flag = 1; + expected.rmass_flag = 1; + expected.radius_flag = 1; + expected.omega_flag = 1; + expected.torque_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_NE(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_NE(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_NE(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box"); @@ -2331,193 +1654,27 @@ TEST_F(AtomStyleTest, tri) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style tri"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("tri")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 1); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 1); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 1); - ASSERT_EQ(lmp->atom->omega_flag, 1); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 1); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "tri"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.sphere_flag = 1; + expected.molecule_flag = 1; + expected.tri_flag = 1; + expected.rmass_flag = 1; + expected.radius_flag = 1; + expected.omega_flag = 1; + expected.angmom_flag = 1; + expected.torque_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_NE(lmp->atom->omega, nullptr); - ASSERT_NE(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_NE(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_NE(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box"); @@ -2901,199 +2058,30 @@ TEST_F(AtomStyleTest, body_nparticle) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style body nparticle 2 4"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("body")); + + AtomState expected; + expected.atom_style = "body"; + expected.molecular = Atom::ATOMIC; + expected.tag_enable = 1; + expected.body_flag = 1; + expected.rmass_flag = 1; + expected.radius_flag = 1; + expected.angmom_flag = 1; + expected.torque_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); auto avec = (AtomVecBody *)lmp->atom->avec; ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_NE(avec->bptr, nullptr); ASSERT_THAT(std::string(avec->bptr->style), Eq("nparticle")); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 1); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 0); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 1); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 1); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_NE(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_NE(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_NE(lmp->atom->body, nullptr); - ASSERT_EQ(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_EQ(lmp->atom->num_bond, nullptr); - ASSERT_EQ(lmp->atom->bond_type, nullptr); - ASSERT_EQ(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_EQ(lmp->atom->nspecial, nullptr); - ASSERT_EQ(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); - const char data_file[] = "\n4 atoms\n" "4 bodies\n" "3 atom types\n\n" @@ -3659,6 +2647,8 @@ TEST_F(AtomStyleTest, template) expected.nmolecule = 2; expected.map_style = 3; + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); + if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 4 box bond/types 2 angle/types 2 "); lmp->input->one("create_atoms 0 single -2.0 2.0 0.1 mol twomols 65234"); @@ -4463,193 +3453,24 @@ TEST_F(AtomStyleTest, bond) lmp->input->one("atom_style bond"); lmp->input->one("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("bond")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::MOLECULAR); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "bond"; + expected.molecular = Atom::MOLECULAR; + expected.tag_enable = 1; + expected.molecule_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.has_bonds = true; + expected.has_nspecial = true; + expected.has_special = true; + expected.map_style = 3; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_NE(lmp->atom->num_bond, nullptr); - ASSERT_NE(lmp->atom->bond_type, nullptr); - ASSERT_NE(lmp->atom->bond_atom, nullptr); - ASSERT_EQ(lmp->atom->num_angle, nullptr); - ASSERT_EQ(lmp->atom->angle_type, nullptr); - ASSERT_EQ(lmp->atom->angle_atom1, nullptr); - ASSERT_EQ(lmp->atom->angle_atom2, nullptr); - ASSERT_EQ(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_NE(lmp->atom->nspecial, nullptr); - ASSERT_NE(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, 3); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box bond/types 2 " @@ -4980,193 +3801,25 @@ TEST_F(AtomStyleTest, angle) lmp->input->one("atom_style angle"); lmp->input->one("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("angle")); - ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::MOLECULAR); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 0); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 0); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 0); - ASSERT_EQ(lmp->atom->angmom_flag, 0); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); + AtomState expected; + expected.atom_style = "angle"; + expected.molecular = Atom::MOLECULAR; + expected.tag_enable = 1; + expected.molecule_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.has_bonds = true; + expected.has_angles = true; + expected.has_nspecial = true; + expected.has_special = true; + expected.map_style = 3; - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_EQ(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_EQ(lmp->atom->angmom, nullptr); - ASSERT_EQ(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_EQ(lmp->atom->rmass, nullptr); - ASSERT_EQ(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_NE(lmp->atom->num_bond, nullptr); - ASSERT_NE(lmp->atom->bond_type, nullptr); - ASSERT_NE(lmp->atom->bond_atom, nullptr); - ASSERT_NE(lmp->atom->num_angle, nullptr); - ASSERT_NE(lmp->atom->angle_type, nullptr); - ASSERT_NE(lmp->atom->angle_atom1, nullptr); - ASSERT_NE(lmp->atom->angle_atom2, nullptr); - ASSERT_NE(lmp->atom->angle_atom3, nullptr); - ASSERT_EQ(lmp->atom->num_dihedral, nullptr); - ASSERT_EQ(lmp->atom->dihedral_type, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); - ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); - ASSERT_EQ(lmp->atom->num_improper, nullptr); - ASSERT_EQ(lmp->atom->improper_type, nullptr); - ASSERT_EQ(lmp->atom->improper_atom1, nullptr); - ASSERT_EQ(lmp->atom->improper_atom2, nullptr); - ASSERT_EQ(lmp->atom->improper_atom3, nullptr); - ASSERT_EQ(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_NE(lmp->atom->nspecial, nullptr); - ASSERT_NE(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, 3); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box bond/types 2 angle/types 2 " @@ -5508,199 +4161,40 @@ TEST_F(AtomStyleTest, full_ellipsoid) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("atom_style hybrid full ellipsoid"); if (!verbose) ::testing::internal::GetCapturedStdout(); + + AtomState expected; + expected.atom_style = "hybrid"; + expected.molecular = Atom::MOLECULAR; + expected.tag_enable = 1; + expected.molecule_flag = 1; + expected.ellipsoid_flag = 1; + expected.q_flag = 1; + expected.rmass_flag = 1; + expected.torque_flag = 1; + expected.angmom_flag = 1; + expected.has_type = true; + expected.has_mask = true; + expected.has_image = true; + expected.has_x = true; + expected.has_v = true; + expected.has_f = true; + expected.has_bonds = true; + expected.has_angles = true; + expected.has_dihedral = true; + expected.has_improper = true; + expected.has_nspecial = true; + expected.has_special = true; + expected.map_style = 3; + + ASSERT_ATOM_STATE_EQ(lmp->atom, expected); + auto hybrid = (AtomVecHybrid *)lmp->atom->avec; ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_EQ(hybrid->nstyles, 2); ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("full")); ASSERT_THAT(std::string(hybrid->keywords[1]), Eq("ellipsoid")); - ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - ASSERT_EQ(lmp->atom->natoms, 0); - ASSERT_EQ(lmp->atom->nlocal, 0); - ASSERT_EQ(lmp->atom->nghost, 0); - ASSERT_EQ(lmp->atom->nmax, 1); - ASSERT_EQ(lmp->atom->tag_enable, 1); - ASSERT_EQ(lmp->atom->molecular, Atom::MOLECULAR); - ASSERT_EQ(lmp->atom->nellipsoids, 0); - ASSERT_EQ(lmp->atom->nlines, 0); - ASSERT_EQ(lmp->atom->ntris, 0); - ASSERT_EQ(lmp->atom->nbodies, 0); - ASSERT_EQ(lmp->atom->nbonds, 0); - ASSERT_EQ(lmp->atom->nangles, 0); - ASSERT_EQ(lmp->atom->ndihedrals, 0); - ASSERT_EQ(lmp->atom->nimpropers, 0); - ASSERT_EQ(lmp->atom->ntypes, 0); - ASSERT_EQ(lmp->atom->nbondtypes, 0); - ASSERT_EQ(lmp->atom->nangletypes, 0); - ASSERT_EQ(lmp->atom->ndihedraltypes, 0); - ASSERT_EQ(lmp->atom->nimpropertypes, 0); - ASSERT_EQ(lmp->atom->bond_per_atom, 0); - ASSERT_EQ(lmp->atom->angle_per_atom, 0); - ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->improper_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); - ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); - - ASSERT_EQ(lmp->atom->sphere_flag, 0); - ASSERT_EQ(lmp->atom->ellipsoid_flag, 1); - ASSERT_EQ(lmp->atom->line_flag, 0); - ASSERT_EQ(lmp->atom->tri_flag, 0); - ASSERT_EQ(lmp->atom->body_flag, 0); - ASSERT_EQ(lmp->atom->peri_flag, 0); - ASSERT_EQ(lmp->atom->electron_flag, 0); - ASSERT_EQ(lmp->atom->wavepacket_flag, 0); - ASSERT_EQ(lmp->atom->sph_flag, 0); - ASSERT_EQ(lmp->atom->molecule_flag, 1); - ASSERT_EQ(lmp->atom->molindex_flag, 0); - ASSERT_EQ(lmp->atom->molatom_flag, 0); - ASSERT_EQ(lmp->atom->q_flag, 1); - ASSERT_EQ(lmp->atom->mu_flag, 0); - ASSERT_EQ(lmp->atom->rmass_flag, 1); - ASSERT_EQ(lmp->atom->radius_flag, 0); - ASSERT_EQ(lmp->atom->omega_flag, 0); - ASSERT_EQ(lmp->atom->torque_flag, 1); - ASSERT_EQ(lmp->atom->angmom_flag, 1); - ASSERT_EQ(lmp->atom->vfrac_flag, 0); - ASSERT_EQ(lmp->atom->spin_flag, 0); - ASSERT_EQ(lmp->atom->eradius_flag, 0); - ASSERT_EQ(lmp->atom->ervel_flag, 0); - ASSERT_EQ(lmp->atom->erforce_flag, 0); - ASSERT_EQ(lmp->atom->cs_flag, 0); - ASSERT_EQ(lmp->atom->csforce_flag, 0); - ASSERT_EQ(lmp->atom->vforce_flag, 0); - ASSERT_EQ(lmp->atom->ervelforce_flag, 0); - ASSERT_EQ(lmp->atom->etag_flag, 0); - ASSERT_EQ(lmp->atom->rho_flag, 0); - ASSERT_EQ(lmp->atom->esph_flag, 0); - ASSERT_EQ(lmp->atom->cv_flag, 0); - ASSERT_EQ(lmp->atom->vest_flag, 0); - ASSERT_EQ(lmp->atom->dpd_flag, 0); - ASSERT_EQ(lmp->atom->edpd_flag, 0); - ASSERT_EQ(lmp->atom->tdpd_flag, 0); - ASSERT_EQ(lmp->atom->mesont_flag, 0); - ASSERT_EQ(lmp->atom->sp_flag, 0); - ASSERT_EQ(lmp->atom->x0_flag, 0); - ASSERT_EQ(lmp->atom->smd_flag, 0); - ASSERT_EQ(lmp->atom->damage_flag, 0); - ASSERT_EQ(lmp->atom->contact_radius_flag, 0); - ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); - ASSERT_EQ(lmp->atom->smd_stress_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); - ASSERT_EQ(lmp->atom->pdscale, 1.0); - - ASSERT_NE(lmp->atom->tag, nullptr); - ASSERT_NE(lmp->atom->type, nullptr); - ASSERT_NE(lmp->atom->mask, nullptr); - ASSERT_NE(lmp->atom->image, nullptr); - ASSERT_NE(lmp->atom->x, nullptr); - ASSERT_NE(lmp->atom->v, nullptr); - ASSERT_NE(lmp->atom->f, nullptr); - ASSERT_NE(lmp->atom->q, nullptr); - ASSERT_EQ(lmp->atom->mu, nullptr); - ASSERT_EQ(lmp->atom->omega, nullptr); - ASSERT_NE(lmp->atom->angmom, nullptr); - ASSERT_NE(lmp->atom->torque, nullptr); - ASSERT_EQ(lmp->atom->radius, nullptr); - ASSERT_NE(lmp->atom->rmass, nullptr); - ASSERT_NE(lmp->atom->ellipsoid, nullptr); - ASSERT_EQ(lmp->atom->line, nullptr); - ASSERT_EQ(lmp->atom->tri, nullptr); - ASSERT_EQ(lmp->atom->body, nullptr); - ASSERT_NE(lmp->atom->molecule, nullptr); - ASSERT_EQ(lmp->atom->molindex, nullptr); - ASSERT_EQ(lmp->atom->molatom, nullptr); - ASSERT_NE(lmp->atom->num_bond, nullptr); - ASSERT_NE(lmp->atom->bond_type, nullptr); - ASSERT_NE(lmp->atom->bond_atom, nullptr); - ASSERT_NE(lmp->atom->num_angle, nullptr); - ASSERT_NE(lmp->atom->angle_type, nullptr); - ASSERT_NE(lmp->atom->angle_atom1, nullptr); - ASSERT_NE(lmp->atom->angle_atom2, nullptr); - ASSERT_NE(lmp->atom->angle_atom3, nullptr); - ASSERT_NE(lmp->atom->num_dihedral, nullptr); - ASSERT_NE(lmp->atom->dihedral_type, nullptr); - ASSERT_NE(lmp->atom->dihedral_atom1, nullptr); - ASSERT_NE(lmp->atom->dihedral_atom2, nullptr); - ASSERT_NE(lmp->atom->dihedral_atom3, nullptr); - ASSERT_NE(lmp->atom->dihedral_atom4, nullptr); - ASSERT_NE(lmp->atom->num_improper, nullptr); - ASSERT_NE(lmp->atom->improper_type, nullptr); - ASSERT_NE(lmp->atom->improper_atom1, nullptr); - ASSERT_NE(lmp->atom->improper_atom2, nullptr); - ASSERT_NE(lmp->atom->improper_atom3, nullptr); - ASSERT_NE(lmp->atom->improper_atom4, nullptr); - ASSERT_EQ(lmp->atom->maxspecial, 1); - ASSERT_NE(lmp->atom->nspecial, nullptr); - ASSERT_NE(lmp->atom->special, nullptr); - ASSERT_EQ(lmp->atom->vfrac, nullptr); - ASSERT_EQ(lmp->atom->s0, nullptr); - ASSERT_EQ(lmp->atom->x0, nullptr); - ASSERT_EQ(lmp->atom->sp, nullptr); - ASSERT_EQ(lmp->atom->fm, nullptr); - ASSERT_EQ(lmp->atom->fm_long, nullptr); - ASSERT_EQ(lmp->atom->spin, nullptr); - ASSERT_EQ(lmp->atom->eradius, nullptr); - ASSERT_EQ(lmp->atom->ervel, nullptr); - ASSERT_EQ(lmp->atom->erforce, nullptr); - ASSERT_EQ(lmp->atom->ervelforce, nullptr); - ASSERT_EQ(lmp->atom->cs, nullptr); - ASSERT_EQ(lmp->atom->csforce, nullptr); - ASSERT_EQ(lmp->atom->vforce, nullptr); - ASSERT_EQ(lmp->atom->etag, nullptr); - ASSERT_EQ(lmp->atom->uCond, nullptr); - ASSERT_EQ(lmp->atom->uMech, nullptr); - ASSERT_EQ(lmp->atom->uChem, nullptr); - ASSERT_EQ(lmp->atom->uCG, nullptr); - ASSERT_EQ(lmp->atom->uCGnew, nullptr); - ASSERT_EQ(lmp->atom->duChem, nullptr); - ASSERT_EQ(lmp->atom->dpdTheta, nullptr); - ASSERT_EQ(lmp->atom->cc, nullptr); - ASSERT_EQ(lmp->atom->cc_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_temp, nullptr); - ASSERT_EQ(lmp->atom->edpd_flux, nullptr); - ASSERT_EQ(lmp->atom->edpd_cv, nullptr); - ASSERT_EQ(lmp->atom->length, nullptr); - ASSERT_EQ(lmp->atom->buckling, nullptr); - ASSERT_EQ(lmp->atom->bond_nt, nullptr); - ASSERT_EQ(lmp->atom->contact_radius, nullptr); - ASSERT_EQ(lmp->atom->smd_data_9, nullptr); - ASSERT_EQ(lmp->atom->smd_stress, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); - ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); - ASSERT_EQ(lmp->atom->damage, nullptr); - ASSERT_EQ(lmp->atom->rho, nullptr); - ASSERT_EQ(lmp->atom->drho, nullptr); - ASSERT_EQ(lmp->atom->esph, nullptr); - ASSERT_EQ(lmp->atom->desph, nullptr); - ASSERT_EQ(lmp->atom->cv, nullptr); - ASSERT_EQ(lmp->atom->vest, nullptr); - ASSERT_EQ(lmp->atom->nmolecule, 0); - ASSERT_EQ(lmp->atom->molecules, nullptr); - ASSERT_EQ(lmp->atom->nivector, 0); - ASSERT_EQ(lmp->atom->ndvector, 0); - ASSERT_EQ(lmp->atom->iname, nullptr); - ASSERT_EQ(lmp->atom->dname, nullptr); - ASSERT_EQ(lmp->atom->mass, nullptr); - ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - ASSERT_EQ(lmp->atom->nextra_grow, 0); - ASSERT_EQ(lmp->atom->nextra_restart, 0); - ASSERT_EQ(lmp->atom->nextra_border, 0); - ASSERT_EQ(lmp->atom->nextra_grow_max, 0); - ASSERT_EQ(lmp->atom->nextra_restart_max, 0); - ASSERT_EQ(lmp->atom->nextra_border_max, 0); - ASSERT_EQ(lmp->atom->nextra_store, 0); - ASSERT_EQ(lmp->atom->extra_grow, nullptr); - ASSERT_EQ(lmp->atom->extra_restart, nullptr); - ASSERT_EQ(lmp->atom->extra_border, nullptr); - ASSERT_EQ(lmp->atom->extra, nullptr); - ASSERT_EQ(lmp->atom->sametag, nullptr); - ASSERT_EQ(lmp->atom->map_style, 3); - ASSERT_EQ(lmp->atom->map_user, 0); - ASSERT_EQ(lmp->atom->map_tag_max, -1); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("create_box 3 box bond/types 2 " From 4a8c458634af060e77bf78f40e37dbb6e6a623a0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Nov 2020 17:21:41 -0500 Subject: [PATCH 10/10] Update comment --- unittest/formats/test_atom_styles.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index d6acd78295..3ceff53b78 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -388,9 +388,10 @@ void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { ASSERT_EQ(atom->maxspecial, expected.maxspecial); - // currently ignored ASSERT_ARRAY_ALLOCATED(atom->nspecial, expected.has_nspecial); ASSERT_ARRAY_ALLOCATED(atom->special, expected.has_special); + + // currently ignored ASSERT_ARRAY_ALLOCATED(atom->vfrac, false); ASSERT_ARRAY_ALLOCATED(atom->s0, false); ASSERT_ARRAY_ALLOCATED(atom->x0, false);