add test for atom style tri

This commit is contained in:
Axel Kohlmeyer
2020-07-12 16:31:16 -04:00
parent 8f95b4a5d9
commit 00413ae956

View File

@ -2113,6 +2113,574 @@ TEST_F(AtomStyleTest, line)
ASSERT_DOUBLE_EQ(bonus[3].theta, MathConst::MY_PI / 6.0);
}
TEST_F(AtomStyleTest, tri)
{
if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP();
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, 0);
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);
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, 0);
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");
lmp->input->one("create_atoms 1 single -2.0 2.0 0.1");
lmp->input->one("create_atoms 1 single -2.0 -2.0 -0.1");
lmp->input->one("create_atoms 2 single 2.0 2.0 -0.1");
lmp->input->one("create_atoms 2 single 2.0 -2.0 0.1");
lmp->input->one("create_atoms 3 single 2.0 2.0 -2.1");
lmp->input->one("create_atoms 3 single 2.0 -2.0 2.1");
lmp->input->one("set type 1 mass 4.0");
lmp->input->one("set type 2 mass 2.4");
lmp->input->one("set type 3 mass 4.4");
lmp->input->one("set type 1 tri 1.0");
lmp->input->one("set type 2 tri 1.5");
lmp->input->one("set atom 1 quat 1.0 0.0 0.0 0.0");
lmp->input->one("set atom 2 quat 0.0 1.0 0.0 90.0");
lmp->input->one("set atom 3 quat 1.0 0.0 1.0 30.0");
lmp->input->one("set atom 4 quat 1.0 1.0 1.0 60.0");
lmp->input->one("pair_coeff * *");
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, 6);
ASSERT_EQ(lmp->atom->ntris, 4);
ASSERT_EQ(lmp->atom->nlocal, 6);
ASSERT_EQ(lmp->atom->nghost, 0);
ASSERT_NE(lmp->atom->nmax, -1);
ASSERT_EQ(lmp->atom->tag_enable, 1);
ASSERT_EQ(lmp->atom->molecular, 0);
ASSERT_EQ(lmp->atom->ntypes, 3);
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->mass, nullptr);
ASSERT_NE(lmp->atom->rmass, nullptr);
ASSERT_NE(lmp->atom->tri, nullptr);
ASSERT_EQ(lmp->atom->mass_setflag, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("write_data test_atom_styles.data nocoeff");
lmp->input->one("clear");
lmp->input->one("atom_style tri");
lmp->input->one("pair_style zero 4.0");
lmp->input->one("units real");
lmp->input->one("atom_modify map array");
lmp->input->one("read_data test_atom_styles.data");
lmp->input->one("pair_coeff * *");
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, 6);
ASSERT_EQ(lmp->atom->nlocal, 6);
ASSERT_EQ(lmp->atom->ntris, 4);
ASSERT_EQ(lmp->atom->nghost, 0);
ASSERT_NE(lmp->atom->nmax, -1);
ASSERT_EQ(lmp->atom->tag_enable, 1);
ASSERT_EQ(lmp->atom->molecular, 0);
ASSERT_EQ(lmp->atom->ntypes, 3);
ASSERT_EQ(lmp->atom->tri_flag, 1);
ASSERT_NE(lmp->atom->tri, nullptr);
ASSERT_NE(lmp->atom->sametag, nullptr);
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
ASSERT_EQ(lmp->atom->map_style, 1);
ASSERT_EQ(lmp->atom->map_user, 1);
ASSERT_EQ(lmp->atom->map_tag_max, 6);
auto x = lmp->atom->x;
auto v = lmp->atom->v;
auto type = lmp->atom->type;
auto tri = lmp->atom->tri;
auto rmass = lmp->atom->rmass;
auto radius = lmp->atom->radius;
auto avec = (AtomVecTri *)lmp->atom->avec;
auto bonus = avec->bonus;
ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1);
ASSERT_DOUBLE_EQ(x[GETIDX(2)][0], -2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(2)][1], -2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(2)][2], -0.1);
ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1);
ASSERT_DOUBLE_EQ(x[GETIDX(4)][0], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(4)][1], -2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(4)][2], 0.1);
ASSERT_DOUBLE_EQ(x[GETIDX(5)][0], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(5)][1], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(5)][2], -2.1);
ASSERT_DOUBLE_EQ(x[GETIDX(6)][0], 2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(6)][1], -2.0);
ASSERT_DOUBLE_EQ(x[GETIDX(6)][2], 2.1);
ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(2)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(2)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(2)][2], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(4)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(4)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(4)][2], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(5)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(5)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(5)][2], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(6)][0], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(6)][1], 0.0);
ASSERT_DOUBLE_EQ(v[GETIDX(6)][2], 0.0);
ASSERT_EQ(type[GETIDX(1)], 1);
ASSERT_EQ(type[GETIDX(2)], 1);
ASSERT_EQ(type[GETIDX(3)], 2);
ASSERT_EQ(type[GETIDX(4)], 2);
ASSERT_EQ(type[GETIDX(5)], 3);
ASSERT_EQ(type[GETIDX(6)], 3);
ASSERT_EQ(tri[GETIDX(1)], 0);
ASSERT_EQ(tri[GETIDX(2)], 1);
ASSERT_EQ(tri[GETIDX(3)], 2);
ASSERT_EQ(tri[GETIDX(4)], 3);
ASSERT_EQ(tri[GETIDX(5)], -1);
ASSERT_EQ(tri[GETIDX(6)], -1);
ASSERT_DOUBLE_EQ(rmass[GETIDX(1)], 4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(2)], 4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(3)], 2.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(4)], 2.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(5)], 4.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(6)], 4.4);
ASSERT_DOUBLE_EQ(radius[GETIDX(1)], 0.5773502691896258);
ASSERT_DOUBLE_EQ(radius[GETIDX(2)], 0.5773502691896258);
ASSERT_DOUBLE_EQ(radius[GETIDX(3)], 0.8660254037844390);
ASSERT_DOUBLE_EQ(radius[GETIDX(4)], 0.8660254037844390);
ASSERT_DOUBLE_EQ(radius[GETIDX(5)], 0.5);
ASSERT_DOUBLE_EQ(radius[GETIDX(6)], 0.5);
ASSERT_DOUBLE_EQ(bonus[0].inertia[0], 0.072258416330334363);
ASSERT_DOUBLE_EQ(bonus[0].inertia[1], 13.94589575227541);
ASSERT_DOUBLE_EQ(bonus[0].inertia[2], 14.017974903242481);
ASSERT_DOUBLE_EQ(bonus[1].inertia[0], 13.982119044342252);
ASSERT_DOUBLE_EQ(bonus[1].inertia[1], 0.10811427523057447);
ASSERT_DOUBLE_EQ(bonus[1].inertia[2], 13.945895752275419);
ASSERT_DOUBLE_EQ(bonus[2].inertia[0], 0.23541253382609079);
ASSERT_DOUBLE_EQ(bonus[2].inertia[1], 18.948744087979005);
ASSERT_DOUBLE_EQ(bonus[2].inertia[2], 19.15175691481879);
ASSERT_DOUBLE_EQ(bonus[3].inertia[0], 19.018309360029388);
ASSERT_DOUBLE_EQ(bonus[3].inertia[1], 0.36886008861549813);
ASSERT_DOUBLE_EQ(bonus[3].inertia[2], 18.948744087979012);
ASSERT_DOUBLE_EQ(bonus[0].quat[0], 0.92373678792937974);
ASSERT_DOUBLE_EQ(bonus[0].quat[1], 0.0067268233964605153);
ASSERT_DOUBLE_EQ(bonus[0].quat[2], 0.016239988275423625);
ASSERT_DOUBLE_EQ(bonus[0].quat[3], -0.38262430562330857);
ASSERT_DOUBLE_EQ(bonus[1].quat[0], 0.92420701665838023);
ASSERT_DOUBLE_EQ(bonus[1].quat[1], 0.023090752704586423);
ASSERT_DOUBLE_EQ(bonus[1].quat[2], 0.0095209086022933816);
ASSERT_DOUBLE_EQ(bonus[1].quat[3], -0.38107421822833848);
ASSERT_DOUBLE_EQ(bonus[2].quat[0], 0.90191325590647364);
ASSERT_DOUBLE_EQ(bonus[2].quat[1], 0.20096813128512517);
ASSERT_DOUBLE_EQ(bonus[2].quat[2], 0.10027584751231088);
ASSERT_DOUBLE_EQ(bonus[2].quat[3], 0.36892959143125964);
ASSERT_DOUBLE_EQ(bonus[3].quat[0], 0.8851587738551242);
ASSERT_DOUBLE_EQ(bonus[3].quat[1], 0.093233030525564045);
ASSERT_DOUBLE_EQ(bonus[3].quat[2], -0.26735735980719261);
ASSERT_DOUBLE_EQ(bonus[3].quat[3], 0.36921753647848277);
ASSERT_DOUBLE_EQ(bonus[0].c1[0], -0.14933690186163631);
ASSERT_DOUBLE_EQ(bonus[0].c1[1], -0.55767753582520529);
ASSERT_DOUBLE_EQ(bonus[0].c1[2], -0.0052525338293288905);
ASSERT_DOUBLE_EQ(bonus[1].c1[0], 0.18561232929671426);
ASSERT_DOUBLE_EQ(bonus[1].c1[1], -0.18681344121910506);
ASSERT_DOUBLE_EQ(bonus[1].c1[2], 0.51379191773154387);
ASSERT_DOUBLE_EQ(bonus[2].c1[0], -0.78775285695558617);
ASSERT_DOUBLE_EQ(bonus[2].c1[1], -0.28372571379613187);
ASSERT_DOUBLE_EQ(bonus[2].c1[2], -0.22123552085772166);
ASSERT_DOUBLE_EQ(bonus[3].c1[0], -0.69845793336676587);
ASSERT_DOUBLE_EQ(bonus[3].c1[1], -0.47901475403318056);
ASSERT_DOUBLE_EQ(bonus[3].c1[2], 0.18083523090249506);
ASSERT_DOUBLE_EQ(bonus[0].c2[0], 0.55733290519255385);
ASSERT_DOUBLE_EQ(bonus[0].c2[1], 0.14942924536134222);
ASSERT_DOUBLE_EQ(bonus[0].c2[2], 0.019602723119529659);
ASSERT_DOUBLE_EQ(bonus[1].c2[0], 0.2208094914375279);
ASSERT_DOUBLE_EQ(bonus[1].c2[1], -0.22223836695322471);
ASSERT_DOUBLE_EQ(bonus[1].c2[2], -0.48496042114630089);
ASSERT_DOUBLE_EQ(bonus[2].c2[0], 0.6304379562181005);
ASSERT_DOUBLE_EQ(bonus[2].c2[1], -0.56674478453558153);
ASSERT_DOUBLE_EQ(bonus[2].c2[2], 0.17705460333259249);
ASSERT_DOUBLE_EQ(bonus[3].c2[0], 0.22007613459534958);
ASSERT_DOUBLE_EQ(bonus[3].c2[1], 0.15093208974463554);
ASSERT_DOUBLE_EQ(bonus[3].c2[2], -0.8238847002262436);
ASSERT_DOUBLE_EQ(bonus[0].c3[0], -0.40799600333091751);
ASSERT_DOUBLE_EQ(bonus[0].c3[1], 0.40824829046386302);
ASSERT_DOUBLE_EQ(bonus[0].c3[2], -0.014350189290200811);
ASSERT_DOUBLE_EQ(bonus[1].c3[0], -0.40642182073424188);
ASSERT_DOUBLE_EQ(bonus[1].c3[1], 0.40905180817232945);
ASSERT_DOUBLE_EQ(bonus[1].c3[2], -0.028831496585242929);
ASSERT_DOUBLE_EQ(bonus[2].c3[0], 0.15731490073748589);
ASSERT_DOUBLE_EQ(bonus[2].c3[1], 0.85047049833171351);
ASSERT_DOUBLE_EQ(bonus[2].c3[2], 0.044180917525129149);
ASSERT_DOUBLE_EQ(bonus[3].c3[0], 0.47838179877141634);
ASSERT_DOUBLE_EQ(bonus[3].c3[1], 0.32808266428854471);
ASSERT_DOUBLE_EQ(bonus[3].c3[2], 0.64304946932374851);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("group two id 2:4:2");
lmp->input->one("delete_atoms group two compress no");
lmp->input->one("write_restart test_atom_styles.restart");
lmp->input->one("clear");
lmp->input->one("read_restart test_atom_styles.restart");
lmp->input->one("replicate 1 1 2");
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, 8);
ASSERT_EQ(lmp->atom->nlocal, 8);
ASSERT_EQ(lmp->atom->nghost, 0);
ASSERT_EQ(lmp->atom->ntris, 4);
ASSERT_NE(lmp->atom->nmax, -1);
ASSERT_EQ(lmp->atom->tag_enable, 1);
ASSERT_EQ(lmp->atom->molecular, 0);
ASSERT_EQ(lmp->atom->ntypes, 3);
ASSERT_EQ(lmp->atom->tag_consecutive(), 0);
ASSERT_EQ(lmp->atom->map_tag_max, 12);
type = lmp->atom->type;
tri = lmp->atom->tri;
rmass = lmp->atom->rmass;
avec = (AtomVecTri *)lmp->atom->avec;
bonus = avec->bonus;
ASSERT_EQ(type[GETIDX(1)], 1);
ASSERT_EQ(type[GETIDX(3)], 2);
ASSERT_EQ(type[GETIDX(5)], 3);
ASSERT_EQ(type[GETIDX(6)], 3);
ASSERT_EQ(type[GETIDX(7)], 1);
ASSERT_EQ(type[GETIDX(9)], 2);
ASSERT_EQ(type[GETIDX(11)], 3);
ASSERT_EQ(type[GETIDX(12)], 3);
ASSERT_EQ(tri[GETIDX(1)], 0);
ASSERT_EQ(tri[GETIDX(3)], 1);
ASSERT_EQ(tri[GETIDX(5)], -1);
ASSERT_EQ(tri[GETIDX(6)], -1);
ASSERT_EQ(tri[GETIDX(7)], 2);
ASSERT_EQ(tri[GETIDX(9)], 3);
ASSERT_EQ(tri[GETIDX(11)], -1);
ASSERT_EQ(tri[GETIDX(12)], -1);
ASSERT_DOUBLE_EQ(rmass[GETIDX(1)], 4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(3)], 2.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(5)], 4.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(6)], 4.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(7)], 4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(9)], 2.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(11)], 4.4);
ASSERT_DOUBLE_EQ(rmass[GETIDX(12)], 4.4);
ASSERT_DOUBLE_EQ(radius[GETIDX(1)], 0.5773502691896258);
ASSERT_DOUBLE_EQ(radius[GETIDX(3)], 0.8660254037844390);
ASSERT_DOUBLE_EQ(radius[GETIDX(5)], 0.5);
ASSERT_DOUBLE_EQ(radius[GETIDX(6)], 0.5);
ASSERT_DOUBLE_EQ(radius[GETIDX(7)], 0.5773502691896258);
ASSERT_DOUBLE_EQ(radius[GETIDX(9)], 0.8660254037844390);
ASSERT_DOUBLE_EQ(radius[GETIDX(11)], 0.5);
ASSERT_DOUBLE_EQ(radius[GETIDX(12)], 0.5);
ASSERT_DOUBLE_EQ(bonus[0].inertia[0], 0.072258416330334363);
ASSERT_DOUBLE_EQ(bonus[0].inertia[1], 13.94589575227541);
ASSERT_DOUBLE_EQ(bonus[0].inertia[2], 14.017974903242481);
ASSERT_DOUBLE_EQ(bonus[1].inertia[0], 0.23541253382609079);
ASSERT_DOUBLE_EQ(bonus[1].inertia[1], 18.948744087979005);
ASSERT_DOUBLE_EQ(bonus[1].inertia[2], 19.15175691481879);
ASSERT_DOUBLE_EQ(bonus[2].inertia[0], 0.072258416330334363);
ASSERT_DOUBLE_EQ(bonus[2].inertia[1], 13.94589575227541);
ASSERT_DOUBLE_EQ(bonus[2].inertia[2], 14.017974903242481);
ASSERT_DOUBLE_EQ(bonus[3].inertia[0], 0.23541253382609079);
ASSERT_DOUBLE_EQ(bonus[3].inertia[1], 18.948744087979005);
ASSERT_DOUBLE_EQ(bonus[3].inertia[2], 19.15175691481879);
ASSERT_DOUBLE_EQ(bonus[0].quat[0], 0.92373678792937974);
ASSERT_DOUBLE_EQ(bonus[0].quat[1], 0.0067268233964605153);
ASSERT_DOUBLE_EQ(bonus[0].quat[2], 0.016239988275423625);
ASSERT_DOUBLE_EQ(bonus[0].quat[3], -0.38262430562330857);
ASSERT_DOUBLE_EQ(bonus[1].quat[0], 0.90191325590647364);
ASSERT_DOUBLE_EQ(bonus[1].quat[1], 0.20096813128512517);
ASSERT_DOUBLE_EQ(bonus[1].quat[2], 0.10027584751231088);
ASSERT_DOUBLE_EQ(bonus[1].quat[3], 0.36892959143125964);
ASSERT_DOUBLE_EQ(bonus[2].quat[0], 0.92373678792937974);
ASSERT_DOUBLE_EQ(bonus[2].quat[1], 0.0067268233964605153);
ASSERT_DOUBLE_EQ(bonus[2].quat[2], 0.016239988275423625);
ASSERT_DOUBLE_EQ(bonus[2].quat[3], -0.38262430562330857);
ASSERT_DOUBLE_EQ(bonus[3].quat[0], 0.90191325590647364);
ASSERT_DOUBLE_EQ(bonus[3].quat[1], 0.20096813128512517);
ASSERT_DOUBLE_EQ(bonus[3].quat[2], 0.10027584751231088);
ASSERT_DOUBLE_EQ(bonus[3].quat[3], 0.36892959143125964);
ASSERT_DOUBLE_EQ(bonus[0].c1[0], -0.14933690186163631);
ASSERT_DOUBLE_EQ(bonus[0].c1[1], -0.55767753582520529);
ASSERT_DOUBLE_EQ(bonus[0].c1[2], -0.0052525338293288905);
ASSERT_DOUBLE_EQ(bonus[1].c1[0], -0.78775285695558617);
ASSERT_DOUBLE_EQ(bonus[1].c1[1], -0.28372571379613187);
ASSERT_DOUBLE_EQ(bonus[1].c1[2], -0.22123552085772166);
ASSERT_DOUBLE_EQ(bonus[2].c1[0], -0.14933690186163631);
ASSERT_DOUBLE_EQ(bonus[2].c1[1], -0.55767753582520529);
ASSERT_DOUBLE_EQ(bonus[2].c1[2], -0.0052525338293288905);
ASSERT_DOUBLE_EQ(bonus[3].c1[0], -0.78775285695558617);
ASSERT_DOUBLE_EQ(bonus[3].c1[1], -0.28372571379613187);
ASSERT_DOUBLE_EQ(bonus[3].c1[2], -0.22123552085772166);
ASSERT_DOUBLE_EQ(bonus[0].c2[0], 0.55733290519255385);
ASSERT_DOUBLE_EQ(bonus[0].c2[1], 0.14942924536134222);
ASSERT_DOUBLE_EQ(bonus[0].c2[2], 0.019602723119529659);
ASSERT_DOUBLE_EQ(bonus[1].c2[0], 0.6304379562181005);
ASSERT_DOUBLE_EQ(bonus[1].c2[1], -0.56674478453558153);
ASSERT_DOUBLE_EQ(bonus[1].c2[2], 0.17705460333259249);
ASSERT_DOUBLE_EQ(bonus[2].c2[0], 0.55733290519255385);
ASSERT_DOUBLE_EQ(bonus[2].c2[1], 0.14942924536134222);
ASSERT_DOUBLE_EQ(bonus[2].c2[2], 0.019602723119529659);
ASSERT_DOUBLE_EQ(bonus[3].c2[0], 0.6304379562181005);
ASSERT_DOUBLE_EQ(bonus[3].c2[1], -0.56674478453558153);
ASSERT_DOUBLE_EQ(bonus[3].c2[2], 0.17705460333259249);
ASSERT_DOUBLE_EQ(bonus[0].c3[0], -0.40799600333091751);
ASSERT_DOUBLE_EQ(bonus[0].c3[1], 0.40824829046386302);
ASSERT_DOUBLE_EQ(bonus[0].c3[2], -0.014350189290200811);
ASSERT_DOUBLE_EQ(bonus[1].c3[0], 0.15731490073748589);
ASSERT_DOUBLE_EQ(bonus[1].c3[1], 0.85047049833171351);
ASSERT_DOUBLE_EQ(bonus[1].c3[2], 0.044180917525129149);
ASSERT_DOUBLE_EQ(bonus[2].c3[0], -0.40799600333091751);
ASSERT_DOUBLE_EQ(bonus[2].c3[1], 0.40824829046386302);
ASSERT_DOUBLE_EQ(bonus[2].c3[2], -0.014350189290200811);
ASSERT_DOUBLE_EQ(bonus[3].c3[0], 0.15731490073748589);
ASSERT_DOUBLE_EQ(bonus[3].c3[1], 0.85047049833171351);
ASSERT_DOUBLE_EQ(bonus[3].c3[2], 0.044180917525129149);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_atom_ids");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->atom->ntris, 4);
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
ASSERT_EQ(lmp->atom->map_tag_max, 8);
tri = lmp->atom->tri;
rmass = lmp->atom->rmass;
avec = (AtomVecTri *)lmp->atom->avec;
bonus = avec->bonus;
ASSERT_EQ(type[GETIDX(1)], 1);
ASSERT_EQ(type[GETIDX(2)], 3);
ASSERT_EQ(type[GETIDX(3)], 2);
ASSERT_EQ(type[GETIDX(4)], 3);
ASSERT_EQ(type[GETIDX(5)], 1);
ASSERT_EQ(type[GETIDX(6)], 3);
ASSERT_EQ(type[GETIDX(7)], 2);
ASSERT_EQ(type[GETIDX(8)], 3);
ASSERT_EQ(tri[GETIDX(1)], 0);
ASSERT_EQ(tri[GETIDX(2)], -1);
ASSERT_EQ(tri[GETIDX(3)], 1);
ASSERT_EQ(tri[GETIDX(4)], -1);
ASSERT_EQ(tri[GETIDX(5)], 2);
ASSERT_EQ(tri[GETIDX(6)], -1);
ASSERT_EQ(tri[GETIDX(7)], 3);
ASSERT_EQ(tri[GETIDX(8)], -1);
ASSERT_DOUBLE_EQ(bonus[0].inertia[0], 0.072258416330334363);
ASSERT_DOUBLE_EQ(bonus[0].inertia[1], 13.94589575227541);
ASSERT_DOUBLE_EQ(bonus[0].inertia[2], 14.017974903242481);
ASSERT_DOUBLE_EQ(bonus[1].inertia[0], 0.23541253382609079);
ASSERT_DOUBLE_EQ(bonus[1].inertia[1], 18.948744087979005);
ASSERT_DOUBLE_EQ(bonus[1].inertia[2], 19.15175691481879);
ASSERT_DOUBLE_EQ(bonus[2].inertia[0], 0.072258416330334363);
ASSERT_DOUBLE_EQ(bonus[2].inertia[1], 13.94589575227541);
ASSERT_DOUBLE_EQ(bonus[2].inertia[2], 14.017974903242481);
ASSERT_DOUBLE_EQ(bonus[3].inertia[0], 0.23541253382609079);
ASSERT_DOUBLE_EQ(bonus[3].inertia[1], 18.948744087979005);
ASSERT_DOUBLE_EQ(bonus[3].inertia[2], 19.15175691481879);
}
TEST_F(AtomStyleTest, bond)
{
if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP();