<commit_before>extern crate feroxide;


use feroxide::{
    Ion,
    Molecule, MoleculeCompound,
    Container, ContainerCompound,
    ElemReaction, ReactionSide, ReactionCompound,
    RedoxReaction,
    Properties, Reaction
};

use feroxide::data_atoms::*;
use feroxide::data_molecules::*;
use feroxide::data_sep::*;


fn main() {
    // You can create digital molecules with ease
    let carbondioxide = Molecule {
        compounds: vec! {
            MoleculeCompound { atom: CARBON, amount: 1 },
            MoleculeCompound { atom: OXYGEN, amount: 2 }
        }
    };

    // Of which you can generate the name
    let _name = carbondioxide.name();

    // ... or the symbol
    let symbol = carbondioxide.symbol();

    // You can calculate the mass per mole
    let mass_per_mole = carbondioxide.mass();

    // Multiply that with your amount of moles
    let weight = mass_per_mole * 10.0;

    // To get your data
    println!("10 moles of {} weigh {} gram(s).", symbol, weight);

    // If you don't want to type a lot, you could also use strings
    let carbonic_acid = Molecule::from_string("H2CO3".to_owned()).unwrap();

    // Throw a bunch of molecules together in a container with a bit of energy
    let mut container = Container {
        contents: vec! {
            ContainerCompound {
                element: carbondioxide.clone(),
                moles: 1000.0
            },

            ContainerCompound {
                element: WATER.clone(),
                moles: 1000.0
            }
        },

        available_energy: 100_000f64 // in Joules
    };

    // Specify the reaction that will occur
    // H₂O + CO₂ ⇌ H₂CO₃
    let reaction = ElemReaction {
        lhs: ReactionSide {
            compounds: vec! {
                ReactionCompound { element: WATER.clone(), amount: 1 },
                ReactionCompound { element: carbondioxide.clone(), amount: 1 }
            }
        },

        rhs: ReactionSide {
            compounds: vec! {
                ReactionCompound { element: carbonic_acid.clone(), amount: 1 }
            }
        },

        is_equilibrium: true
    };
<commit_msg>Add Ion to Container in example<commit_after>#[macro_use(ion_from_molecule)]
extern crate feroxide;


use feroxide::{
    Ion,
    Molecule, MoleculeCompound,
    Container, ContainerCompound,
    ElemReaction, ReactionSide, ReactionCompound,
    RedoxReaction,
    Properties, Reaction
};

use feroxide::data_atoms::*;
use feroxide::data_molecules::*;
use feroxide::data_sep::*;


fn main() {
    // You can create digital molecules with ease
    let carbondioxide = Molecule {
        compounds: vec! {
            MoleculeCompound { atom: CARBON, amount: 1 },
            MoleculeCompound { atom: OXYGEN, amount: 2 }
        }
    };

    // Of which you can generate the name
    let _name = carbondioxide.name();

    // ... or the symbol
    let symbol = carbondioxide.symbol();

    // You can calculate the mass per mole
    let mass_per_mole = carbondioxide.mass();

    // Multiply that with your amount of moles
    let weight = mass_per_mole * 10.0;

    // To get your data
    println!("10 moles of {} weigh {} gram(s).", symbol, weight);

    // If you don't want to type a lot, you could also use strings
    let carbonic_acid = Molecule::from_string("H2CO3".to_owned()).unwrap();

    // Throw a bunch of molecules together in a container with a bit of energy
    let mut container = Container {
        contents: vec! {
            ContainerCompound {
                element: ion_from_molecule!(carbondioxide.clone()),
                moles: 1000.0
            },

            ContainerCompound {
                element: ion_from_molecule!(WATER.clone()),
                moles: 1000.0
            },

            ContainerCompound {
                element: Ion::from_string("SO4;2-".to_owned()).unwrap(),
                moles: 100.0
            }
        },

        available_energy: 100_000f64 // in Joules
    };

    // Specify the reaction that will occur
    // H₂O + CO₂ ⇌ H₂CO₃
    let reaction = ElemReaction {
        lhs: ReactionSide {
            compounds: vec! {
                ReactionCompound { element: ion_from_molecule!(WATER.clone()), amount: 1 },
                ReactionCompound { element: ion_from_molecule!(carbondioxide.clone()), amount: 1 }
            }
        },

        rhs: ReactionSide {
            compounds: vec! {
                ReactionCompound { element: ion_from_molecule!(carbonic_acid.clone()), amount: 1 }
            }
        },

        is_equilibrium: true
    };

{'fraction_non_alphanumeric': 0.10122431132487976, 'fraction_numerical': 0.014429383471797114, 'mean_word_length': 2.01980198019802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1396144', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1312, 'n_words': 375}