The Orbitals listbox w is filled with the orbital names/strings of the current atom curr_atom. This function is based on XAOrbitalArray where it gets the orbital names from. If this was successful XAFillOrbitalListbox creates strings of type XmString which are used for listboxes. As proposed, pseudo orbitals which were created with XA are marked with an "*" in the Orbitals listboxes.
XAFillOrbitalListbox recognizes pseudo orbitals by looking for them in the variable GOriginalAtom which is of type orbital_array and which was set directly after the atom data file was opened. If the orbital name is not found in GOriginalAtom an "*" will be added to the orbital name to mark it as a pseudo orbital.
int XAAllocateGOrbitalListItems(atom_ptr curr_atom)
The procedure XAAllocateGOrbitalListItems must be executed whenever the size of the atom data structure has changed, i.e. by creating or deleting an orbital.
After calling XAAllocateGOrbitalListItems the old GOrbitalListItems array is freed and XAOrbitalArray is called for the new curr_atom. With the return structure the size of the new atom, ntimes, is counted, a memory block of size ntimes is allocated and ntimes is returned, normally to set int XAFillShowDataDialog(atom_ptr curr_atom)
XAFillShowDataDialog fills the widgets of the Display Data window with the values which are equal for all orbitals. Therefore this does not include R values and n-, alpha- and constants listboxes. These are displayed when XAFillShowDataListbox is called.
The global variable last_selected_orbital is set to the "empty string".
int XAFillShowDataListbox(atom_ptr curr_atom, char *orbital_string)
If an orbital name is selected in the Orbitals listbox of the Display Data window, the previously empty widgets will be filled with the appropriate values by executing XAFillShowDataListbox.
The listboxes for the n-, alpha- and constant values are updated by creating an XmString array for each listbox which contains the transformed float and integer values. Additionally, the number of elements, i, must also be used as an argument for the update of the listboxes. This technique was taken from Motif, Frequently Asked Question (comp.windows.x.motif) and offers faster changes than the conventional convenience procedures.
int XANextMaxOrbital(atom_ptr curr_atom, char* orbital_string)
Normally, orbital_string consists of the orbital name, i.e. the shell number and the orbital type. Here only the orbital type is needed, so it does not matter what value the shell number has. Nevertheless, it is definitely better to call this function with an already existing orbital name.
First the return structure of XAOrbitalArray is examined to look for the largest shell number for the given orbital type. If this is found (otherwise the orbital type does not exist and an error code will be returned) it will be increased by 1 to return the next maximum shell number, i.e. orbital.
float XAMinAlpha(atom_ptr curr_atom, char symbol)
XAMinAlpha returns the minimum alpha value which is stored for the orbital type symbol. First XAOrbitalArray is called to get an overview of the orbitals stored in the internal data structure. Then, the parameter symbol is searched in the symbol array of the XAOrbitalArray structure. If it is found, a pointer to the first data block of the first orbital with type symbol will be set and every following data block will be examined for the smallest alpha value.
int XACalculateSum(atom_ptr curr_atom)
int XACalculateInt(atom_ptr curr_atom)
... are straight-forward and do not need further explanation.
int XACalculateCreate(atom_ptr curr_atom)
XACalculateCreate is responsible for the creation process of a pseudo orbital. This process can be divided into two steps which use the same function: the update of an existing pseudo orbital or the creation of a new one. These alternatives are separated by the global variable Gcrutch.
typedef struct Create_orbital_array {
int dimension;
int shell;
char symbol;
int *n;
float alpha;
float *c;
} create_orbital_array, *create_orbital_array_ptr;
where dimension stores the number of elements of the n- and constant arrays.
int XAFindMaxN(atom_ptr curr_atom)
XAFindMaxN examines every orbital of curr_atom to get the maximum shell number. The maximum is needed to calculate the number of points which are used to draw the according orbital function graph.
int XADrawGraph(atom_ptr curr_atom)
Generally, XADrawGraph draws the function graphs of the selected orbital names of the Orbitals listbox.
log (TINY)
ra = - ----------
alpha
min
log(ra)
r = ra + n * ----------
alpha
min
if they have not been entered by the user before calling Draw Graph.
atom_ptr XADoDeleteOrbital(atom_ptr curr_atom, char *orbital_string)
XADoDeleteOrbital deletes the pseudo orbital orbital_string from the curr_atom data structure. Only the last pseudo orbital for each orbital type can be deleted (if this limitation is too strict, then just change the code of this procedure. Please note to "reset" all the pointers to prevent inconsistencies. Unfortunately no access functions are available to set values of the atom data structure.).
First, XADoDeleteOrbital is looking for the orbital orbital_string in the data structure. If this was found and it is a pseudo orbital which was created during the running XA session, then the number of data blocks is counted to free all the allocated memory for data-, shell- and orbital structures properly.
The next_shell pointer of curr_shell is set to NULL by using the XASetNextShell.
int XADeleteOrbital(atom_ptr curr_atom)
XADeleteOrbital controls the functions which are involved in the delete process of an orbital. If the global variable Gcrutch is set to DELORB then XADeleteOrbital was not called during the update process of an existing pseudo orbital. Therefore, as the atom data structure is changing its size and GDrawList is indexing the wrong orbital names new, the drawing area is cleared to prevent any inconsistencies when new graphs are drawn.
In between both Orbitals listboxes are reset to their new values. If everything worked fine, the value OK is returned to the calling procedure.
int XASetCreateOption(atom_ptr curr_atom)
This procedure is called directly after a new atom was read in by XAScan. XASetCreateOption looks for the different orbital types in the atom curr_atom and sets the options of the push button Create Orbital accordingly.
The global variable GCreateSymbol, which stores the orbital type of the next pseudo orbital which has to be created, is set to its default value, i.e. the type of the first orbital, which is the last in the internal data structure (please remember the LIFO order of orbitals).
int XAUpdateOrbitalGraph(atom_ptr curr_atom, char *orbital_string)
This procedure was necessary to redraw an updated orbital immediately if it was drawn before. In most cases the code was taken from XADrawGraph.