function varargout = GUI_2_MW_of_NPs(varargin)


% A GRAPHICAL USER INTERFACE TO CALCULATE THE MOLECULAR WEIGHT OF
% NANOPARTICLES OF ARBITRARY GEOMETRY, ARBITRARY CRYSTAL LATTICE
% PARAMETERS, AND ARBITRARY ELEMENTAL COMPOSITION.

% RUN SCRIPT TO OPEN GUI

% CREATED BY DR LEWIS MACKENZIE. © Lewis MacKenzie 2017.
% www.LewisMacKenzie.science
% e: L.MacKenzie1@Leeds.ac.uk

% PLEASE CITE 'MACKENZIE ET AL., (2017) "The molecular weight of NaYF4:RE
% photonic up-conversion nanoparticles".

% Last Modified by GUIDE v2.5 07-Mar-2017 12:21:54

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_2_MW_of_NPs_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_2_MW_of_NPs_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before GUI_2_MW_of_NPs is made visible.
function GUI_2_MW_of_NPs_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI_2_MW_of_NPs (see VARARGIN)

% Choose default command line output for GUI_2_MW_of_NPs
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

%set hexagonal lattice inputs to be off as default is cubic
set(handles.lattice_c, 'Visible', 'off');
set(handles.lattice_c_label, 'Visible', 'off');
cubic=1;
hex=0;
grid on
grid minor
xlabel('Nanoparticle charactaristic size (nm)');
ylabel('Molecular weight (MDa)')
    

%set all non-spherical nanoparticle shape inputs to be off, as default is
%spherical

%disp('ran shape check on initialisation')

     %turn on spherical inputs
        set(handles.sphere_min_d, 'enable', 'on');
        set(handles.sphere_max_d, 'enable', 'on');
        
        %turn off cube inputs
        set(handles.cube_min_d, 'enable', 'off');
        set(handles.cube_max_d, 'enable', 'off');
        
        %turn off cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'off');
        set(handles.cylinder_max_d, 'enable', 'off');
           set(handles.cylinder_diameter_ratio, 'enable', 'off');
           
        %turn off tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'off');
        set(handles.tetra_max_d, 'enable', 'off');
     
                
        %turn off triangular inputs
        set(handles.triangle_min_d, 'enable', 'off');
        set(handles.triangle_max_d, 'enable', 'off');
        set(handles.triangle_height, 'enable', 'off');
set(gcf,'position',get(0,'screensize'))%set screensize+

% UIWAIT makes GUI_2_MW_of_NPs wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_2_MW_of_NPs_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SELECTION BOX FOR CUBIC OR HEXAGONAL LATTICE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% IF CUBIC OR HEX LATTICE TYPE IS CHANGED
% --- Executes on selection change in CubicORHex.
function CubicORHex_Callback(hObject, eventdata, handles)
% hObject    handle to CubicORHex (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns CubicORHex contents as cell array
%        contents{get(hObject,'Value')} returns selected item from CubicORHex
% LATTICE TYPE SELECTION BOX CALLBACK

%SWITCH ON VISIBILITY OF LATTICE PARAMETERS AS APPROPRIATE
switch get(hObject,'Value')
    case 1
        set(handles.lattice_c, 'Visible', 'off');
        set(handles.lattice_c_label, 'Visible', 'off');
    case 2
        set(handles.lattice_c, 'Visible', 'on');
        set(handles.lattice_c_label, 'Visible', 'on');
end
% --- Executes during object creation, after setting all properties.
function CubicORHex_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CubicORHex (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SELECTION BOX FOR NANOPARTICLE GEOMETRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --- Executes on selection change in NP_geometry.
function NP_geometry_Callback(hObject, eventdata, handles)
% hObject    handle to NP_geometry (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns NP_geometry contents as cell array
%        contents{get(hObject,'Value')} returns selected item from NP_geometry
switch get(hObject,'Value')
    
    case 1 %spherical case
               
        %turn on spherical inputs
        set(handles.sphere_min_d, 'enable', 'on');
        set(handles.sphere_max_d, 'enable', 'on');
        %turn off cube inputs
        set(handles.cube_min_d, 'enable', 'off');
        set(handles.cube_max_d, 'enable', 'off');
        %turn off cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'off');
        set(handles.cylinder_max_d, 'enable', 'off');
        %turn off tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'off');
        set(handles.tetra_max_d, 'enable', 'off');
        set(handles.cylinder_diameter_ratio, 'enable', 'off');
        %turn off triangular inputs
        set(handles.triangle_min_d, 'enable', 'off');
        set(handles.triangle_max_d, 'enable', 'off');
        set(handles.triangle_height, 'enable', 'off');
        
    case 2 %cube case
        
        %turn on cube inputs
        set(handles.cube_min_d, 'enable', 'on');
        set(handles.cube_max_d, 'enable', 'on');
        %turn off spherical inputs
        set(handles.sphere_min_d, 'enable', 'off');
        set(handles.sphere_max_d, 'enable', 'off');
        %turn off cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'off');
        set(handles.cylinder_max_d, 'enable', 'off');
        %turn off tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'off');
        set(handles.tetra_max_d, 'enable', 'off');
        set(handles.cylinder_diameter_ratio, 'enable', 'off');
        %turn off triangular inputs
        set(handles.triangle_min_d, 'enable', 'off');
        set(handles.triangle_max_d, 'enable', 'off');
        set(handles.triangle_height, 'enable', 'off');
        
    case 3 %cylindrical case            
        %turn on cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'on');
        set(handles.cylinder_max_d, 'enable', 'on');
        set(handles.cylinder_diameter_ratio, 'enable', 'on');
        %turn off cube inputs
        set(handles.cube_min_d, 'enable', 'off');
        set(handles.cube_max_d, 'enable', 'off');
        %turn off spherical inputs
        set(handles.sphere_min_d, 'enable', 'off');
        set(handles.sphere_max_d, 'enable', 'off');
        %turn off tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'off');
        set(handles.tetra_max_d, 'enable', 'off');
        %turn off triangular inputs
        set(handles.triangle_min_d, 'enable', 'off');
        set(handles.triangle_max_d, 'enable', 'off');
        set(handles.triangle_height, 'enable', 'off');

    case 4 %tetrahedral case
        %turn on tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'on');
        set(handles.tetra_max_d, 'enable', 'on');  
        %turn off cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'off');
        set(handles.cylinder_max_d, 'enable', 'off');
        set(handles.cylinder_diameter_ratio, 'enable', 'off');
        %turn off cube inputs
        set(handles.cube_min_d, 'enable', 'off');
        set(handles.cube_max_d, 'enable', 'off');
        %turn off spherical inputs
        set(handles.sphere_min_d, 'enable', 'off');
        set(handles.sphere_max_d, 'enable', 'off');
        %turn off triangular inputs
        set(handles.triangle_min_d, 'enable', 'off');
        set(handles.triangle_max_d, 'enable', 'off');
        set(handles.triangle_height, 'enable', 'off');
        
    case 5 %triangular case
        %turn on triangular inputs
        set(handles.triangle_min_d, 'enable', 'on');
        set(handles.triangle_max_d, 'enable', 'on');
        set(handles.triangle_height, 'enable', 'on');
        %turn off tetrahedral inputs
        set(handles.tetra_min_d, 'enable', 'off');
        set(handles.tetra_max_d, 'enable', 'off');
        set(handles.cylinder_diameter_ratio, 'enable', 'off');
        %turn off cylindical inputs
        set(handles.cylinder_min_d, 'enable', 'off');
        set(handles.cylinder_max_d, 'enable', 'off');
        %turn on cube inputs
        set(handles.cube_min_d, 'enable', 'off');
        set(handles.cube_max_d, 'enable', 'off');
        %turn off spherical inputs
        set(handles.sphere_min_d, 'enable', 'off');
        set(handles.sphere_max_d, 'enable', 'off');
end

% --- Executes during object creation, after setting all properties.
function NP_geometry_CreateFcn(hObject, eventdata, handles)
% hObject    handle to NP_geometry (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     CLICK BUTTON TO PLOT GRAPH
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --- Executes on button press in PLOT.
function PLOT_Callback(hObject, eventdata, handles)
% hObject    handle to PLOT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

clc %clear command line

%get graph hold option info
holdplotoption=get(handles.HoldPlotOption,'Value');


% GET ATOMIC WEIGHTS OF ELEMENTS
E1_AW=str2num(get(handles.AW_element_1,'String'));
E2_AW=str2num(get(handles.AW_element_2,'String'));
E3_AW=str2num(get(handles.AW_element_3,'String'));
E4_AW=str2num(get(handles.AW_element_4,'String'));
E5_AW=str2num(get(handles.AW_element_5,'String'));
E6_AW=str2num(get(handles.AW_element_6,'String'));
E7_AW=str2num(get(handles.AW_element_7,'String'));
E8_AW=str2num(get(handles.AW_element_8,'String'));


% GET THE NUMBER OF ATOMS IN EACH UNIT CELL
E1_NUM=str2num(get(handles.Number_in_unit_cell_element_1,'String'));
E2_NUM=str2num(get(handles.Number_in_unit_cell_element_2,'String'));
E3_NUM=str2num(get(handles.Number_in_unit_cell_element_3,'String'));
E4_NUM=str2num(get(handles.Number_in_unit_cell_element_4,'String'));
E5_NUM=str2num(get(handles.Number_in_unit_cell_element_5,'String'));
E6_NUM=str2num(get(handles.Number_in_unit_cell_element_6,'String'));
E7_NUM=str2num(get(handles.Number_in_unit_cell_element_7,'String'));
E8_NUM=str2num(get(handles.Number_in_unit_cell_element_8,'String'));


% CALCULATE UNIT CELL MOLECULAR WEIGHT
Unit_cell_weight=(E1_NUM*E1_AW)+(E2_NUM*E2_AW)+(E3_NUM*E3_AW)+(E4_NUM*E4_AW)+(E5_NUM*E5_AW)+(E6_NUM*E6_AW)+(E7_NUM*E7_AW)+(E8_NUM*E8_AW)

%retrieve lattice parameters
lattice_a=str2num(get(handles.lattice_a,'String'));
lattice_c=str2num(get(handles.lattice_c,'String'));

% TEST FOR NANOPARTICLE LATTICE TYPE
t=get(handles.CubicORHex,'value');
%if cubic then
if t==1
unit_cell_volume=(lattice_a/10)^3; %calculate unit cell volume in nm^3
cubic=1;
hex=0;
latticestring='cubic lattice';
    %grey out hexagonal c option
end

%if hexagonal then
if t==2
   
     cubic=0;
    hex=1;
    %calculate hexagonal unit cell volume from lattice parameters
    unit_cell_volume=2*(sqrt(3))/4*(lattice_a/10)^2*lattice_c/10; %calculate unit cell volume in nm^3
    latticestring='hexagonal lattice';
end

% TEST FOR NANOPARTICLE GEOMETRY
SHAPE_CHECK=get(handles.NP_geometry,'value');

%if spherical then
if SHAPE_CHECK==1
    %get maxd and mind
    maxd=str2num(get(handles.sphere_max_d,'String'));
    mind=str2num(get(handles.sphere_min_d,'String'));
    
    if mind>maxd
        msgbox('Error! Make sure your maximum diameter is greater than your minimum diameter')
    end
    
    d_range=[mind:0.01:maxd]; %nanoparticle size range
    %calculate volume of nanoparticles across this range
    v_range=(4/3)*pi*(d_range/2).^3;
    maxvol=max(v_range)
         shapestring='Spherical nanoparticles';
end

%if cube shaped
if SHAPE_CHECK==2
    %get maxd and mind
    maxd=str2num(get(handles.cube_max_d,'String'));
    mind=str2num(get(handles.cube_min_d,'String'));
      if mind>maxd
        msgbox('Error! Make sure your maximum diameter is greater than your minimum diameter')
    end
    d_range=[mind:0.01:maxd]; %nanoparticle size range
    %calculate volume of nanoparticles across this range
    v_range=d_range.^3;
        shapestring='Cubic nanoparticles';
end

%if cylinder shaped
if SHAPE_CHECK==3
    %get maxd and mind
    maxd=str2num(get(handles.cylinder_max_d,'String'));
    mind=str2num(get(handles.cylinder_min_d,'String'));
      if mind>maxd
        msgbox('Error! Make sure your maximum diameter is greater than your minimum diameter')
    end
    ratio=str2num(get(handles.cylinder_diameter_ratio,'String'));
    d_range=[mind:0.01:maxd]; %nanoparticle size range
    rad_range=d_range*ratio;
    %calculate volume of nanoparticles across this range
     v_range=pi*rad_range.^2.*d_range;
    shapestring='Cylindrical nanoparticles';
end

%if tetrahedral
if SHAPE_CHECK==4
    %get maxd and mind
    maxd=str2num(get(handles.tetra_max_d,'String'));
    mind=str2num(get(handles.tetra_min_d,'String'));
    if mind>maxd
        msgbox('Error! Make sure your maximum diameter is greater than your minimum diameter')
    end
    d_range=[mind:0.01:maxd] %nanoparticle size range
    %calculate volume of nanoparticles across this range
    v_range=(d_range.^3)./(6*sqrt(2));
        shapestring='Tetrahedral nanoparticles';
end

%if equilateral triangular
if SHAPE_CHECK==5
    %get maxd and mind
    maxd=str2num(get(handles.triangle_max_d,'String'));
    mind=str2num(get(handles.triangle_min_d,'String'));
    height_ratio=str2num(get(handles.triangle_height,'String'));
        
    if mind>maxd
        msgbox('Error! Make sure your maximum diameter is greater than your minimum diameter')
    end
    d_range=[mind:0.01:maxd]; %nanoparticle size range
    
    %calculate volume casioof nanoparticles across this range
    height_range=d_range*height_ratio;
    
    v_range=height_range*((sqrt(3))/4).*(d_range.^2);
    
    shapestring='Triangular nanoparticles';
end
   

%calculate number of unit cells within the volume
numcellsinv=v_range/unit_cell_volume;
max_num_unit_cells=max(numcellsinv)
%calculate molecular weight of nanoparticles
np_weight= numcellsinv*Unit_cell_weight;%/1000000;

if holdplotoption==1;
    hold  on
    grid on
    grid minor %keep grid minor
elseif holdplotoption==0;
    cla reset; % clear plots
    grid on
    grid minor %keep grid minor
end

%plot graph
plot(d_range,np_weight/1000000,'LineWidth',2);
grid minor
xlabel('Nanoparticle charactaristic size (nm)');
ylabel('Molecular weight (MDa)');


if holdplotoption==0;
title([shapestring ' - ' latticestring]); %if only a single plot, show the type of nanoparticle
elseif holdplotoption==1;
   title('')  %blank title if comparing plots
end

    





%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@              NANOPARTICLE SIZE AND SHAPE BOX            @@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



   

                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                          SPHERICAL MIN DIAMETER
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function sphere_min_d_Callback(hObject, eventdata, handles)
% hObject    handle to sphere_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sphere_min_d as text
%        str2double(get(hObject,'String')) returns contents of sphere_min_d as a double


% --- Executes during object creation, after setting all properties.
function sphere_min_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sphere_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                %                       SPHERICAL MAX DIAMETER
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function sphere_max_d_Callback(hObject, eventdata, handles)
% hObject    handle to sphere_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sphere_max_d as text
%        str2double(get(hObject,'String')) returns contents of sphere_max_d as a double


% --- Executes during object creation, after setting all properties.
function sphere_max_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sphere_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                       CUBE MIN DIAMETER
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function cube_min_d_Callback(hObject, eventdata, handles)
% hObject    handle to cube_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of cube_min_d as text
%        str2double(get(hObject,'String')) returns contents of cube_min_d as a double


% --- Executes during object creation, after setting all properties.
function cube_min_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cube_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                %                       CUBE MAX DIAMETER
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function cube_max_d_Callback(hObject, eventdata, handles)
% hObject    handle to cube_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of cube_max_d as text
%        str2double(get(hObject,'String')) returns contents of cube_max_d as a double


% --- Executes during object creation, after setting all properties.
function cube_max_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cube_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                       TRIANGLE MAX DIAMETER
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function triangle_max_d_Callback(hObject, eventdata, handles)
% hObject    handle to triangle_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of triangle_max_d as text
%        str2double(get(hObject,'String')) returns contents of triangle_max_d as a double


% --- Executes during object creation, after setting all properties.
function triangle_max_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to triangle_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                       TRIANGLE MIN DIAMETER
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function triangle_min_d_Callback(hObject, eventdata, handles)
% hObject    handle to triangle_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of triangle_min_d as text
%        str2double(get(hObject,'String')) returns contents of triangle_min_d as a double


% --- Executes during object creation, after setting all properties.
function triangle_min_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to triangle_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                       TRIANGLE HEIGHT
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function triangle_height_Callback(hObject, eventdata, handles)
% hObject    handle to triangle_height (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of triangle_height as text
%        str2double(get(hObject,'String')) returns contents of triangle_height as a double


% --- Executes during object creation, after setting all properties.
function triangle_height_CreateFcn(hObject, eventdata, handles)
% hObject    handle to triangle_height (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                      CYLINDER DIAMETER RATIO
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function cylinder_diameter_ratio_Callback(hObject, eventdata, handles)
% hObject    handle to cylinder_diameter_ratio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of cylinder_diameter_ratio as text
%        str2double(get(hObject,'String')) returns contents of cylinder_diameter_ratio as a double


% --- Executes during object creation, after setting all properties.
function cylinder_diameter_ratio_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cylinder_diameter_ratio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %                      CYLINDER MIN D CALLBACK
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function cylinder_min_d_Callback(hObject, eventdata, handles)
% hObject    handle to tetra_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tetra_min_d as text
%        str2double(get(hObject,'String')) returns contents of tetra_min_d as a double


% --- Executes during object creation, after setting all properties.
function cylinder_min_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to tetra_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                %                      CYLINDER MAX DIAMETER
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function cylinder_max_d_Callback(hObject, eventdata, handles)
% hObject    handle to tetra_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tetra_max_d as text
%        str2double(get(hObject,'String')) returns contents of tetra_max_d as a double


% --- Executes during object creation, after setting all properties.
function cylinder_max_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to tetra_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


    %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                 ELEMENT NAME INPUTS (LABELS)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 1
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_1_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_1 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_1 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 2
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_2_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_2 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_2 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 3
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_3_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_3 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_3 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 4
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_4_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_4 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_4 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 5
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_5_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_5 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_5 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 6
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_6_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_6 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_6 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 7
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_7_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_7 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_7 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %               ELEMENT NAME 8
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Element_name_8_Callback(hObject, eventdata, handles)
% hObject    handle to Element_name_8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Element_name_8 as text
%        str2double(get(hObject,'String')) returns contents of Element_name_8 as a double
% --- Executes during object creation, after setting all properties.
function Element_name_8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Element_name_8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
%                 ATOMIC WEIGHT INPUTS
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************

                %**************************************************************************
                %                 AW ELEMENT 1
                %**************************************************************************
function AW_element_1_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_1 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_1 as a double
% --- Executes during object creation, after setting all properties.
 
function AW_element_1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 2
                %**************************************************************************
function AW_element_2_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_2 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_2 as a double
% --- Executes during object creation, after setting all properties.

function AW_element_2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 3
                %**************************************************************************
function AW_element_3_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_3 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_3 as a double
% --- Executes during object creation, after setting all properties.

function AW_element_3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 4
                %**************************************************************************
function AW_element_4_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_4 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_4 as a double
% --- Executes during object creation, after setting all properties.

function AW_element_4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns calle

% Hint: edit controls usually have a white background on Windows.
%  See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %**************************************************************************
                    %                 AW ELEMENT 5
                    %**************************************************************************
function AW_element_5_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_5 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_5 as a double
% --- Executes during object creation, after setting all properties.

function AW_element_5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 6
                %**************************************************************************
function AW_element_6_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_6 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_6 as a double
% --- Executes during object creation, after setting all properties.
function AW_element_6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 7
                %**************************************************************************
function AW_element_7_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_7 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_7 as a double
% --- Executes during object creation, after setting all properties.
function AW_element_7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %**************************************************************************
                %                 AW ELEMENT 8
                %**************************************************************************
function AW_element_8_Callback(hObject, eventdata, handles)
% hObject    handle to AW_element_8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AW_element_8 as text
%        str2double(get(hObject,'String')) returns contents of AW_element_8 as a double
% --- Executes during object creation, after setting all properties.
function AW_element_8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to AW_element_8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************






%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%                        NUMBER OF ATOMS IN UNIT CELL
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                    %              NUMBER OF ELEMENT 1 IN UNIT CELL
                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_1_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_1 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_1 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                    %              NUMBER OF ELEMENT 2 IN UNIT CELL
                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

function Number_in_unit_cell_element_2_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_2 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_2 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                %              NUMBER OF ELEMENT 2 IN UNIT CELL
                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_3_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_3 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_3 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                    %              NUMBER OF ELEMENT 4 IN UNIT CELL
                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_4_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_4 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_4 as a double


% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                    %              NUMBER OF ELEMENT 5 IN UNIT CELL
                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_5_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_5 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_5 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                %              NUMBER OF ELEMENT 6 IN UNIT CELL
                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_6_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_6 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_6 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                    %              NUMBER OF ELEMENT 6 IN UNIT CELL
                    %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_7_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_7 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_7 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
                %              NUMBER OF ELEMENT 8 IN UNIT CELL
                %NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
function Number_in_unit_cell_element_8_Callback(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Number_in_unit_cell_element_18 as text
%        str2double(get(hObject,'String')) returns contents of Number_in_unit_cell_element_18 as a double

% --- Executes during object creation, after setting all properties.
function Number_in_unit_cell_element_8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Number_in_unit_cell_element_18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
%NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN




%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%                               LATTICE PARAMETERS
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL





function lattice_a_Callback(hObject, eventdata, handles)
% hObject    handle to lattice_a (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of lattice_a as text
%        str2double(get(hObject,'String')) returns contents of lattice_a as a double

% --- Executes during object creation, after setting all properties.
function lattice_a_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lattice_a (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function lattice_b_Callback(hObject, eventdata, handles)
% hObject    handle to lattice_b (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of lattice_b as text
%        str2double(get(hObject,'String')) returns contents of lattice_b as a double

% --- Executes during object creation, after setting all properties.
function lattice_b_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lattice_b (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function lattice_c_Callback(hObject, eventdata, handles)
% hObject    handle to lattice_c (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of lattice_c as text
%        str2double(get(hObject,'String')) returns contents of lattice_c as a double

% --- Executes during object creation, after setting all properties.
function lattice_c_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lattice_c (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
%LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL


% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
%                           PLOT GRAPH
% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
% {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{


            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %                       HOLD PLOT BUTTONS
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --- Executes on button press in HoldPlotOption.
function HoldPlotOption_Callback(hObject, eventdata, handles)
% hObject    handle to HoldPlotOption (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of HoldPlotOption
















function edit28_Callback(hObject, eventdata, handles)
% hObject    handle to edit28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit28 as text
%        str2double(get(hObject,'String')) returns contents of edit28 as a double


% --- Executes during object creation, after setting all properties.
function edit28_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit32_Callback(hObject, eventdata, handles)
% hObject    handle to edit32 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit32 as text
%        str2double(get(hObject,'String')) returns contents of edit32 as a double


% --- Executes during object creation, after setting all properties.
function edit32_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit32 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end








% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu2


% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit33_Callback(hObject, eventdata, handles)
% hObject    handle to edit33 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit33 as text
%        str2double(get(hObject,'String')) returns contents of edit33 as a double


% --- Executes during object creation, after setting all properties.
function edit33_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit33 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit34_Callback(hObject, eventdata, handles)
% hObject    handle to edit34 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit34 as text
%        str2double(get(hObject,'String')) returns contents of edit34 as a double


% --- Executes during object creation, after setting all properties.
function edit34_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit34 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end








%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
%               JUNK BELOW - DONT DELETE BECAUSE IT CAUSES AN ERROR
%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
%££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££


function edit46_Callback(hObject, eventdata, handles)
% hObject    handle to edit46 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit46 as text
%        str2double(get(hObject,'String')) returns contents of edit46 as a double

% --- Executes during object creation, after setting all properties.
function edit46_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit46 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit45_Callback(hObject, eventdata, handles)
% hObject    handle to edit45 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit45 as text
%        str2double(get(hObject,'String')) returns contents of edit45 as a double
% --- Executes during object creation, after setting all properties.
function edit45_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit45 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function tetra_min_d_Callback(hObject, eventdata, handles)
% hObject    handle to tetra_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of tetra_min_d as text
%        str2double(get(hObject,'String')) returns contents of tetra_min_d as a double
% --- Executes during object creation, after setting all properties.
function tetra_min_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to tetra_min_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function tetra_max_d_Callback(hObject, eventdata, handles)
% hObject    handle to tetra_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of tetra_max_d as text
%        str2double(get(hObject,'String')) returns contents of tetra_max_d as a double

% --- Executes during object creation, after setting all properties.
function tetra_max_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to tetra_max_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit56_Callback(hObject, eventdata, handles)
% hObject    handle to edit56 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit56 as text
%        str2double(get(hObject,'String')) returns contents of edit56 as a double
% --- Executes during object creation, after setting all properties.
function edit56_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit56 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit57_Callback(hObject, eventdata, handles)
% hObject    handle to edit57 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit57 as text
%        str2double(get(hObject,'String')) returns contents of edit57 as a double
% --- Executes during object creation, after setting all properties.
function edit57_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit57 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit58_Callback(hObject, eventdata, handles)
% hObject    handle to edit58 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit58 as text
%        str2double(get(hObject,'String')) returns contents of edit58 as a double

% --- Executes during object creation, after setting all properties.
function edit58_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit58 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double

% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1

% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','y');
end


% --- Executes during object creation, after setting all properties.
function Note1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Note1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
