diff --git a/src/hamiltonian/atomic_potential.hpp b/src/hamiltonian/atomic_potential.hpp index cbde81fe..aa247817 100644 --- a/src/hamiltonian/atomic_potential.hpp +++ b/src/hamiltonian/atomic_potential.hpp @@ -45,8 +45,6 @@ namespace hamiltonian { private: pseudo::math::erf_range_separation sep_; - int natoms_; - double nelectrons_; pseudo::set pseudo_set_; std::unordered_map pseudopotential_list_; bool has_nlcc_; @@ -54,11 +52,10 @@ namespace hamiltonian { bool fourier_pseudo_; public: - - template - atomic_potential(const int natoms, const atom_array & atom_list, double gcutoff, options::electrons const & conf = {}): + + template + atomic_potential(SpeciesList const & species_list, double gcutoff, options::electrons const & conf = {}): sep_(0.625), //this is the default from octopus - natoms_(natoms), pseudo_set_(conf.pseudopotentials_value()), double_grid_(conf.double_grid_value()), fourier_pseudo_(conf.fourier_pseudo_value()) @@ -69,29 +66,20 @@ namespace hamiltonian { gcutoff *= double_grid_.spacing_factor(); has_nlcc_ = false; - nelectrons_ = 0.0; - for(int iatom = 0; iatom < natoms; iatom++){ - if(!pseudo_set_.has(atom_list[iatom])) throw std::runtime_error("inq error: pseudopotential for element " + atom_list[iatom].symbol() + " not found."); + for(auto const & species : species_list) { + if(!pseudo_set_.has(species)) throw std::runtime_error("inq error: pseudopotential for element " + species.symbol() + " not found."); - auto map_ref = pseudopotential_list_.find(atom_list[iatom].symbol()); + if(pseudopotential_list_.find(species.symbol()) != pseudopotential_list_.end()) throw std::runtime_error("INQ Error: duplicated species"); - if(map_ref == pseudopotential_list_.end()){ - - auto file_path = pseudo_set_.file_path(atom_list[iatom]); - if(atom_list[iatom].has_file()) file_path = atom_list[iatom].file_path(); + auto file_path = pseudo_set_.file_path(species); + if(species.has_file()) file_path = species.file_path(); - //sorry for this, emplace has a super ugly syntax - auto insert = pseudopotential_list_.emplace(std::piecewise_construct, std::make_tuple(atom_list[iatom].symbol()), std::make_tuple(file_path, sep_, gcutoff, atom_list[iatom].filter_pseudo())); - map_ref = insert.first; - - } - - auto & pseudo = map_ref->second; + //sorry for this, emplace has a super ugly syntax + auto insert = pseudopotential_list_.emplace(std::piecewise_construct, std::make_tuple(species.symbol()), std::make_tuple(file_path, sep_, gcutoff, species.filter_pseudo())); + auto & pseudo = insert.first->second; - nelectrons_ += pseudo.valence_charge(); has_nlcc_ = has_nlcc_ or pseudo.has_nlcc_density(); - } } @@ -100,12 +88,19 @@ namespace hamiltonian { return pseudopotential_list_.size(); } - const double & num_electrons() const { - return nelectrons_; + template + auto num_electrons(SymbolsList const symbols_list) { + double nel = 0.0; + for(auto symbol : symbols_list) { + auto map_ref = pseudopotential_list_.find(symbol); + assert(map_ref != pseudopotential_list_.end()); + auto & pseudo = map_ref->second; + nel += pseudo.valence_charge(); + } + return nel; } - - template - const pseudopotential_type & pseudo_for_element(const element_type & el) const { + + auto & pseudo_for_element(input::species const & el) const { return pseudopotential_list_.at(el.symbol()); } @@ -116,7 +111,7 @@ namespace hamiltonian { basis::field potential(basis); - parallel::partition part(natoms_, comm); + parallel::partition part(ions.size(), comm); potential.fill(0.0); @@ -126,7 +121,7 @@ namespace hamiltonian { auto atom_position = ions.positions()[iatom]; - auto & ps = pseudo_for_element(ions.atoms()[iatom]); + auto & ps = pseudo_for_element(ions.species(iatom)); basis::spherical_grid sphere(basis, atom_position, ps.short_range_potential_radius()); if(not double_grid_.enabled()){ @@ -167,7 +162,7 @@ namespace hamiltonian { CALI_CXX_MARK_FUNCTION; - parallel::partition part(natoms_, comm); + parallel::partition part(ions.size(), comm); basis::field density(basis); @@ -179,7 +174,7 @@ namespace hamiltonian { auto atom_position = ions.positions()[iatom]; - auto & ps = pseudo_for_element(ions.atoms()[iatom]); + auto & ps = pseudo_for_element(ions.species(iatom)); basis::spherical_grid sphere(basis, atom_position, sep_.long_range_density_radius()); //OPTIMIZATION: this should be done in parallel for atoms too @@ -204,7 +199,7 @@ namespace hamiltonian { CALI_CXX_MARK_FUNCTION; - parallel::partition part(natoms_, comm); + parallel::partition part(ions.size(), comm); auto nspin = states.num_density_components(); basis::field_set density(basis, nspin); @@ -218,7 +213,7 @@ namespace hamiltonian { auto atom_position = ions.positions()[iatom]; - auto & ps = pseudo_for_element(ions.atoms()[iatom]); + auto & ps = pseudo_for_element(ions.species(iatom)); if(ps.has_electronic_density()){ @@ -267,7 +262,7 @@ namespace hamiltonian { CALI_CXX_MARK_FUNCTION; - parallel::partition part(natoms_, comm); + parallel::partition part(ions.size(), comm); basis::field density(basis); @@ -277,7 +272,7 @@ namespace hamiltonian { auto atom_position = ions.positions()[iatom]; - auto & ps = pseudo_for_element(ions.atoms()[iatom]); + auto & ps = pseudo_for_element(ions.species(iatom)); if(not ps.has_nlcc_density()) continue; @@ -304,7 +299,6 @@ namespace hamiltonian { void info(output_stream & out) const { out << "ATOMIC POTENTIAL:" << std::endl; out << " Number of species = " << num_species() << std::endl; - out << " Number of electrons = " << num_electrons() << std::endl; out << std::endl; } @@ -347,38 +341,35 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG){ SECTION("Non-existing element"){ std::vector el_list({"P", "X"}); - CHECK_THROWS(hamiltonian::atomic_potential(el_list.size(), el_list, gcut)); + CHECK_THROWS(hamiltonian::atomic_potential(el_list, gcut)); } SECTION("Duplicated element"){ std::vector el_list({"N", "N"}); - - hamiltonian::atomic_potential pot(el_list.size(), el_list.begin(), gcut); - - CHECK(pot.num_species() == 1); - CHECK(pot.num_electrons() == 10.0_a); - + CHECK_THROWS(hamiltonian::atomic_potential(el_list, gcut)); } SECTION("Empty list"){ std::vector el_list; - hamiltonian::atomic_potential pot(el_list.size(), el_list, gcut); + hamiltonian::atomic_potential pot(el_list, gcut); CHECK(pot.num_species() == 0); - CHECK(pot.num_electrons() == 0.0_a); CHECK(not pot.has_nlcc()); } SECTION("CNOH"){ - species el_list[] = {"C", "N", "O", "H"}; + ionic::species_set el_list; + el_list.insert("C"); + el_list.insert("N"); + el_list.insert("O"); + el_list.insert("H"); - hamiltonian::atomic_potential pot(4, el_list, gcut); + hamiltonian::atomic_potential pot(el_list, gcut); CHECK(pot.num_species() == 4); - CHECK(pot.num_electrons() == 16.0_a); } SECTION("Construct from a geometry"){ @@ -387,10 +378,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG){ basis::real_space rs(ions.cell(), /*spacing = */ 0.49672941, comm); - hamiltonian::atomic_potential pot(ions.size(), ions.atoms(), rs.gcutoff()); + hamiltonian::atomic_potential pot(ions.species_list(), rs.gcutoff()); CHECK(pot.num_species() == 2); - CHECK(pot.num_electrons() == 30.0_a); + CHECK(pot.num_electrons(ions.symbols()) == 30.0_a); rs.info(std::cout); diff --git a/src/hamiltonian/ks_hamiltonian.hpp b/src/hamiltonian/ks_hamiltonian.hpp index 7f6e6c86..eea8f1bf 100644 --- a/src/hamiltonian/ks_hamiltonian.hpp +++ b/src/hamiltonian/ks_hamiltonian.hpp @@ -62,10 +62,10 @@ class ks_hamiltonian { for(int iatom = 0; iatom < ions.size(); iatom++){ if(non_local_in_fourier_){ - auto insert = projectors_fourier_map_.emplace(ions.atoms()[iatom].symbol(), projector_fourier(basis, pot.pseudo_for_element(ions.atoms()[iatom]))); + auto insert = projectors_fourier_map_.emplace(ions.symbol(iatom), projector_fourier(basis, pot.pseudo_for_element(ions.species(iatom)))); insert.first->second.add_coord(basis.cell().metric().to_contravariant(ions.positions()[iatom])); } else { - projectors.emplace_back(basis, pot.double_grid(), pot.pseudo_for_element(ions.atoms()[iatom]), ions.positions()[iatom], iatom); + projectors.emplace_back(basis, pot.double_grid(), pot.pseudo_for_element(ions.species(iatom)), ions.positions()[iatom], iatom); if(projectors.back().empty()) projectors.pop_back(); } } @@ -263,7 +263,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG){ CHECK(rs.volume_element() == 0.125_a); } - hamiltonian::atomic_potential pot(ions.size(), ions.atoms(), rs.gcutoff()); + hamiltonian::atomic_potential pot(ions.species_list(), rs.gcutoff()); states::ks_states st(states::spin_config::UNPOLARIZED, 11.0); diff --git a/src/ionic/brillouin.hpp b/src/ionic/brillouin.hpp index 06005a95..01ef5dd7 100644 --- a/src/ionic/brillouin.hpp +++ b/src/ionic/brillouin.hpp @@ -45,7 +45,7 @@ class brillouin { positions[2] = 0.0; for(int iatom = 0; iatom < ions.size(); iatom++){ - types[iatom] = ions.atoms()[iatom].atomic_number(); + types[iatom] = ions.species(iatom).atomic_number(); auto pos = ions.cell().metric().to_contravariant(ions.cell().position_in_cell(ions.positions()[iatom])); positions[3*iatom + 0] = pos[0]; positions[3*iatom + 1] = pos[1]; diff --git a/src/ionic/interaction.hpp b/src/ionic/interaction.hpp index f0056989..346d76fd 100644 --- a/src/ionic/interaction.hpp +++ b/src/ionic/interaction.hpp @@ -326,7 +326,7 @@ auto interaction_energy(const cell_type & cell, const geometry_type & geo, const boost::multi::array, 1> forces(geo.size()); boost::multi::array charges(geo.size()); - for(int ii = 0; ii < geo.size(); ii++) charges[ii] = atomic_pot.pseudo_for_element(geo.atoms()[ii]).valence_charge(); + for(int ii = 0; ii < geo.size(); ii++) charges[ii] = atomic_pot.pseudo_for_element(geo.species(ii)).valence_charge(); interaction_energy(geo.size(), cell, charges, geo.positions(), atomic_pot.range_separation(), energy, forces); @@ -344,7 +344,7 @@ auto interaction_forces(const cell_type & cell, const geometry_type & geo, const boost::multi::array, 1> forces(geo.size()); boost::multi::array charges(geo.size()); - for(int ii = 0; ii < geo.size(); ii++) charges[ii] = atomic_pot.pseudo_for_element(geo.atoms()[ii]).valence_charge(); + for(int ii = 0; ii < geo.size(); ii++) charges[ii] = atomic_pot.pseudo_for_element(geo.species(ii)).valence_charge(); interaction_energy(geo.size(), cell, charges, geo.positions(), atomic_pot.range_separation(), energy, forces); diff --git a/src/ionic/propagator.hpp b/src/ionic/propagator.hpp index 3336fed8..1e0176ae 100644 --- a/src/ionic/propagator.hpp +++ b/src/ionic/propagator.hpp @@ -72,7 +72,7 @@ struct molecular_dynamics{ template auto acceleration(TypeIons& ions, TypeForces forces) const { - for(int iatom = 0; iatom < ions.size(); iatom++) forces[iatom] /= ions.atoms()[iatom].mass(); + for(int iatom = 0; iatom < ions.size(); iatom++) forces[iatom] /= ions.species(iatom).mass(); return forces; } diff --git a/src/ionic/species_set.hpp b/src/ionic/species_set.hpp new file mode 100644 index 00000000..2c0a567c --- /dev/null +++ b/src/ionic/species_set.hpp @@ -0,0 +1,82 @@ +/* -*- indent-tabs-mode: t -*- */ + +#ifndef INQ__IONIC__SPECIES_SET +#define INQ__IONIC__SPECIES_SET + +// Copyright (C) 2019-2024 Lawrence Livermore National Security, LLC., Xavier Andrade, Alfredo A. Correa +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#include + +namespace inq { +namespace ionic { + +class species_set { + + using container_type = std::unordered_map; + + container_type list_; + +public: + + auto size() const { + return (long) list_.size(); + } + + auto & list() const { + return list_; + } + + auto insert(input::species const & sp) { + list_.insert_or_assign(sp.symbol(), sp); + } + + auto & operator[](std::string const & symbol) const{ + return list_.at(symbol); + } + + struct const_iterator { + + container_type::const_iterator base_iter; + + auto operator!=(const_iterator const & other) const { + return base_iter != other.base_iter; + } + + auto operator++() { + return const_iterator{++base_iter}; + } + + auto operator*() const { + return base_iter->second; + } + + }; + + auto begin() const { + return const_iterator{list_.begin()}; + } + + auto end() const { + return const_iterator{list_.end()}; + } + +}; + +} +} +#endif + +#ifdef INQ_IONIC_SPECIES_SET_UNIT_TEST +#undef INQ_IONIC_SPECIES_SET_UNIT_TEST + +#include + +TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { + +} + +#endif diff --git a/src/observables/dipole.hpp b/src/observables/dipole.hpp index 97e570e6..0a1c0578 100644 --- a/src/observables/dipole.hpp +++ b/src/observables/dipole.hpp @@ -47,7 +47,7 @@ vector3 dipole(systems::ions const & ions, const hamiltonian::atomic_pot vector3 dip = {0.0, 0.0, 0.0}; for(int iatom = 0; iatom < ions.size(); iatom++){ - auto zval = atomic_pot.pseudo_for_element(ions.atoms()[iatom]).valence_charge(); + auto zval = atomic_pot.pseudo_for_element(ions.species(iatom)).valence_charge(); dip += proton_charge*zval*ions.positions()[iatom]; } diff --git a/src/systems/electrons.hpp b/src/systems/electrons.hpp index 78e10b01..8069e2f1 100644 --- a/src/systems/electrons.hpp +++ b/src/systems/electrons.hpp @@ -135,8 +135,8 @@ class electrons { template electrons(input::parallelization const & dist, const inq::systems::ions & ions, const options::electrons & conf = {}, KptsType const & kpts = input::kpoints::gamma()): brillouin_zone_(ions, kpts), - atomic_pot_(ions.size(), ions.atoms(), basis::real_space::gcutoff(ions.cell(), conf.spacing_value()), conf), - states_(conf.spin_val(), atomic_pot_.num_electrons() + conf.extra_electrons_val(), conf.extra_states_val(), conf.temperature_val(), kpts.size()), + atomic_pot_(ions.species_list(), basis::real_space::gcutoff(ions.cell(), conf.spacing_value()), conf), + states_(conf.spin_val(), atomic_pot_.num_electrons(ions.symbols()) + conf.extra_electrons_val(), conf.extra_states_val(), conf.temperature_val(), kpts.size()), full_comm_(dist.cart_comm(conf.num_spin_components_val(), brillouin_zone_.size(), states_.num_states())), kpin_comm_(kpin_subcomm(full_comm_)), kpin_states_comm_(kpin_states_subcomm(full_comm_)), @@ -186,8 +186,8 @@ class electrons { eigenvalues_.reextent({static_cast(kpin_.size()), max_local_spinor_set_size_}); occupations_.reextent({static_cast(kpin_.size()), max_local_spinor_set_size_}); - if(atomic_pot_.num_electrons() + conf.extra_electrons_val() == 0) throw std::runtime_error("inq error: the system does not have any electrons"); - if(atomic_pot_.num_electrons() + conf.extra_electrons_val() < 0) throw std::runtime_error("inq error: the system has a negative number of electrons"); + if(states_.num_electrons() == 0.0) throw std::runtime_error("inq error: the system does not have any electrons"); + if(states_.num_electrons() < 0.0) throw std::runtime_error("inq error: the system has a negative number of electrons"); print(ions); diff --git a/src/systems/ions.hpp b/src/systems/ions.hpp index 3ac48e88..f4cf510b 100644 --- a/src/systems/ions.hpp +++ b/src/systems/ions.hpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -34,16 +35,18 @@ class ions { private: - inq::systems::cell cell_; - std::vector atoms_; + systems::cell cell_; + std::vector atoms_; positions_type positions_; - velocities_type velocities_; + velocities_type velocities_; + ionic::species_set species_list_; template void add_atom(input::species const & element, PositionType const & position, vector3 const & vel = vector3(0.0, 0.0, 0.0)){ - atoms_.push_back(element); + atoms_.push_back(element.symbol()); positions_.push_back(in_atomic_units(position)); velocities_.push_back(vel); + species_list_.insert(element); } public: @@ -149,9 +152,17 @@ class ions { } #endif - auto & atoms() const { + auto & symbols() const { return atoms_; } + + auto & symbol(int const & iatom) const { + return atoms_[iatom]; + } + + auto & species(int const & iatom) const { + return species_list_[atoms_[iatom]]; + } auto & positions() const { return positions_; @@ -168,8 +179,12 @@ class ions { auto & velocities() { return velocities_; } + + auto & species_list() const { + return species_list_; + } - auto symmetry_string() const{ + auto symmetry_string() const { assert(size() > 0); @@ -179,7 +194,7 @@ class ions { std::vector lin_pos(3*size()); for(int iatom = 0; iatom < size(); iatom++){ - types[iatom] = atoms()[iatom].atomic_number(); + types[iatom] = species(iatom).atomic_number(); auto pos = cell_.metric().to_contravariant(cell_.position_in_cell(positions()[iatom])); lin_pos[3*iatom + 0] = pos[0]; lin_pos[3*iatom + 1] = pos[1]; @@ -237,7 +252,7 @@ class ions { out << "Ions (" << self.size() << " total):" << std::endl; for(int iatom = 0; iatom < self.size(); iatom++){ - out << " " << iatom << "\t-\t" << self.atoms_[iatom].symbol() << '\t' << self.positions_[iatom]; + out << " " << iatom << "\t-\t" << self.atoms_[iatom] << '\t' << self.positions_[iatom]; if(print_vel) out << "\t\t-\t" << self.velocities_[iatom]; out << '\n'; } @@ -248,7 +263,7 @@ class ions { auto kinetic_energy() { auto energy = 0.0; for(int iatom = 0; iatom < size(); iatom++){ - energy += 0.5*atoms()[iatom].mass()*norm(velocities()[iatom]); + energy += 0.5*species(iatom).mass()*norm(velocities()[iatom]); } return energy; } @@ -329,10 +344,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { ions.insert("Xe", {1000.0_b, -200.0_b, 6.0_b}); CHECK(ions.size() == 1); - CHECK(ions.atoms()[0].atomic_number() == 54); - CHECK(ions.atoms()[0] == input::species(54)); - CHECK(ions.atoms()[0].charge() == -54.0_a); - CHECK(ions.atoms()[0].mass() == 239333.5935636_a); + CHECK(ions.species(0).atomic_number() == 54); + CHECK(ions.species(0) == input::species(54)); + CHECK(ions.species(0).charge() == -54.0_a); + CHECK(ions.species(0).mass() == 239333.5935636_a); CHECK(ions.positions()[0][0] == 1000.0_a); CHECK(ions.positions()[0][1] == -200.0_a); CHECK(ions.positions()[0][2] == 6.0_a); @@ -364,16 +379,16 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 12); - CHECK(ions.atoms()[2] == "C"); - CHECK(ions.atoms()[2].charge() == -6.0_a); - CHECK(ions.atoms()[2].mass() == 21892.1617296_a); + CHECK(ions.species(2) == "C"); + CHECK(ions.species(2).charge() == -6.0_a); + CHECK(ions.species(2).mass() == 21892.1617296_a); CHECK(ions.positions()[2][0] == 2.2846788549_a); CHECK(ions.positions()[2][1] == -1.3190288178_a); CHECK(ions.positions()[2][2] == 0.0_a); - CHECK(ions.atoms()[11] == "H"); - CHECK(ions.atoms()[11].charge() == -1.0_a); - CHECK(ions.atoms()[11].mass() == 1837.17994584_a); + CHECK(ions.species(11) == "H"); + CHECK(ions.species(11).charge() == -1.0_a); + CHECK(ions.species(11).mass() == 1837.17994584_a); CHECK(ions.positions()[11][0] == -4.0572419367_a); CHECK(ions.positions()[11][1] == 2.343260364_a); CHECK(ions.positions()[11][2] == 0.0_a); @@ -386,10 +401,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { ions.insert("Cl", {-3.0_b, 4.0_b, 5.0_b}); CHECK(ions.size() == 13); - CHECK(ions.atoms()[12].atomic_number() == 17); - CHECK(ions.atoms()[12] == input::species(17)); - CHECK(ions.atoms()[12].charge() == -17.0_a); - CHECK(ions.atoms()[12].mass() == 64614.105771_a); + CHECK(ions.species(12).atomic_number() == 17); + CHECK(ions.species(12) == input::species(17)); + CHECK(ions.species(12).charge() == -17.0_a); + CHECK(ions.species(12).mass() == 64614.105771_a); CHECK(ions.positions()[12][0] == -3.0_a); CHECK(ions.positions()[12][1] == 4.0_a); CHECK(ions.positions()[12][2] == 5.0_a); @@ -415,16 +430,16 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(read_ions.size() == 13); - CHECK(read_ions.atoms()[2] == "C"); - CHECK(read_ions.atoms()[2].charge() == -6.0_a); - CHECK(read_ions.atoms()[2].mass() == 21892.1617296_a); + CHECK(read_ions.species(2) == "C"); + CHECK(read_ions.species(2).charge() == -6.0_a); + CHECK(read_ions.species(2).mass() == 21892.1617296_a); CHECK(read_ions.positions()[2][0] == 2.2846788549_a); CHECK(read_ions.positions()[2][1] == -1.3190288178_a); CHECK(read_ions.positions()[2][2] == 0.0_a); - CHECK(read_ions.atoms()[11] == "H"); - CHECK(read_ions.atoms()[11].charge() == -1.0_a); - CHECK(read_ions.atoms()[11].mass() == 1837.17994584_a); + CHECK(read_ions.species(11) == "H"); + CHECK(read_ions.species(11).charge() == -1.0_a); + CHECK(read_ions.species(11).mass() == 1837.17994584_a); CHECK(read_ions.positions()[11][0] == -4.0572419367_a); CHECK(read_ions.positions()[11][1] == 2.343260364_a); CHECK(read_ions.positions()[11][2] == 0.0_a); @@ -432,10 +447,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(read_ions.velocities()[11][1] == 0.0_a); CHECK(read_ions.velocities()[11][2] == 0.0_a); - CHECK(read_ions.atoms()[12].atomic_number() == 17); - CHECK(read_ions.atoms()[12] == input::species(17)); - CHECK(read_ions.atoms()[12].charge() == -17.0_a); - CHECK(read_ions.atoms()[12].mass() == 64614.105771_a); + CHECK(read_ions.species(12).atomic_number() == 17); + CHECK(read_ions.species(12) == input::species(17)); + CHECK(read_ions.species(12).charge() == -17.0_a); + CHECK(read_ions.species(12).mass() == 64614.105771_a); CHECK(read_ions.positions()[12][0] == -3.0_a); CHECK(read_ions.positions()[12][1] == 4.0_a); CHECK(read_ions.positions()[12][2] == 5.0_a); @@ -468,16 +483,16 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 12); - CHECK(ions.atoms()[2] == "C"); - CHECK(ions.atoms()[2].charge() == -6.0_a); - CHECK(ions.atoms()[2].mass() == 21892.1617296_a); + CHECK(ions.species(2) == "C"); + CHECK(ions.species(2).charge() == -6.0_a); + CHECK(ions.species(2).mass() == 21892.1617296_a); CHECK(ions.positions()[2][0] == 2.2846788549_a); CHECK(ions.positions()[2][1] == -1.3190288178_a); CHECK(ions.positions()[2][2] == 0.0_a); - CHECK(ions.atoms()[11] == "H"); - CHECK(ions.atoms()[11].charge() == -1.0_a); - CHECK(ions.atoms()[11].mass() == 1837.17994584_a); + CHECK(ions.species(11) == "H"); + CHECK(ions.species(11).charge() == -1.0_a); + CHECK(ions.species(11).mass() == 1837.17994584_a); CHECK(ions.positions()[11][0] == -4.0572419367_a); CHECK(ions.positions()[11][1] == 2.343260364_a); CHECK(ions.positions()[11][2] == 0.0_a); @@ -490,10 +505,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { ions.insert("Cl", {-3.0_b, 4.0_b, 5.0_b}); CHECK(ions.size() == 13); - CHECK(ions.atoms()[12].atomic_number() == 17); - CHECK(ions.atoms()[12] == input::species(17)); - CHECK(ions.atoms()[12].charge() == -17.0_a); - CHECK(ions.atoms()[12].mass() == 64614.105771_a); + CHECK(ions.species(12).atomic_number() == 17); + CHECK(ions.species(12) == input::species(17)); + CHECK(ions.species(12).charge() == -17.0_a); + CHECK(ions.species(12).mass() == 64614.105771_a); CHECK(ions.positions()[12][0] == -3.0_a); CHECK(ions.positions()[12][1] == 4.0_a); CHECK(ions.positions()[12][2] == 5.0_a); @@ -521,10 +536,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 4); - CHECK(ions.atoms()[0] == "Al"); - CHECK(ions.atoms()[1] == "Al"); - CHECK(ions.atoms()[2] == "Al"); - CHECK(ions.atoms()[3] == "Al"); + CHECK(ions.species(0) == "Al"); + CHECK(ions.species(1) == "Al"); + CHECK(ions.species(2) == "Al"); + CHECK(ions.species(3) == "Al"); CHECK(ions.positions()[0][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][1] == Approx(0.0).margin(1e-12)); @@ -570,121 +585,121 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { // 5.85503 -> -3.6881312343 //Sr 0.00000 0.00000 1.95168 - CHECK(ions.atoms()[0] == "Sr"); + CHECK(ions.species(0) == "Sr"); CHECK(ions.positions()[0][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][2] == 3.6881312343_a); //Sr 0.00000 0.00000 5.85503 - CHECK(ions.atoms()[1] == "Sr"); + CHECK(ions.species(1) == "Sr"); CHECK(ions.positions()[1][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][2] == -3.6881312343_a); //Sr 2.76010 2.76010 5.85503 - CHECK(ions.atoms()[2] == "Sr"); + CHECK(ions.species(2) == "Sr"); CHECK(ions.positions()[2][0] == -5.2158330766_a); CHECK(ions.positions()[2][1] == -5.2158330766_a); CHECK(ions.positions()[2][2] == -3.6881312343_a); //Sr 2.76010 2.76010 1.95167 - CHECK(ions.atoms()[3] == "Sr"); + CHECK(ions.species(3) == "Sr"); CHECK(ions.positions()[3][0] == -5.2158330766_a); CHECK(ions.positions()[3][1] == -5.2158330766_a); CHECK(ions.positions()[3][2] == 3.6881312343_a); //Ti 2.76010 0.00000 0.00000 - CHECK(ions.atoms()[4] == "Ti"); + CHECK(ions.species(4) == "Ti"); CHECK(ions.positions()[4][0] == -5.2158330766_a); CHECK(ions.positions()[4][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[4][2] == Approx(0.0).margin(1e-12)); //Ti 2.76010 0.00000 3.90335 - CHECK(ions.atoms()[5] == "Ti"); + CHECK(ions.species(5) == "Ti"); CHECK(ions.positions()[5][0] == -5.2158330766_a); CHECK(ions.positions()[5][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[5][2] == -7.3762624686_a); //Ti 0.00000 2.76010 3.90335 - CHECK(ions.atoms()[6] == "Ti"); + CHECK(ions.species(6) == "Ti"); CHECK(ions.positions()[6][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[6][1] == -5.2158330766_a); CHECK(ions.positions()[6][2] == -7.3762624686_a); //Ti 0.00000 2.76010 0.00000 - CHECK(ions.atoms()[7] == "Ti"); + CHECK(ions.species(7) == "Ti"); CHECK(ions.positions()[7][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[7][1] == -5.2158330766_a); CHECK(ions.positions()[7][2] == Approx(0.0).margin(1e-12)); //O 0.00000 2.76010 1.95168 - CHECK(ions.atoms()[8] == "O"); + CHECK(ions.species(8) == "O"); CHECK(ions.positions()[8][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[8][1] == -5.2158330766_a); CHECK(ions.positions()[8][2] == 3.6881312343_a); //O 0.00000 2.76010 5.85503 - CHECK(ions.atoms()[9] == "O"); + CHECK(ions.species(9) == "O"); CHECK(ions.positions()[9][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[9][1] == -5.2158330766_a); CHECK(ions.positions()[9][2] == -3.6881312343_a); //O 2.76010 0.00000 5.85503 - CHECK(ions.atoms()[10] == "O"); + CHECK(ions.species(10) == "O"); CHECK(ions.positions()[10][0] == -5.2158330766_a); CHECK(ions.positions()[10][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[10][2] == -3.6881312343_a); //O 2.76010 0.00000 1.95167 - CHECK(ions.atoms()[11] == "O"); + CHECK(ions.species(11) == "O"); CHECK(ions.positions()[11][0] == -5.2158330766_a); CHECK(ions.positions()[11][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[11][2] == 3.6881312343_a); //O 4.14015 1.38005 0.00000 - CHECK(ions.atoms()[12] == "O"); + CHECK(ions.species(12) == "O"); CHECK(ions.positions()[12][0] == -2.6079165383_a); CHECK(ions.positions()[12][1] == 2.6079165383_a); CHECK(ions.positions()[12][2] == Approx(0.0).margin(1e-12)); //4.14015 1.38005 3.90335 - CHECK(ions.atoms()[13] == "O"); + CHECK(ions.species(13) == "O"); CHECK(ions.positions()[13][0] == -2.6079165383_a); CHECK(ions.positions()[13][1] == 2.6079165383_a); CHECK(ions.positions()[13][2] == -7.3762624686_a); //O 1.38005 4.14015 3.90335 - CHECK(ions.atoms()[14] == "O"); + CHECK(ions.species(14) == "O"); CHECK(ions.positions()[14][0] == 2.6079165383_a); CHECK(ions.positions()[14][1] == -2.6079165383_a); CHECK(ions.positions()[14][2] == -7.3762624686_a); //O 1.38005 1.38005 3.90335 - CHECK(ions.atoms()[15] == "O"); + CHECK(ions.species(15) == "O"); CHECK(ions.positions()[15][0] == 2.6079165383_a); CHECK(ions.positions()[15][1] == 2.6079165383_a); CHECK(ions.positions()[15][2] == -7.3762624686_a); //O 4.14015 4.14015 3.90335 - CHECK(ions.atoms()[16] == "O"); + CHECK(ions.species(16) == "O"); CHECK(ions.positions()[16][0] == -2.6079165383_a); CHECK(ions.positions()[16][1] == -2.6079165383_a); CHECK(ions.positions()[16][2] == -7.3762624686_a); //O 4.14015 4.14015 0.00000 - CHECK(ions.atoms()[17] == "O"); + CHECK(ions.species(17) == "O"); CHECK(ions.positions()[17][0] == -2.6079165383_a); CHECK(ions.positions()[17][1] == -2.6079165383_a); CHECK(ions.positions()[17][2] == Approx(0.0).margin(1e-12)); //O 1.38005 1.38005 0.00000 - CHECK(ions.atoms()[18] == "O"); + CHECK(ions.species(18) == "O"); CHECK(ions.positions()[18][0] == 2.6079165383_a); CHECK(ions.positions()[18][1] == 2.6079165383_a); CHECK(ions.positions()[18][2] == Approx(0.0).margin(1e-12)); //O 1.38005 4.14015 0.00000 - CHECK(ions.atoms()[19] == "O"); + CHECK(ions.species(19) == "O"); CHECK(ions.positions()[19][0] == 2.6079165383_a); CHECK(ions.positions()[19][1] == -2.6079165383_a); CHECK(ions.positions()[19][2] == Approx(0.0).margin(1e-12)); @@ -707,62 +722,62 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 12); - CHECK(ions.atoms()[0] == "Ca"); + CHECK(ions.species(0) == "Ca"); CHECK(ions.positions()[0][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][2] == 9.6727962369_a); - CHECK(ions.atoms()[1] == "Ca"); + CHECK(ions.species(1) == "Ca"); CHECK(ions.positions()[1][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][2] == -9.6727962369_a); - CHECK(ions.atoms()[2] == "Ca"); + CHECK(ions.species(2) == "Ca"); CHECK(ions.positions()[2][0] == -4.0734958074_a); CHECK(ions.positions()[2][1] == 2.3518339010_a); CHECK(ions.positions()[2][2] == -18.3787432869_a); - CHECK(ions.atoms()[3] == "Ca"); + CHECK(ions.species(3) == "Ca"); CHECK(ions.positions()[3][0] == -4.0734958074_a); CHECK(ions.positions()[3][1] == 2.3518339010_a); CHECK(ions.positions()[3][2] == 4.3529735250_a); - CHECK(ions.atoms()[4] == "Ca"); + CHECK(ions.species(4) == "Ca"); CHECK(ions.positions()[4][0] == 4.0734958074_a); CHECK(ions.positions()[4][1] == -2.3518339010_a); CHECK(ions.positions()[4][2] == -4.3529735250_a); - CHECK(ions.atoms()[5] == "Ca"); + CHECK(ions.species(5) == "Ca"); CHECK(ions.positions()[5][0] == 4.0734958074_a); CHECK(ions.positions()[5][1] == -2.3518339010_a); CHECK(ions.positions()[5][2] == 18.3787432869_a); - CHECK(ions.atoms()[6] == "P"); + CHECK(ions.species(6) == "P"); CHECK(ions.positions()[6][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[6][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[6][2] == -21.0386546428_a); - CHECK(ions.atoms()[7] == "P"); + CHECK(ions.species(7) == "P"); CHECK(ions.positions()[7][0] == -4.0734958074_a); CHECK(ions.positions()[7][1] == 2.3518339010_a); CHECK(ions.positions()[7][2] == -7.0128848809_a); - CHECK(ions.atoms()[8] == "P"); + CHECK(ions.species(8) == "P"); CHECK(ions.positions()[8][0] == 4.0734958074_a); CHECK(ions.positions()[8][1] == -2.3518339010_a); CHECK(ions.positions()[8][2] == 7.0128848809_a); - CHECK(ions.atoms()[9] == "I"); + CHECK(ions.species(9) == "I"); CHECK(ions.positions()[9][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[9][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[9][2] == Approx(0.0).margin(1e-12)); - CHECK(ions.atoms()[10] == "I"); + CHECK(ions.species(10) == "I"); CHECK(ions.positions()[10][0] == -4.0734958074_a); CHECK(ions.positions()[10][1] == 2.3518339010_a); CHECK(ions.positions()[10][2] == 14.0257697619_a); - CHECK(ions.atoms()[11] == "I"); + CHECK(ions.species(11) == "I"); CHECK(ions.positions()[11][0] == 4.0734958074_a); CHECK(ions.positions()[11][1] == -2.3518339010_a); CHECK(ions.positions()[11][2] == -14.0257697619_a); @@ -772,52 +787,52 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 10); - CHECK(ions.atoms()[0] == "Ca"); + CHECK(ions.species(0) == "Ca"); CHECK(ions.positions()[0][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][2] == 9.6727962369_a); - CHECK(ions.atoms()[1] == "Ca"); + CHECK(ions.species(1) == "Ca"); CHECK(ions.positions()[1][0] == -4.0734958074_a); CHECK(ions.positions()[1][1] == 2.3518339010_a); CHECK(ions.positions()[1][2] == -18.3787432869_a); - CHECK(ions.atoms()[2] == "Ca"); + CHECK(ions.species(2) == "Ca"); CHECK(ions.positions()[2][0] == -4.0734958074_a); CHECK(ions.positions()[2][1] == 2.3518339010_a); CHECK(ions.positions()[2][2] == 4.3529735250_a); - CHECK(ions.atoms()[3] == "Ca"); + CHECK(ions.species(3) == "Ca"); CHECK(ions.positions()[3][0] == 4.0734958074_a); CHECK(ions.positions()[3][1] == -2.3518339010_a); CHECK(ions.positions()[3][2] == -4.3529735250_a); - CHECK(ions.atoms()[4] == "Ca"); + CHECK(ions.species(4) == "Ca"); CHECK(ions.positions()[4][0] == 4.0734958074_a); CHECK(ions.positions()[4][1] == -2.3518339010_a); CHECK(ions.positions()[4][2] == 18.3787432869_a); - CHECK(ions.atoms()[5] == "P"); + CHECK(ions.species(5) == "P"); CHECK(ions.positions()[5][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[5][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[5][2] == -21.0386546428_a); - CHECK(ions.atoms()[6] == "P"); + CHECK(ions.species(6) == "P"); CHECK(ions.positions()[6][0] == 4.0734958074_a); CHECK(ions.positions()[6][1] == -2.3518339010_a); CHECK(ions.positions()[6][2] == 7.0128848809_a); - CHECK(ions.atoms()[7] == "I"); + CHECK(ions.species(7) == "I"); CHECK(ions.positions()[7][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[7][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[7][2] == Approx(0.0).margin(1e-12)); - CHECK(ions.atoms()[8] == "I"); + CHECK(ions.species(8) == "I"); CHECK(ions.positions()[8][0] == -4.0734958074_a); CHECK(ions.positions()[8][1] == 2.3518339010_a); CHECK(ions.positions()[8][2] == 14.0257697619_a); - CHECK(ions.atoms()[9] == "I"); + CHECK(ions.species(9) == "I"); CHECK(ions.positions()[9][0] == 4.0734958074_a); CHECK(ions.positions()[9][1] == -2.3518339010_a); CHECK(ions.positions()[9][2] == -14.0257697619_a); @@ -840,62 +855,62 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 12); //the order here is to match the symmetrized test above - CHECK(ions.atoms()[1] == "Ca"); + CHECK(ions.species(1) == "Ca"); CHECK(ions.positions()[1][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[1][2] == 9.6727962369_a); - CHECK(ions.atoms()[4] == "Ca"); + CHECK(ions.species(4) == "Ca"); CHECK(ions.positions()[4][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[4][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[4][2] == -9.6727962369_a); - CHECK(ions.atoms()[3] == "Ca"); + CHECK(ions.species(3) == "Ca"); CHECK(ions.positions()[3][0] == -4.0734958074_a); CHECK(ions.positions()[3][1] == 2.3518339010_a); CHECK(ions.positions()[3][2] == -18.3787432869_a); - CHECK(ions.atoms()[0] == "Ca"); + CHECK(ions.species(0) == "Ca"); CHECK(ions.positions()[0][0] == -4.0734958074_a); CHECK(ions.positions()[0][1] == 2.3518339010_a); CHECK(ions.positions()[0][2] == 4.3529735250_a); - CHECK(ions.atoms()[5] == "Ca"); + CHECK(ions.species(5) == "Ca"); CHECK(ions.positions()[5][0] == 4.0734958074_a); CHECK(ions.positions()[5][1] == -2.3518339010_a); CHECK(ions.positions()[5][2] == -4.3529735250_a); - CHECK(ions.atoms()[2] == "Ca"); + CHECK(ions.species(2) == "Ca"); CHECK(ions.positions()[2][0] == 4.0734958074_a); CHECK(ions.positions()[2][1] == -2.3518339010_a); CHECK(ions.positions()[2][2] == 18.3787432869_a); - CHECK(ions.atoms()[7] == "P"); + CHECK(ions.species(7) == "P"); CHECK(ions.positions()[7][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[7][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[7][2] == -21.0386546428_a); - CHECK(ions.atoms()[8] == "P"); + CHECK(ions.species(8) == "P"); CHECK(ions.positions()[8][0] == -4.0734958074_a); CHECK(ions.positions()[8][1] == 2.3518339010_a); CHECK(ions.positions()[8][2] == -7.0128848809_a); - CHECK(ions.atoms()[6] == "P"); + CHECK(ions.species(6) == "P"); CHECK(ions.positions()[6][0] == 4.0734958074_a); CHECK(ions.positions()[6][1] == -2.3518339010_a); CHECK(ions.positions()[6][2] == 7.0128848809_a); - CHECK(ions.atoms()[9] == "I"); + CHECK(ions.species(9) == "I"); CHECK(ions.positions()[9][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[9][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[9][2] == Approx(0.0).margin(1e-12)); - CHECK(ions.atoms()[10] == "I"); + CHECK(ions.species(10) == "I"); CHECK(ions.positions()[10][0] == -4.0734958074_a); CHECK(ions.positions()[10][1] == 2.3518339010_a); CHECK(ions.positions()[10][2] == 14.0257697619_a); - CHECK(ions.atoms()[11] == "I"); + CHECK(ions.species(11) == "I"); CHECK(ions.positions()[11][0] == 4.0734958074_a); CHECK(ions.positions()[11][1] == -2.3518339010_a); CHECK(ions.positions()[11][2] == -14.0257697619_a); @@ -919,17 +934,17 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 3); - CHECK(ions.atoms()[0] == "Na"); + CHECK(ions.species(0) == "Na"); CHECK(ions.positions()[0][0] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][1] == Approx(0.0).margin(1e-12)); CHECK(ions.positions()[0][2] == Approx(0.0).margin(1e-12)); - CHECK(ions.atoms()[1] == "Na"); + CHECK(ions.species(1) == "Na"); CHECK(ions.positions()[1][0] == 11.2403978126_a); CHECK(ions.positions()[1][1] == 2.2789211505_a); CHECK(ions.positions()[1][2] == 1.3517980130_a); - CHECK(ions.atoms()[2] == "Na"); + CHECK(ions.species(2) == "Na"); CHECK(ions.positions()[2][0] == -11.2403978126_a); CHECK(ions.positions()[2][1] == -2.2789211505_a); CHECK(ions.positions()[2][2] == -1.3517980130_a); @@ -951,8 +966,8 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 2); - CHECK(ions.atoms()[0] == "B"); - CHECK(ions.atoms()[1] == "N"); + CHECK(ions.species(0) == "B"); + CHECK(ions.species(1) == "N"); CHECK(ions.positions()[0][0] == 0.0_a); CHECK(ions.positions()[0][1] == 0.0_a); @@ -978,10 +993,10 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 4); - CHECK(ions.atoms()[0] == "Al"); - CHECK(ions.atoms()[1] == "Al"); - CHECK(ions.atoms()[2] == "Al"); - CHECK(ions.atoms()[3] == "Al"); + CHECK(ions.species(0) == "Al"); + CHECK(ions.species(1) == "Al"); + CHECK(ions.species(2) == "Al"); + CHECK(ions.species(3) == "Al"); CHECK(ions.positions()[0][0] == 0.0_a); CHECK(ions.positions()[0][1] == 0.0_a); @@ -1019,11 +1034,11 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 5); - CHECK(ions.atoms()[0] == "Ni"); - CHECK(ions.atoms()[1] == "Ni"); - CHECK(ions.atoms()[2] == "Ni"); - CHECK(ions.atoms()[3] == "Ni"); - CHECK(ions.atoms()[4] == "Ni"); + CHECK(ions.species(0) == "Ni"); + CHECK(ions.species(1) == "Ni"); + CHECK(ions.species(2) == "Ni"); + CHECK(ions.species(3) == "Ni"); + CHECK(ions.species(4) == "Ni"); CHECK(ions.positions()[0][0] == 0.0_a); CHECK(ions.positions()[0][1] == 0.0_a); @@ -1136,22 +1151,22 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(ions.size() == 128); - CHECK(ions.atoms()[0] == "C"); - CHECK(ions.atoms()[10] == "C"); - CHECK(ions.atoms()[20] == "C"); - CHECK(ions.atoms()[30] == "C"); - CHECK(ions.atoms()[40] == "C"); - CHECK(ions.atoms()[50] == "C"); - CHECK(ions.atoms()[60] == "C"); - CHECK(ions.atoms()[63] == "C"); - CHECK(ions.atoms()[64] == "O"); - CHECK(ions.atoms()[70] == "O"); - CHECK(ions.atoms()[80] == "O"); - CHECK(ions.atoms()[90] == "O"); - CHECK(ions.atoms()[100] == "O"); - CHECK(ions.atoms()[110] == "O"); - CHECK(ions.atoms()[120] == "O"); - CHECK(ions.atoms()[127] == "O"); + CHECK(ions.species(0) == "C"); + CHECK(ions.species(10) == "C"); + CHECK(ions.species(20) == "C"); + CHECK(ions.species(30) == "C"); + CHECK(ions.species(40) == "C"); + CHECK(ions.species(50) == "C"); + CHECK(ions.species(60) == "C"); + CHECK(ions.species(63) == "C"); + CHECK(ions.species(64) == "O"); + CHECK(ions.species(70) == "O"); + CHECK(ions.species(80) == "O"); + CHECK(ions.species(90) == "O"); + CHECK(ions.species(100) == "O"); + CHECK(ions.species(110) == "O"); + CHECK(ions.species(120) == "O"); + CHECK(ions.species(127) == "O"); CHECK(ions.positions()[1][0] == 17.2379607321_a); CHECK(ions.positions()[1][1] == 13.7235682342_a);