File size: 1,030 Bytes
613bec9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
from isotopomacLib import Isotope, calculate_isotopomers, sum_mass_numbers, remove_duplicates_and_count

def main():
    st.title("Isotopomer Calculator")
    
    st.sidebar.header("Input Isotopes")
    elements = get_input_elements()
    
    isotopomers = calculate_isotopomers(elements)
    st.write("Isotopomers:", isotopomers)
    
    unique_lists_count = remove_duplicates_and_count(isotopomers)
    st.write("Number of unique lists after removing duplicates:", unique_lists_count)

def get_input_elements():
    elements = []
    while True:
        symbol = st.sidebar.text_input("Enter element symbol (e.g., H, O):")
        if not symbol:
            break
        isotopes = st.sidebar.text_input("Enter isotopes for {} (comma-separated):".format(symbol))
        isotopes = [iso.strip() for iso in isotopes.split(",")]
        isotope_objects = [Isotope(symbol, int(iso)) for iso in isotopes]
        elements.append(isotope_objects)
    return elements

if __name__ == "__main__":
    main()