[med-svn] [Git][med-team/adun-app][master] 10 commits: Simplify rules by using dh_gnustep's --app option.

Yavor Doganov (@yavor-guest) gitlab at salsa.debian.org
Wed Aug 7 22:16:17 BST 2024



Yavor Doganov pushed to branch master at Debian Med / adun.app


Commits:
d4567e8e by Yavor Doganov at 2024-07-25T12:19:08+03:00
Simplify rules by using dh_gnustep's --app option.

- - - - -
81fbb2c0 by Yavor Doganov at 2024-08-07T17:06:21+03:00
enable-scripting-extension.patch: Replace a deprecated method.

- - - - -
6c64ee53 by Yavor Doganov at 2024-08-07T17:08:00+03:00
gcc-warnings.patch: Fix more warnings.

- - - - -
d155f4ee by Yavor Doganov at 2024-08-07T23:37:36+03:00
scan-build-errors.patch: New; fix some issues found by Clang's static analyzer.

- - - - -
8d3b574c by Yavor Doganov at 2024-08-07T23:47:54+03:00
set-delegate-before-source.patch: New; fix crash in ULTemplateViewController.

- - - - -
78713666 by Yavor Doganov at 2024-08-07T23:50:24+03:00
copyright: Update copyright years.

- - - - -
4a593d26 by Yavor Doganov at 2024-08-07T23:52:39+03:00
15_link-properly.patch: Fix patch metadata.

- - - - -
18bdd331 by Yavor Doganov at 2024-08-07T23:54:08+03:00
(Depends): Remove steptalk; this was a workaround no longer needed.

- - - - -
d07fe9e8 by Yavor Doganov at 2024-08-07T23:55:42+03:00
(adun-core) <Suggests>: Add adun.app.

- - - - -
f1bb6a75 by Yavor Doganov at 2024-08-08T00:14:20+03:00
(Standards-Version): Bump to 4.7.0; no changes needed.

- - - - -


11 changed files:

- debian/changelog
- debian/control
- debian/copyright
- debian/install
- debian/patches/15_link-properly.patch
- debian/patches/enable-scripting-extension.patch
- debian/patches/gcc-warnings.patch
- + debian/patches/scan-build-errors.patch
- debian/patches/series
- + debian/patches/set-delegate-before-source.patch
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,34 @@
+adun.app (0.81-15) UNRELEASED; urgency=medium
+
+  * debian/rules (override_dh_auto_install): Remove commands which are now
+    handled by dh_gnustep.  Move unrelated commands to other targets.
+    (override_dh_link): Rename as...
+    (execute_before_dh_link): ...and use dh_gnustep --app for adun.app.
+    Convert the app icon here, after /usr/share/GNUstep is created.
+    (execute_after_dh_fixperms): New target; move chmod invocations from
+    override_dh_auto_install here.
+  * debian/control (Build-Depends): Add gnustep-make (>= 2.9.2-2) for
+    dh_gnustep's --app option.
+    (Depends): Remove steptalk; this was a workaround no longer needed.
+    (adun-core) <Suggests>: Add adun.app.
+    (Standards-Version): Bump to 4.7.0; no changes needed.
+  * debian/install: Remove /usr/share/GNUstep; now dh_gnustep's job.
+  * debian/patches/enable-scripting-extension.patch: Replace a deprecated
+    method which is private and triggers a warning.
+  * debian/patches/gcc-warnings.patch: Fix more warnings.
+  * debian/patches/scan-build-errors.patch: New; fix some issues
+    discovered by Clang and its static analyzer.  This makes the app a
+    little more usable as it was going into infinite loops due to
+    comparisons of NSNotFound with an int type (a problem not detected by
+    GCC 14, unfortunately).
+  * debian/patches/set-delegate-before-source.patch: New; fix crash in
+    ULTemplateViewController when switching the NSPopUpButton by setting
+    the delegate before the data source.
+  * debian/patches/15_link-properly.patch: Fix patch metadata.
+  * debian/copyright: Update copyright years.
+
+ -- Yavor Doganov <yavor at gnu.org>  Thu, 25 Jul 2024 11:14:27 +0300
+
 adun.app (0.81-14) unstable; urgency=medium
 
   [ Yavor Doganov ]


=====================================
debian/control
=====================================
@@ -5,13 +5,14 @@ Uploaders: Andreas Tille <tille at debian.org>,
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
+               gnustep-make (>= 2.9.2-2),
                imagemagick,
                libgnustep-gui-dev,
                libsteptalk-dev,
                libsqlclient-dev,
                libgsl-dev
 Rules-Requires-Root: no
-Standards-Version: 4.5.0
+Standards-Version: 4.7.0
 Vcs-Browser: https://salsa.debian.org/med-team/adun-app
 Vcs-Git: https://salsa.debian.org/med-team/adun-app.git
 Homepage: http://wiki.gnustep.org/index.php/Adun
@@ -20,7 +21,6 @@ Package: adun.app
 Architecture: any
 Depends: adun-core (= ${binary:Version}),
          ${shlibs:Depends},
-         steptalk,
          ${misc:Depends}
 Recommends: gnuplot
 Description: Molecular Simulator for GNUstep (GUI)
@@ -35,6 +35,7 @@ Package: adun-core
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends}
+Suggests: adun.app
 Description: Molecular Simulator
  Adun is a biomolecular simulator that also includes data management and
  analysis capabilities.  It was developed at the Computational Biophysics


=====================================
debian/copyright
=====================================
@@ -77,7 +77,7 @@ License: MIT
 
 Files: debian/*
 Copyright: 2006-2014 Gürkan Myczko <gurkan at phys.ethz.ch>
-           2008-2019 Yavor Doganov <yavor at gnu.org>
+           2008-2024 Yavor Doganov <yavor at gnu.org>
            2008-2019 Andreas Tille <tille at debian.org>
            2016 Gert Wollny <gw.fossdev at gmail.com>
 License: GPL-3+


=====================================
debian/install
=====================================
@@ -1,5 +1,4 @@
 debian/*.desktop	usr/share/applications
-/usr/share/GNUstep/UL.app/*
 /usr/bin/UL
 /usr/lib/GNUstep/Applications/*
 /usr/lib/GNUstep/Bundles/*


=====================================
debian/patches/15_link-properly.patch
=====================================
@@ -1,6 +1,8 @@
-Name: 15_build.patch
+Description: Link with all needed libraries.
 Author: Yavor Doganov <yavor at gnu.org>
-Forwarded: not yet
+Forwarded: no
+Last-Update: 2009-10-08
+---
 
 --- Adun-0.81.orig/Kernel/AdunKernel/GNUmakefile
 +++ Adun-0.81/Kernel/AdunKernel/GNUmakefile


=====================================
debian/patches/enable-scripting-extension.patch
=====================================
@@ -3,7 +3,7 @@ Description: Enable the scripting extension.
  trivial compiler warnings.
 Author: Yavor Doganov <yavor at gnu.org>
 Forwarded: no
-Last-Update: 2018-01-07
+Last-Update: 2024-08-07
 ---
 
 --- adun.app.orig/UL/GNUmakefile
@@ -18,16 +18,18 @@ Last-Update: 2018-01-07
  # Resource files
 --- adun.app.orig/UL/ViewController.m
 +++ adun.app/UL/ViewController.m
-@@ -108,7 +108,7 @@
+@@ -108,58 +108,53 @@
  	[[NSUserDefaults standardUserDefaults] synchronize];
  }
  
 -- (BOOL) _isAvailableApplicationScriptingBundle
 +- (BOOL) _loadApplicationScriptingBundle
  {
- 	NSBundle *appScriptingBundle;
+-	NSBundle *appScriptingBundle;
++	NSBundle *appScriptingBundle = nil;
  
-@@ -117,49 +117,44 @@
+ #ifndef GNUSTEP	
+ 	appScriptingBundle = [NSBundle bundleWithPath: 
  				[NSHomeDirectory() stringByAppendingPathComponent:
  				@"Library/Bundles/ULApplicationScripting.bundle"]];
  #else
@@ -254,14 +256,18 @@ Last-Update: 2018-01-07
  			forName: @"AnalysisManager"];
  
  		connections = [NSMutableDictionary new];
-@@ -197,7 +197,6 @@
+@@ -197,10 +197,9 @@
  	NSString* localizedDescription;
  	STConversation *conversation;
  	STFileScript *scriptFile;
 -	id result;
  
  	scriptFile = [manager scriptWithName: aString];
- 	conversation = [STConversation conversationWithEnvironment: environment 
+-	conversation = [STConversation conversationWithEnvironment: environment 
++	conversation = [STConversation conversationWithContext: environment
+ 			language: [scriptFile language]];
+ 	NS_DURING
+ 	{
 @@ -210,7 +209,6 @@
  			forName: @"Args"];
  		[conversation interpretScript: 


=====================================
debian/patches/gcc-warnings.patch
=====================================
@@ -25,10 +25,15 @@ Description: Adapt to the new GNUstep API and fix few gcc warnings.
  ‘receiver’ may not respond to ‘-message’
  multiple methods named ‘-foo’ found
  operation on ‘foo’ may be undefined [-Wsequence-point]
+ using integer absolute value function ‘abs’ when argument is of
+   floating-point type ‘double’ [-Wabsolute-value]
+ ‘mallinfo’ is deprecated [-Wdeprecated-declarations]
+ cast between incompatible function types [-Wcast-function-type]
+ specified bound N equals destination size [-Wstringop-truncation]
 Author: Yavor Doganov <yavor at gnu.org>
 Bug-Debian: http://bugs.debian.org/749733
 Forwarded: no
-Last-Update: 2019-01-24
+Last-Update: 2024-08-07
 ---
 
 --- adun.app.orig/Kernel/AdunKernel/CoreAdditions/AdunTrajectory.m
@@ -139,6 +144,15 @@ Last-Update: 2019-01-24
  	NSIndexSet* indexSet;
  	NSRange indexRange;
  	ListElement *list_p;
+@@ -127,7 +127,7 @@
+ 		return;
+ 
+ 	//Check if system and allowed pairs are compatible
+-	if((int)[interactions count] >= coordinates->no_rows)
++	if([interactions count] >= coordinates->no_rows)
+ 		[NSException raise: NSInternalInconsistencyException
+ 			format: @"Allowed pairs array implies more elements then are present in system."];
+ 
 @@ -137,7 +137,7 @@
  	out_p = (ListElement*)malloc(sizeof(ListElement));
  	endin_p = AdLinkedListCreate(in_p);
@@ -186,6 +200,55 @@ Last-Update: 2019-01-24
  		{
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdFrameworkFunctions.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdFrameworkFunctions.m
+@@ -89,7 +89,7 @@
+ 
+ inline void AdRemoveTranslationalDOF(AdMatrix* velocities, double* masses)
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double total_mass;
+ 	double centre[3];
+ 	
+@@ -190,7 +190,7 @@
+ 
+ void AdWriteMatrixToFile(AdMatrix* matrix, NSString* fileName, NSString* fileFlag)
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	FILE* stream;
+ 
+ 	if(matrix == NULL)
+@@ -243,10 +243,10 @@
+ void AdLogMemoryUsage(void)
+ {
+ #ifndef __FREEBSD__
+-	struct mallinfo mem_struct;
++	struct mallinfo2 mem_struct;
+ 	float factor = 1048576.0;
+ 
+-	mem_struct = mallinfo();
++	mem_struct = mallinfo2();
+ 	NSLog(@"Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf MB", 
+ 		(float)mem_struct.arena/factor,
+ 		(float)mem_struct.hblkhd/factor, 
+@@ -298,7 +298,7 @@
+ 
+ gsl_matrix* AdGSLMatrixFromAdMatrix(AdMatrix* matrix)
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	gsl_matrix* newMatrix;
+ 	
+ 	newMatrix = gsl_matrix_alloc(matrix->no_rows, matrix->no_columns);
+@@ -337,7 +337,7 @@
+ 
+ void AdLogMatrixRow(int rowNumber, AdMatrix* matrix)
+ {
+-	int i;
++	NSUInteger i;
+ 	NSMutableString* aString = [NSMutableString new];
+ 
+ 	[aString appendFormat: @"%d: ", rowNumber];
 @@ -350,7 +350,7 @@
  
  void AdLogMatrixRows(NSIndexSet* indexSet, AdMatrix* matrix)
@@ -226,6 +289,15 @@ Last-Update: 2019-01-24
  		[indexSet getIndexes: buffer 
  			    maxCount: [indexSet count]
  			inIndexRange: NULL];
+@@ -563,7 +564,7 @@
+ 	columnHeaders: (NSArray*) anArray
+ 	name: (NSString*) aString
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	NSMutableArray* array, *row;
+ 
+ 	array = [NSMutableArray new];
 @@ -750,7 +751,7 @@
  
  - (id) valueForKey: (NSString*) key
@@ -262,6 +334,22 @@ Last-Update: 2019-01-24
  
  	if((columnIndex = [columnHeaders indexOfObject: columnHeader]) == NSNotFound)
  		[NSException raise: NSInvalidArgumentException
+@@ -961,13 +962,13 @@
+ {
+ 	int i,j;
+ 	
+-	if(aMatrix->no_rows != (int)numberOfRows)
++	if(aMatrix->no_rows != numberOfRows)
+ 		[NSException raise: NSInvalidArgumentException
+ 			format: @"Provided buffer has incorrect number of rows - required %d, provided %d",
+ 			aMatrix->no_rows,
+ 			numberOfRows];
+ 	
+-	if(aMatrix->no_columns != (int)numberOfColumns)
++	if(aMatrix->no_columns != numberOfColumns)
+ 		[NSException raise: NSInvalidArgumentException
+ 			format: @"Provided buffer has incorrect number of columns - required %d, provided %d",
+ 			aMatrix->no_columns,
 @@ -1024,7 +1025,7 @@
  
  - (NSString*) dataTypeForColumnWithHeader: (NSString*) columnHeader
@@ -396,17 +484,64 @@ Last-Update: 2019-01-24
  			inIndexRange: NULL];
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunContainerDataSource.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunContainerDataSource.m
-@@ -184,7 +184,8 @@
+@@ -183,8 +183,9 @@
+  */
  - (void) _createNonbondedPairs
  {
- 	int i, j;
+-	int i, j;
 -	int currentNumberOfAtoms, currentAtom, index, offsetIndex;
++	int j;
 +	int currentNumberOfAtoms, currentAtom, offsetIndex;
-+	NSUInteger index;
++	NSUInteger i, index;
  	id dataSourceNonbonded;
  	NSMutableIndexSet* indexes, *sourceIndexes, *currentInteractions;
  	NSRange indexRange;
-@@ -867,10 +868,7 @@
+@@ -348,8 +349,9 @@
+ 
+ - (int*) _chooseGridPoints
+ {
+-	int i;
+-	int *array, *point_array;
++	NSUInteger i;
++	NSUInteger *array;
++	int *point_array;
+ 	AdMatrix* gridMatrix;	
+ 
+ 	NSDebugLLog(@"AdContainerDataSource",
+@@ -359,11 +361,11 @@
+ 	//create an array of size grid_points, containing the numbers between 0 and grid_points
+ 	
+ 	gridMatrix = [solventGrid grid];
+-	array = (int*)[memoryManager allocateArrayOfSize: gridMatrix->no_rows*sizeof(int)];
++	array = (NSUInteger*)[memoryManager allocateArrayOfSize: gridMatrix->no_rows*sizeof(NSUInteger)];
+ 	for(i=0; i < gridMatrix->no_rows; i++)
+ 		array[i] = i;
+ 	
+-	gsl_ran_shuffle(twister, array, gridMatrix->no_rows, sizeof(int));
++	gsl_ran_shuffle(twister, array, gridMatrix->no_rows, sizeof(NSUInteger));
+ 	
+ 	//malloc memory for the array to hold the choosen grid points
+ 	
+@@ -380,7 +382,8 @@
+ - (void) _populateBox
+ {
+ 	int* points;	
+-	int i, j;
++	int j;
++	NSUInteger i;
+ 	AdMatrix* coordinates;
+ 
+ 	//Choose a number of grid points equal to 
+@@ -836,7 +839,7 @@
+ 
+ - (int) setExclusionArea: (id) cavity
+ {
+-	int i;
++	NSUInteger i;
+ 	int numberRemovedMolecules;
+ 	NSMutableIndexSet *obscuredIndexes;
+ 	AdMatrix* coordinates;
+@@ -867,10 +870,7 @@
  {
  	int numberRemovedMolecules;
  	id cavity;
@@ -417,7 +552,23 @@ Last-Update: 2019-01-24
  	//The cavity surface is defined by the vdw radius of each atom.
  	//However the vdw radius of the solvent atoms must also be taken
  	//into account. Hence we place atoms at least 2*vdw radii away.
-@@ -919,7 +917,7 @@
+@@ -896,7 +896,7 @@
+ 
+ - (BOOL) _checkPoint: (double*) point distance: (double) distance usingCoordinates: (AdMatrix*) coordinates
+ {
+-	int j;
++	NSUInteger j;
+ 	Vector3D dist;
+ 
+ 	for (j=0; j<coordinates->no_rows; j++)
+@@ -914,12 +914,13 @@
+ 
+ - (int) removeSystem: (AdSystem*) system
+ {
+-	int numberRemovedMolecules, i, j, systemIndex;
++	int numberRemovedMolecules, j, systemIndex;
++	NSUInteger i;
+ 	int* points; 
  	double *point;
  	AdMatrix* gridMatrix, *coordinates;
  	id cavity;
@@ -426,7 +577,7 @@ Last-Update: 2019-01-24
  
  	NSDebugLLog(@"AdContainerDataSource", 
  		@"Removing system %@", system);
-@@ -938,7 +936,6 @@
+@@ -938,7 +939,6 @@
  	[removedMolecules removeObjectAtIndex: systemIndex];
  	
  	//find the current cavity
@@ -444,6 +595,15 @@ Last-Update: 2019-01-24
  }
  
  - (id) initWithSystem: (id) system
+@@ -82,7 +83,7 @@
+ 	cavity: (id) cavity
+ 	constraintType: (AdCavityConstraintType) constraintType
+ {	
+-	int i;
++	NSUInteger i;
+ 	AdMatrix* coordinates;
+ 	NSMutableIndexSet* indexSet;
+ 	
 @@ -125,7 +126,7 @@
  
  	//Get all elements in the cavity
@@ -958,7 +1118,17 @@ Last-Update: 2019-01-24
  	/* b factor */
  	bfact = mkFloat(buffer+60,6); /* 61 - 66 temperature factor */
  	if (newfileformat)
-@@ -1413,7 +1413,6 @@
+@@ -871,7 +871,8 @@
+ 	unsigned int atm1,atm2;
+         t_str = [line lossyCString];
+ 	//[line getCString: buffer maxLength: 37];
+-        strncpy(buffer,t_str,38);
++        strncpy(buffer,t_str,sizeof buffer - 1);
++        buffer[37] = '\0';
+ 	atm1 = mkInt(buffer+6,5);
+ 	atm2 = mkInt(buffer+11,5);
+ 	[self addBondFrom: atm1 to: atm2];
+@@ -1413,7 +1414,6 @@
  {
  	char buffer[81];
  	int resnr;
@@ -966,7 +1136,7 @@ Last-Update: 2019-01-24
  	NSString *rname; /* standard residue name */
  	NSString *desc; /* description of modification */
  	NSString *resid; /* key of residue */
-@@ -1426,7 +1425,6 @@
+@@ -1426,7 +1426,6 @@
  	/* hetero name */
  	range.location=12; /* 13 - 15 hetero name */
  	range.length=3;
@@ -1109,6 +1279,21 @@ Last-Update: 2019-01-24
  
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunLinkedList.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunLinkedList.m
+@@ -45,11 +45,11 @@
+ 
+ 		freeElements = [NSMutableArray new];
+ 
+-		getElement = (id (*)(id, SEL))[freeElements 
++		getElement = [freeElements
+ 				methodForSelector:@selector(lastObject)];
+-		removeElement = (void (*)(id, SEL))[freeElements
++		removeElement = [freeElements
+ 				methodForSelector:@selector(removeLastObject)];
+-		addElement = (void (*)(id, SEL, id))[freeElements 
++		addElement = [freeElements
+ 				methodForSelector:@selector(addObject:)];
+ 
+ 		linkedList = (ListElement*)malloc(sizeof(ListElement));
 @@ -119,7 +119,6 @@
  
  - (void) _reinsertElement: (ListElement*) list_p
@@ -1163,6 +1348,69 @@ Last-Update: 2019-01-24
  	el_p->free=0;
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunCharmmForceField.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunCharmmForceField.m
+@@ -147,7 +147,7 @@
+ 
+ - (void) evaluateEnergies
+ {
+-	register int j;
++	register NSUInteger j;
+ 	double potential;
+ 	double **coordinates;
+ 	NSEnumerator* customTermsEnum;	
+@@ -185,7 +185,7 @@
+ 	if(interaction14)
+ 	{
+ 		list_p = list_14;
+-		for(j=0; j < noList_14; j++)
++		for(j=0; j < (NSUInteger)noList_14; j++)
+ 		{
+ 			list_p = list_p->next;
+ 			AdCoulombAndLennardJonesBEnergy(list_p,
+@@ -227,7 +227,7 @@
+ - (void) evaluateEnergiesUsingInteractionsInvolvingElements: (NSIndexSet*) elementIndexes
+ {
+ 	BOOL evaluateInteraction = NO;
+-	register int j, i;
++	register NSUInteger j, i;
+ 	double **coordinates;
+ 
+ 	bnd_pot = ang_pot = tor_pot = itor_pot = vdw_pot = ub_pot = est_pot = i14vdw_pot = i14est_pot = 0;
+@@ -305,7 +305,7 @@
+ 	if(interaction14)
+ 	{
+ 		list_p = list_14;
+-		for(j=0; j < noList_14; j++)
++		for(j=0; j < (NSUInteger)noList_14; j++)
+ 		{	
+ 			list_p = list_p->next;
+ 			if( ( [elementIndexes containsIndex: list_p->bond[0]] ) || 
+@@ -358,7 +358,7 @@
+ 
+ - (void) evaluateForces
+ {
+-	register int j, i;
++	register NSUInteger j, i;
+ 	double potential;
+ 	AdMatrix* customForce;
+ 	double **coordinates, **forces;
+@@ -405,7 +405,7 @@
+ 	if(interaction14)
+ 	{
+ 		list_p = list_14;
+-		for(j=0; j < noList_14; j++)
++		for(j=0; j < (NSUInteger)noList_14; j++)
+ 		{
+ 			list_p = list_p->next;
+ 			AdCoulombAndLennardJonesBForce(list_p,
+@@ -555,7 +555,7 @@
+ 
+ - (void) _initialisationForSystem
+ {
+-	int i;
++	NSUInteger i;
+ 	NSArray* interactionTypes;
+ 	AdDataMatrix *groups, *parameters;
+ 	
 @@ -661,7 +661,7 @@
  		list_p->params[0] = eps;
  		list_p->params[1] = rmin;
@@ -1174,7 +1422,249 @@ Last-Update: 2019-01-24
  	return;
 --- adun.app.orig/Kernel/Base/AdMatrix.c
 +++ adun.app/Kernel/Base/AdMatrix.c
-@@ -635,7 +635,7 @@
+@@ -23,6 +23,7 @@
+ #include <stdbool.h>
+ #include "Base/AdMatrix.h"
+ #include <string.h>
++#include <math.h>
+ 
+ bool AdCheckDoubleMatrixDimensions(DoubleMatrix *matrixOne, DoubleMatrix *matrixTwo)
+ {
+@@ -40,7 +41,7 @@
+ bool AdCompareDoubleMatrices(DoubleMatrix *matrixOne, DoubleMatrix *matrixTwo, double tolerance)
+ {
+ 	bool retval = true;
+-	int i,j;
++	uintptr_t i, j;
+ 	double difference;
+ 
+ 	if(!AdCheckDoubleMatrixDimensions(matrixOne, matrixTwo))
+@@ -51,7 +52,7 @@
+ 		for(j=0; j<matrixOne->no_columns;j++)
+ 		{
+ 			difference = matrixOne->matrix[i][j] - matrixTwo->matrix[i][j];
+-			if(abs(difference) > tolerance)
++			if(fabs(difference) > tolerance)
+ 			{
+ 				retval = false;
+ 				break;
+@@ -71,7 +72,7 @@
+ **/
+ void AdSetDoubleMatrixWithValue(DoubleMatrix *matrix_s, double value)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 
+ 	for(i=0; i<matrix_s->no_rows; i++)
+ 		for(j=0; j<matrix_s->no_columns; j++)
+@@ -85,7 +86,7 @@
+ 
+ void AdSetFloatMatrixWithValue(FloatMatrix *matrix_s,  float value)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 
+ 	for(i=0; i<matrix_s->no_rows; i++)
+ 		for(j=0; j<matrix_s->no_rows; j++)
+@@ -98,7 +99,7 @@
+ 
+ void AdSetIntMatrixWithValue(IntMatrix *matrix_s, int value)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 
+ 	for(i=0; i<matrix_s->no_rows; i++)
+ 		for(j=0; j<matrix_s->no_columns; j++)
+@@ -113,9 +114,9 @@
+ \return An IntMatrix structure for the matrix subset
+ **/
+ 
+-IntMatrix* AdIntMatrixFromRowSection(IntMatrix *matrix_s, int start_row, int end_row)
++IntMatrix* AdIntMatrixFromRowSection(IntMatrix *matrix_s, uintptr_t start_row, uintptr_t end_row)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	IntMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateIntMatrix(((end_row - start_row) +1), matrix_s->no_columns);
+@@ -134,9 +135,9 @@
+ \return A FloatMatrix structure for the matrix subset
+ **/
+ 			
+-FloatMatrix* AdFloatMatrixFromRowSection(FloatMatrix *matrix_s, int start_row, int end_row)
++FloatMatrix* AdFloatMatrixFromRowSection(FloatMatrix *matrix_s, uintptr_t start_row, uintptr_t end_row)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	FloatMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateFloatMatrix(((end_row - start_row) +1), matrix_s->no_columns);
+@@ -154,9 +155,9 @@
+ \param end_row the end_row
+ \return A DoubleMatrix structure for the matrix subset
+ **/
+-DoubleMatrix* AdDoubleMatrixFromRowSection(DoubleMatrix *matrix_s, int start_row, int end_row)
++DoubleMatrix* AdDoubleMatrixFromRowSection(DoubleMatrix *matrix_s, uintptr_t start_row, uintptr_t end_row)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	DoubleMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateDoubleMatrix(((end_row - start_row) +1), matrix_s->no_columns);
+@@ -176,9 +177,9 @@
+ \return An IntMatrix structure for the matrix subset
+ **/
+ 
+-IntMatrix* AdIntMatrixFromRowSelection(IntMatrix *matrix_s, int* rows, int no_rows)
++IntMatrix* AdIntMatrixFromRowSelection(IntMatrix *matrix_s, uintptr_t* rows, uintptr_t no_rows)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 	IntMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateIntMatrix(no_rows, matrix_s->no_columns);
+@@ -196,9 +197,9 @@
+ \return An FloatMatrix structure for the matrix subset
+ **/
+ 
+-FloatMatrix* AdFloatMatrixFromRowSelection(FloatMatrix *matrix_s, int* rows, int no_rows)
++FloatMatrix* AdFloatMatrixFromRowSelection(FloatMatrix *matrix_s, uintptr_t* rows, uintptr_t no_rows)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 	FloatMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateFloatMatrix(no_rows, matrix_s->no_columns);
+@@ -216,9 +217,9 @@
+ \return An DoubleMatrix structure for the matrix subset
+ **/
+ 
+-DoubleMatrix* AdDoubleMatrixFromRowSelection(DoubleMatrix *matrix_s, int* rows, int no_rows)
++DoubleMatrix* AdDoubleMatrixFromRowSelection(DoubleMatrix *matrix_s, uintptr_t* rows, uintptr_t no_rows)
+ {	
+-	int i, j;
++	uintptr_t i, j;
+ 	DoubleMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateDoubleMatrix(no_rows, matrix_s->no_columns);
+@@ -236,9 +237,9 @@
+ \return An IntMatrix structure for the matrix subset
+ **/
+ 
+-IntMatrix* AdIntMatrixFromColumnSection(IntMatrix *matrix_s, int start_column, int end_column)
++IntMatrix* AdIntMatrixFromColumnSection(IntMatrix *matrix_s, uintptr_t start_column, uintptr_t end_column)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	IntMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateIntMatrix(matrix_s->no_rows, ((end_column - start_column) +1));
+@@ -257,9 +258,9 @@
+ \return A FloatMatrix structure for the matrix subset
+ **/
+ 
+-FloatMatrix* AdFloatMatrixFromColumnSection(FloatMatrix *matrix_s, int start_column, int end_column)
++FloatMatrix* AdFloatMatrixFromColumnSection(FloatMatrix *matrix_s, uintptr_t start_column, uintptr_t end_column)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	FloatMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateFloatMatrix(matrix_s->no_rows, ((end_column - start_column) +1));
+@@ -278,9 +279,9 @@
+ \return A DoubleMatrix structure for the matrix subset
+ **/
+ 
+-DoubleMatrix* AdDoubleMatrixFromColumnSection(DoubleMatrix *matrix_s, int start_column, int end_column)
++DoubleMatrix* AdDoubleMatrixFromColumnSection(DoubleMatrix *matrix_s, uintptr_t start_column, uintptr_t end_column)
+ {
+-	int i, j, k;
++	uintptr_t i, j, k;
+ 	DoubleMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateDoubleMatrix(matrix_s->no_rows, ((end_column - start_column) +1));
+@@ -299,9 +300,9 @@
+ \return An IntMatrix structure for the matrix subset
+ **/
+ 
+-IntMatrix* AdIntMatrixFromColumnSelection(IntMatrix *matrix_s, int* columns, int no_columns)
++IntMatrix* AdIntMatrixFromColumnSelection(IntMatrix *matrix_s, uintptr_t* columns, uintptr_t no_columns)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 	IntMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateIntMatrix(matrix_s->no_rows, no_columns);
+@@ -319,9 +320,9 @@
+ \return A FloatMatrix structure for the matrix subset
+ **/
+ 
+-FloatMatrix* AdFloatMatrixFromColumnSelection(FloatMatrix *matrix_s, int* columns, int no_columns)
++FloatMatrix* AdFloatMatrixFromColumnSelection(FloatMatrix *matrix_s, uintptr_t* columns, uintptr_t no_columns)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 	FloatMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateFloatMatrix(matrix_s->no_rows, no_columns);
+@@ -339,9 +340,9 @@
+ \return A DoubleMatrix structure for the matrix subset
+ **/
+ 
+-DoubleMatrix* AdDoubleMatrixFromColumnSelection(DoubleMatrix *matrix_s, int* columns, int no_columns)
++DoubleMatrix* AdDoubleMatrixFromColumnSelection(DoubleMatrix *matrix_s, uintptr_t* columns, uintptr_t no_columns)
+ {
+-	int i, j;
++	uintptr_t i, j;
+ 	DoubleMatrix *ret_matrix;
+ 
+ 	ret_matrix = AdAllocateDoubleMatrix(matrix_s->no_rows, no_columns);
+@@ -393,9 +394,9 @@
+ \return A DoubleMatrix struct (uninitialised)
+ **/
+ 
+-DoubleMatrix* AdAllocateDoubleMatrix(int no_rows, int no_columns)
++DoubleMatrix* AdAllocateDoubleMatrix(uintptr_t no_rows, uintptr_t no_columns)
+ {
+-	int i,j;
++	uintptr_t i,j;
+ 	double* array;
+ 	DoubleMatrix *ret_matrix;
+ 
+@@ -427,9 +428,9 @@
+ \return A FloatMatrix struct (uninitialised)
+ **/
+ 
+-FloatMatrix* AdAllocateFloatMatrix(int no_rows, int no_columns)
++FloatMatrix* AdAllocateFloatMatrix(uintptr_t no_rows, uintptr_t no_columns)
+ {
+-	int i,j;
++	uintptr_t i,j;
+ 	float* array;
+ 	FloatMatrix *ret_matrix;
+ 
+@@ -455,9 +456,9 @@
+ \return An IntMatrix struct (uninitialised)
+ **/
+ 
+-IntMatrix* AdAllocateIntMatrix(int no_rows, int no_columns)
++IntMatrix* AdAllocateIntMatrix(uintptr_t no_rows, uintptr_t no_columns)
+ {
+-	int i,j;
++	uintptr_t i, j;
+ 	int* array;
+ 	IntMatrix *ret_matrix;
+ 
+@@ -481,7 +482,7 @@
+ 
+ void AdCopyAdMatrixToAdMatrix(AdMatrix* matrixOne, AdMatrix* matrixTwo)
+ {
+-	int i,j;
++	uintptr_t i, j;
+ 
+ 	if(matrixOne->no_rows != matrixTwo->no_rows)
+ 	{
+@@ -635,7 +636,7 @@
  	
  	rowStart = matrix->rowArray[rowIndex];
  	
@@ -1263,7 +1753,7 @@ Last-Update: 2019-01-24
  {
  	AdAtomicVolumeExclusionFunctionGradient(relativePosition, radius, gradientVector);
  }
-@@ -230,9 +230,8 @@
+@@ -230,9 +230,9 @@
   double AdVolumeExclusionFunction(Vector3D* r, AdMatrix* coordinates, int* neighbourIndexes, int numberNeighbours, double* radii)
  {
  	bool partial, overlap;
@@ -1271,11 +1761,12 @@ Last-Update: 2019-01-24
 -	double retVal, value, smoothingBoundary, checkVal;
 -	double** matrix;
 +	int i, index;
++	uintptr_t j;
 +	double retVal, value;
  	Vector3D vector;	
  	
  	//If numberNeighbours is 0 then the volume exclusion function is 1.
-@@ -240,9 +239,6 @@
+@@ -240,9 +240,6 @@
  	if(numberNeighbours == 0)
  		return 1.0;
  	
@@ -1285,7 +1776,22 @@ Last-Update: 2019-01-24
  	//If a neighbour array is passed used it.
  	if(neighbourIndexes != NULL)
  	{
-@@ -306,8 +302,8 @@
+@@ -272,11 +269,11 @@
+ 	}
+ 	else
+ 	{
+-		for(retVal = 1, i=0; i<coordinates->no_rows; i++)
++		for(retVal = 1, j=0; j<coordinates->no_rows; j++)
+ 		{
+-			value = AdAtomicVolumeExclusionFunctionNew(coordinates->matrix[i], 
++			value = AdAtomicVolumeExclusionFunctionNew(coordinates->matrix[j],
+ 								   r->vector, 
+-								   radii[i],
++								   radii[j],
+ 								   &vector, &partial, &overlap);
+ 		
+ 			//Since the value of the exclusion function is a product of the atomic exclusion functions
+@@ -306,8 +303,8 @@
  		int* neighbourIndexes, int numberNeighbours, double* radii, IntArrayStruct* contributingAtoms)
  {
  	bool partial, overlap;
@@ -1296,7 +1802,14 @@ Last-Update: 2019-01-24
  	double** matrix;
  	Vector3D separation;	
  	//Variables for manually d AdAtomicVolumeExclusionFunctionNew()
-@@ -427,7 +423,7 @@
+@@ -421,13 +418,13 @@
+ 		IntArrayStruct* contributingAtoms, double exclusionValue, double* radii, Vector3D* gradientVector)
+ {
+ 	int i, index, numberAtoms;
+-	int* array;
++	uintptr_t* array;
+ 	double atomicExclusionValue, holder;
+ 	double **matrix;
  	Vector3D vector, separation;
  	//Variables for manually d AdAtomicVolumeExclusionFunctionNew()
  	double lower, upper, difference;
@@ -1305,7 +1818,7 @@ Last-Update: 2019-01-24
  	double* atomPosition, *pointPosition, *vec;
  
  	numberAtoms = contributingAtoms->length;
-@@ -566,7 +562,7 @@
+@@ -566,7 +563,7 @@
  	/******* Manual Inline ************/
  	
  	double lower, upper, difference;
@@ -1412,16 +1925,102 @@ Last-Update: 2019-01-24
  	NSString* type = nil;
  	NSArray* headers;
  	
-@@ -568,7 +566,7 @@
+@@ -271,8 +269,7 @@
+ 
+ - (void) _calculateBornRadiusAndCFATermsForAtom: (int) atomIndex
+ {
+-	int i;
+-	int radialStart, radialPoint, angularPoint;
++	NSUInteger i, radialStart, radialPoint, angularPoint;
+ 	int gridPointIndex;	//!< The index of the grid point to be used to define the atoms used in the integration.
+ 	double radialWeight, angularWeight;
+ 	double holder,valueOne, valueTwo; //< For holding precalculated values
+@@ -345,7 +342,7 @@
+ 			absPoint.vector[2] = position[2] + integrationPoint.vector[2];
+ 			
+ 			//Find the nearest grid point to this point
+-			gridPointIndex = getIndex(soluteGrid, gridSelector, &absPoint);
++			gridPointIndex = (int)(intptr_t)(getIndex)(soluteGrid, gridSelector, &absPoint);
+ 		
+ 			//Get the value of the volume function
+ 			//If no atoms overlap the point the volume function is 0.
+@@ -399,7 +396,7 @@
+ 
+ - (void) _calculateBornRadiiAndCFATerms
+ {
+-	int i;
++	NSUInteger i;
+ 
+ 	totalSelfESTPotential = 0;
+ 	for(i=0; i<numberOfAtoms; i++)
+@@ -421,7 +418,8 @@
+ - (double) _calculateSASAForAtom: (int) atomIndex
+ {
+ 	int i;
+-	int radialPoint, angularPoint, gridPointIndex;
++	int radialPoint, gridPointIndex;
++	NSUInteger angularPoint;
+ 	double radialWeight, angularWeight;
+ 	double volumeExclusionValue, atomSASA, radius;
+ 	double* position, *weightsBuffer, *pointsBuffer;
+@@ -475,7 +473,7 @@
+ 				absPoint.vector[1] = position[1] + integrationPoint.vector[1];
+ 				absPoint.vector[2] = position[2] + integrationPoint.vector[2];
+ 				
+-				gridPointIndex = getIndex(soluteGrid, gridSelector, &absPoint);
++				gridPointIndex = (int)(intptr_t)(getIndex)(soluteGrid, gridSelector, &absPoint);
+ 				
+ 				//FIMXE: Is this necessary?
+ 				if(gridPointIndex == -1)
+@@ -517,7 +515,7 @@
+ 
+ - (void) _calculateSASA
+ {
+-	int i;
++	NSUInteger i;
+ 	
+ 	AdInitialiseGBSmoothingVariables(0.1);
+ 	
+@@ -567,8 +565,9 @@
+ - (void) _calculateDerivativesWithRespectToAtom:(int) mainAtom 
  {
  	BOOL retval;
- 	int i, radialPoint, angularPoint, radialStart;
+-	int i, radialPoint, angularPoint, radialStart;
 -	int gridPointIndex, numberOfNeighbours, index;
++	NSUInteger i, angularPoint;
++	int radialPoint, radialStart;
 +	int gridPointIndex, numberOfNeighbours;
  	int* neighbourIndexes;
  	double f1, f2, f3;	//!< Precomputed factors
  	double radialWeight, angularWeight, distance, squaredDistance, exclusionValue;
-@@ -886,8 +884,7 @@
+@@ -612,7 +611,7 @@
+ 			
+ 	//Array for holding indexes of atoms who have a gradient
+ 	//FIMXE: Preallocate
+-	calculatedGradients.array = malloc(numberOfAtoms*sizeof(int));
++	calculatedGradients.array = malloc(numberOfAtoms*sizeof(NSUInteger));
+ 	calculatedGradients.length = 0;
+ 	interactingAtoms = calloc(numberOfAtoms, sizeof(bool));
+ 	
+@@ -649,7 +648,7 @@
+ 			absPoint.vector[2] = mainAtomPosition[2] + integrationPoint.vector[2];
+ 			
+ 			//Find the nearest grid point to this point
+-			gridPointIndex = getIndex(soluteGrid, gridSelector, &absPoint);
++			gridPointIndex = (int)(intptr_t)(getIndex)(soluteGrid, gridSelector, &absPoint);
+ 			
+ 			//Get the derivatives.
+ 			//All derivatives depend on the value of the volume exclusion function (VEF) at the
+@@ -845,7 +844,7 @@
+ 		double angularWeight, double radialWeight, double f3, AdMatrix* gradients)
+ {
+ 	int i, index, updateNumber;
+-	int *atomArray;
++	NSUInteger *atomArray;
+ 	double value;
+ 	double* gradient, *array;
+ 	Vector3D* vector;	
+@@ -886,8 +885,7 @@
  				int* neighbourIndexes, int numberNeighbours, double* radii,
  				 IntArrayStruct* contributingAtoms)
  {
@@ -1433,12 +2032,25 @@ Last-Update: 2019-01-24
  	//Variables for manually inlined AdAtomicVolumeExclusionFunctionNew()
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdGBSWTermIntegrationMethods.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdGBSWTermIntegrationMethods.m
-@@ -264,10 +264,10 @@
+@@ -146,7 +146,7 @@
+ */
+ - (void) _initIntegrationVariables
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double radialDistance;
+ 	double* weightsBuffer, *pointsBuffer;
+ 	Vector3D* vector;
+@@ -262,12 +262,13 @@
+ {
+ 	BOOL overlap, retval;
  	int counter = 0;
- 	int i, xIndex, yIndex, zIndex, closestPoint;
+-	int i, xIndex, yIndex, zIndex, closestPoint;
++	NSUInteger i, numberGridPoints;
++	int xIndex, yIndex, zIndex, closestPoint;
  	int range, length;
 -	int gridIndex, atomIndex, numberGridPoints;
-+	int gridIndex, numberGridPoints;
++	int gridIndex;
  	int *array, ticksPerAxis[3]; 
  	int indexes[3], lower[3], higher[3];
 -	double gridCut, gridCutSquared, overlapCut;
@@ -1446,17 +2058,169 @@ Last-Update: 2019-01-24
  	double* atomPosition, *pointPosition;
  	double **cMatrix, **gMatrix;
  	NSArray* divisions;
+@@ -434,12 +435,12 @@
+ 	
+ 	//Create function pointer to indexOfGridPointNearestToPoint:
+ 	gridSelector = @selector(indexOfGridPointNearestToPoint:);	
+-	getIndex = (int (*)(id, SEL, Vector3D*))[soluteGrid methodForSelector: gridSelector];
++	getIndex = [soluteGrid methodForSelector: gridSelector];
+ }
+ 
+ - (void) _initLookupTableVariables
+ {
+-	int i;
++	NSUInteger i;
+ 	double value, searchCutoff = 0;
+ 	
+ 	//Create the lookup grid
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunCellListHandler.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunCellListHandler.m
-@@ -388,7 +388,7 @@
+@@ -80,7 +80,7 @@
+ */
+ - (void) _initContentsArrays
+ {
+-	int i;
++	NSUInteger i;
+ 
+ 	if(cellContentsMatrix == NULL)
+ 	{	
+@@ -96,10 +96,10 @@
+ 			free(cellContentsMatrix[i].array);
+ 	}		
+ 				
+-	baseSize = (int)ceil(((double)coordinates->no_rows)/(double)numberOfCells);
++	baseSize = (NSUInteger)ceil(((double)coordinates->no_rows)/(double)numberOfCells);
+ 	for(i=0; i<numberOfCells; i++)
+ 	{	
+-		cellContentsMatrix[i].array = (int*)malloc(baseSize*sizeof(int));
++		cellContentsMatrix[i].array = (NSUInteger*)malloc(baseSize*sizeof(NSUInteger));
+ 		cellContentsMatrix[i].length = 0;
+ 	}
+ }
+@@ -111,7 +111,7 @@
+ - (BOOL) _assignCellIndexes 
+ {
+ 	BOOL assignmentSuccess = YES;
+-	int i, j;
++	NSUInteger i, j;
+ 	IntArrayStruct* cellContentsArray;
+ 
+ 	//this exception is generic since we dont want it to be caught with the one below
+@@ -142,14 +142,14 @@
+ 		cellNumber[i] += atomCells->matrix[i][2];
+ 
+ 		cellContentsArray = &cellContentsMatrix[cellNumber[i]];
+-		if(cellNumber[i] > numberOfCells || cellNumber[i] < 0)
++		if(cellNumber[i] > (int)numberOfCells || cellNumber[i] < 0)
+ 		{
+ 			assignmentSuccess = NO;
+ 			break;
+ 		}	
+ 
+ 		if(cellContentsArray->length >= baseSize)
+-			cellContentsArray->array = realloc(cellContentsArray->array, (cellContentsArray->length + 1)*sizeof(int));
++			cellContentsArray->array = realloc(cellContentsArray->array, (cellContentsArray->length + 1)*sizeof(NSUInteger));
+ 		
+ 		cellContentsArray->array[cellContentsArray->length] = i;
+ 		cellContentsArray->length++; 
+@@ -159,7 +159,7 @@
+ 	//We have to do this regardless of whether the entire assignment 
+ 	//process succeded or not
+ 	for(i=0; i<numberOfCells; i++)
+-		cellContentsMatrix[i].array = realloc(cellContentsMatrix[i].array, cellContentsMatrix[i].length*sizeof(int));
++		cellContentsMatrix[i].array = realloc(cellContentsMatrix[i].array, cellContentsMatrix[i].length*sizeof(NSUInteger));
+ 
+ 	NSDebugLLog(@"AdCellListHandler", @"Complete");
+ 
+@@ -169,9 +169,9 @@
+ - (BOOL) _updateCellIndexes 
+ {
+ 	BOOL updateSuccess = YES;
+-	int i,j,k;
++	NSUInteger i,j,k;
+ 	int number;
+-	int *new;
++	NSUInteger *new;
+ 	IntArrayStruct* cellContentsArray;
+ 
+ 	//this exception is generic since we dont want it to be caught with the one below
+@@ -205,7 +205,7 @@
+ 		for(j=0; j<3; j++)
+ 		{
+ 			atomCells->matrix[i][j] = (int)floor((coordinates->matrix[i][j] - minSpaceBoundry.vector[j])/cellSize);
+-			if(atomCells->matrix[i][j] >= cellsPerAxis[j] || atomCells->matrix[i][j] < 0)
++			if(atomCells->matrix[i][j] >= (int)cellsPerAxis[j] || atomCells->matrix[i][j] < 0)
+ 				updateSuccess = NO;
+ 		}
+ 
+@@ -230,7 +230,7 @@
+ 			//remove from old array 
+ 			//\note - make these functions
+ 			cellContentsArray = &cellContentsMatrix[cellNumber[i]];
+-			new = malloc((cellContentsArray->length - 1)*sizeof(int));
++			new = malloc((cellContentsArray->length - 1)*sizeof(NSUInteger));
+ 			
+ 			for(k = 0, j=0; k< cellContentsArray->length; k++)
+ 				if(cellContentsArray->array[k] != i)
+@@ -249,7 +249,7 @@
+ 			//add to new array
+ 			
+ 			cellContentsArray = &cellContentsMatrix[number];
+-			new = malloc((cellContentsArray->length + 1)*sizeof(int));
++			new = malloc((cellContentsArray->length + 1)*sizeof(NSUInteger));
+ 			for(k = 0, j=0 ; k < cellContentsArray->length; k++)
+ 			{
+ 				if(cellContentsArray->array[k] > i && j == k)
+@@ -387,12 +387,12 @@
+ 
  - (void) createList
  {
- 	int i,j;
+-	int i,j;
 -	int atomIndex, cell, holder;
+-	int check, nocheck;
+-	int* inter;
++	NSUInteger i, j;
 +	int atomIndex, holder;
- 	int check, nocheck;
- 	int* inter;
++	NSUInteger check, nocheck;
++	uintptr_t* inter;
  	uint_fast8_t *bin; 
+-	int (*interact)(id, SEL, int*, int, NSRangePointer);
++	IMP interact;
+ 	ListElement* el_p;
+ 	IntArrayStruct *checkInteractions, *cellContentsBuffer;
+ 	IntArrayStruct interactionBuffer, neighbourCells, nocheckBuffer;
+@@ -409,7 +409,7 @@
+ 		return;
+ 
+ 	//Check if system and allowed pairs are compatible
+-	if((int)[interactions count] >= coordinates->no_rows)
++	if([interactions count] >= coordinates->no_rows)
+ 		[NSException raise: NSInternalInconsistencyException
+ 			format: @"Allowed pairs array implies more elements then are present in system."];
+ 
+@@ -433,8 +433,8 @@
+ 		[self _assignCellIndexes];
+ 	}
+ 	
+-	interactionBuffer.array = (int*)malloc(coordinates->no_rows*sizeof(int));
+-	nocheckBuffer.array = (int*)malloc(coordinates->no_rows*sizeof(int));
++	interactionBuffer.array = (NSUInteger*)malloc(coordinates->no_rows*sizeof(NSUInteger));
++	nocheckBuffer.array = (NSUInteger*)malloc(coordinates->no_rows*sizeof(NSUInteger));
+ 	inter = interactionBuffer.array;
+ 	bin = (uint_fast8_t*)calloc(coordinates->no_rows,sizeof(uint_fast8_t));
+ 
+@@ -453,9 +453,9 @@
+ 		
+ 		//load this atoms interactions into a buffer
+ 
+-		interact = (int (*)(id, SEL, int*, int, NSRangePointer))[interaction methodForSelector: 
++		interact = [interaction methodForSelector:
+ 					@selector(getIndexes:maxCount:inIndexRange:)];
+-		interactionBuffer.length = interact(interaction, 
++		interactionBuffer.length = (NSUInteger)(interact)(interaction,
+ 							@selector(getIndexes:maxCount:inIndexRange:), 
+ 							interactionBuffer.array, 
+ 							coordinates->no_rows,
 @@ -482,7 +482,6 @@
  		neighbourCells = cellNeighbourMatrix[cellNumber[atomIndex]];
  		for(check=0, i=0; i<neighbourCells.length; i++)
@@ -1465,6 +2229,202 @@ Last-Update: 2019-01-24
  			cellContentsBuffer = &cellContentsMatrix[neighbourCells.array[i]];
  			if(cellContentsBuffer->length != 0)
  				for(j=0; j < cellContentsBuffer->length; j++)
+@@ -497,7 +496,7 @@
+ 		}
+ 
+ 		checkInteractions = &updateCheckInteractions[atomIndex];
+-		checkInteractions->array = malloc((check+nocheck)*sizeof(int));
++		checkInteractions->array = malloc((check+nocheck)*sizeof(NSUInteger));
+ 		checkInteractions->length = 0;
+ 
+ 		for(j=0; j<check; j++)
+@@ -517,7 +516,7 @@
+ 			checkInteractions->length++;
+ 		}
+ 		
+-		checkInteractions->array = realloc(checkInteractions->array, checkInteractions->length*sizeof(int));
++		checkInteractions->array = realloc(checkInteractions->array, checkInteractions->length*sizeof(NSUInteger));
+ 		memset(bin, 0, coordinates->no_rows*sizeof(uint_fast8_t));
+ 		atomIndex++;
+ 	}
+@@ -555,7 +554,7 @@
+ 			
+ 			if(removedInteractions[atomOne].length >= updateCheckInteractions[atomOne].length)
+ 				removedInteractions[atomOne].array = realloc(removedInteractions[atomOne].array, 
+-						(removedInteractions[atomOne].length + 1)*sizeof(int));
++						(removedInteractions[atomOne].length + 1)*sizeof(NSUInteger));
+ 							
+ 			removedInteractions[atomOne].array[removedInteractions[atomOne].length] = atomTwo;	
+ 			removedInteractions[atomOne].length++;
+@@ -578,7 +577,8 @@
+ 
+ - (void) update
+ {
+-	int i, j, k, cell, numberOfInteractionSets;;
++	int cell;
++	NSUInteger i, j, k, numberOfInteractionSets;
+ 	int atomTwo;
+ 	double holder;
+ 	IntArrayStruct currentInteractions, neighbourCells, *checkInteractions, newInteractions;
+@@ -586,8 +586,8 @@
+ 	uint_fast8_t *cellBin;
+ 	NSMutableIndexSet* interaction;
+ 	Vector3D separation;
+-	BOOL (*interact)(id, SEL, int);	
+-	id (*fetch)(id, SEL, int);
++	IMP interact;
++	IMP fetch;
+ 	SEL selector, selector2;
+ 
+ 	//Update does nothing if the createList hasnt
+@@ -627,13 +627,13 @@
+ 	//after each update.
+ 	numberOfInteractionSets = [interactions count];
+ 	cellBin = [memoryManager allocateArrayOfSize: sizeof(uint_fast8_t)*coordinates->no_rows];
+-	currentInteractions.array = [memoryManager allocateArrayOfSize: coordinates->no_rows*sizeof(int)];
++	currentInteractions.array = [memoryManager allocateArrayOfSize: coordinates->no_rows*sizeof(NSUInteger)];
+ 	removedInteractions = [memoryManager allocateArrayOfSize: 
+ 				numberOfInteractionSets*sizeof(IntArrayStruct)];
+ 	
+ 	for(i=0; i<numberOfInteractionSets; i++)
+ 	{
+-		removedInteractions[i].array = malloc(updateCheckInteractions[i].length*sizeof(int));
++		removedInteractions[i].array = malloc(updateCheckInteractions[i].length*sizeof(NSUInteger));
+ 		removedInteractions[i].length = 0;
+ 	}
+ 	
+@@ -641,7 +641,7 @@
+ 	selector2 = @selector(objectAtIndex:);
+ 
+ 	//we cache this method call since will be using it alot
+-	fetch = (id (*)(id, SEL, int))[interactions 
++	fetch = [interactions
+ 			methodForSelector: @selector(objectAtIndex:)];
+ 	
+ 	/*
+@@ -668,7 +668,7 @@
+ 	holder = cutoff + diagonal;
+ 	for(k=0; k< numberOfInteractionSets; k++)
+ 	{	
+-		interaction = fetch(interactions, selector2, k);
++		interaction = (id)(fetch)(interactions, selector2, k);
+ 		if([interaction count] == 0)
+ 		{
+ 			removed = &removedInteractions[k];
+@@ -677,7 +677,7 @@
+ 		}	
+ 
+ 		currentInteractions.length = 0;
+-		interact = (BOOL (*)(id, SEL, int))[interaction methodForSelector: selector];
++		interact = [interaction methodForSelector: selector];
+ 		
+ 		/*
+ 		  Load the possible interactions into a buffer called currentInteractions.
+@@ -752,12 +752,12 @@
+ 		*/
+ 
+ 		newInteractions.length = 0;
+-		newInteractions.array = malloc(coordinates->no_rows*sizeof(int));
++		newInteractions.array = malloc(coordinates->no_rows*sizeof(NSUInteger));
+ 		for(i=0; i< currentInteractions.length; i++)
+ 		{
+ 			atomTwo = currentInteractions.array[i];
+ 			if(cellBin[atomTwo] != 1)
+-				if(interact(interaction, selector, atomTwo) == YES)
++				if((BOOL)(uintptr_t)(interact)(interaction, selector, atomTwo) == YES)
+ 					if([self _checkInteractionBetweenAtomOne: k atomTwo: atomTwo])
+ 					{
+ 						newInteractions.array[newInteractions.length] = atomTwo;
+@@ -792,7 +792,7 @@
+ 				newInteractions.length++;
+ 			}				
+ 
+-		newInteractions.array = realloc(newInteractions.array, newInteractions.length*sizeof(int));
++		newInteractions.array = realloc(newInteractions.array, newInteractions.length*sizeof(NSUInteger));
+ 		free(checkInteractions->array);
+ 		free(removed->array);
+ 		checkInteractions->array = newInteractions.array;
+@@ -1047,7 +1047,7 @@
+ 
+ - (void) _locateCellSpaceBoundries
+ {
+-	int i;
++	NSUInteger i;
+ 	double* coordinateArray;
+ 	double xdiff, ydiff, zdiff;
+ 	NSError* error;
+@@ -1179,8 +1179,7 @@
+ 
+ - (void) _createCellMatrices
+ {
+-	int i,j,k;
+-	int xIndex, yIndex, zIndex, currentCell, number;
++	NSUInteger i, j, k, currentCell, xIndex, yIndex, zIndex, number;
+ 	IntArrayStruct* cellNeighbours;
+ 
+ 	for(numberOfCells=1, i=0; i<3; i++)
+@@ -1220,7 +1219,7 @@
+ 	for(currentCell = 0; currentCell < numberOfCells; currentCell++)
+ 	{
+ 		cellNeighbours = &cellNeighbourMatrix[currentCell];
+-		cellNeighbours->array = [memoryManager allocateArrayOfSize: 80*sizeof(int)];
++		cellNeighbours->array = [memoryManager allocateArrayOfSize: 80*sizeof(NSUInteger)];
+ 		cellNeighbours->length = 0;
+ 
+ 		xIndex = (int)cellIndexMatrix->matrix[currentCell][0];
+@@ -1228,11 +1227,11 @@
+ 		zIndex = (int)cellIndexMatrix->matrix[currentCell][2];
+ 
+ 		for(i= xIndex - 2; i <= xIndex + 2; i++)
+-			if(i >= 0 && i < cellsPerAxis[0])
++			if((int)i >= 0 && i < cellsPerAxis[0])
+ 				for(j = yIndex -2; j<= yIndex + 2; j++)
+-					if(j >= 0 && j < cellsPerAxis[1])
++					if((int)j >= 0 && j < cellsPerAxis[1])
+ 						for(k = zIndex -2; k <= zIndex + 2; k++)
+-							if(k>=0 && k < cellsPerAxis[2])
++							if((int)k>=0 && k < cellsPerAxis[2])
+ 							{
+ 								number =  (cellsPerAxis[2]*cellsPerAxis[1])*i + cellsPerAxis[2]*j + k;
+ 								if(number != currentCell && number < numberOfCells)
+@@ -1240,7 +1239,7 @@
+ 									//check if reallocing is needed
+ 									if(cellNeighbourMatrix[currentCell].length >= 80)
+ 										cellNeighbours->array = realloc(cellNeighbours->array,
+-												 (cellNeighbours->length + 1)*sizeof(int));
++												 (cellNeighbours->length + 1)*sizeof(NSUInteger));
+ 									cellNeighbours->array[cellNeighbours->length] = number;
+ 									cellNeighbours->length++;
+ 		
+@@ -1248,16 +1247,16 @@
+ 							}
+ 
+ 		//trim the memory to the neccessary size
+-		cellNeighbours->array = realloc(cellNeighbours->array, (cellNeighbours->length)*sizeof(int));
++		cellNeighbours->array = realloc(cellNeighbours->array, (cellNeighbours->length)*sizeof(NSUInteger));
+ 	}	
+ 
+ 	//Initialise CellContents array
+ 	cellContentsMatrix = [memoryManager allocateArrayOfSize: numberOfCells*sizeof(IntArrayStruct)];
+-	baseSize = (int)ceil(((double)coordinates->no_rows)/(double)numberOfCells);
++	baseSize = (NSUInteger)ceil(((double)coordinates->no_rows)/(double)numberOfCells);
+ 
+ 	for(i=0; i<numberOfCells; i++)
+ 	{	
+-		cellContentsMatrix[i].array = (int*)malloc(baseSize*sizeof(int));
++		cellContentsMatrix[i].array = (NSUInteger*)malloc(baseSize*sizeof(NSUInteger));
+ 		cellContentsMatrix[i].length = 0;
+ 	}
+ }
+@@ -1279,7 +1278,7 @@
+ */
+ - (void) clearCellMatrices
+ {
+-	int i;
++	NSUInteger i;
+ 
+ 	NSDebugLLog(@"AdCellListHandler", @"Freeing cell matrices");
+ 	
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunMultithreadedNonbondedTerm.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunMultithreadedNonbondedTerm.m
 @@ -127,7 +127,6 @@
@@ -1475,18 +2435,19 @@ Last-Update: 2019-01-24
  	int i, j, start, index;
  	NSMutableArray* arrays = [NSMutableArray array], *array;
  
-@@ -290,9 +289,8 @@
+@@ -290,9 +289,9 @@
  
  - (void) evaluateForces
  {
 -	int i, j, k, finishedThreads = 0;
-+	int i, j, k;
++	int j, k;
++	NSUInteger i;
  	AdMatrix* forces1;
 -	id threadedObj;
  
  	[allTerms makeObjectsPerformSelector: @selector(clearForces)];
  	NSDebugLLog(@"Threading", @"Multi Term - Calling evaluateForces on %@", threadManager);
-@@ -322,10 +320,6 @@
+@@ -322,10 +321,6 @@
  
  - (void) updateTerms
  {
@@ -1497,7 +2458,7 @@ Last-Update: 2019-01-24
  	NSDebugLLog(@"Threading", @"Multi Term - Calling updateTerms on %@", threadManager);
  	[threadManager updateTerms: threadedTerms];
  	NSDebugLLog(@"Threading", @"Multi Term - Calling updateList: on main thread instance");
-@@ -401,14 +395,12 @@
+@@ -401,14 +396,12 @@
  {
  	int i;
  	AdWorkerThread* workerThread;
@@ -1513,7 +2474,7 @@ Last-Update: 2019-01-24
  	{
  		lock = [NSLock new];
  		workerThreads = [NSMutableArray new];
-@@ -573,7 +565,7 @@
+@@ -573,7 +566,7 @@
  
  - (id) initWithThreadManager: (AdNonbondedWorkerThreadManager*) object
  {
@@ -1539,6 +2500,15 @@ Last-Update: 2019-01-24
  	
  	for(i=0; i<no_surface_molecules; i++)
  	{
+@@ -576,7 +574,7 @@
+ 
+ - (void) _clearForceMatrix
+ {
+-	int i,j;
++	NSUInteger i, j;
+ 
+ 	for(i=0; i<forceMatrix->no_rows; i++)
+ 		for(j=0; j<3; j++)
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunSmoothedGBTerm.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunSmoothedGBTerm.m
 @@ -69,13 +69,13 @@
@@ -1557,6 +2527,15 @@ Last-Update: 2019-01-24
  		memoryManager = [AdMemoryManager appMemoryManager];
  		
  		//Set arguments
+@@ -201,7 +201,7 @@
+ 
+ - (AdDataMatrix*) selfEnergyData
+ {
+-	int i;
++	NSUInteger i;
+ 	AdMutableDataMatrix* matrix;
+ 	NSArray *headers;
+ 	id array;
 @@ -240,8 +240,6 @@
  
  - (void) calculateBornRadii
@@ -1566,11 +2545,13 @@ Last-Update: 2019-01-24
  	NSDebugLLog(@"AdSmoothedGBTerm", @"Beginning update. Recalculating lookup table");
  	[self updateLookupTable];
  	NSDebugLLog(@"AdSmoothedGBTerm", @"Updating Born Radii and self energies");
-@@ -295,9 +293,7 @@
+@@ -294,10 +292,8 @@
+ 
  - (void) evaluateForces
  {
- 	int i,j;
+-	int i,j;
 -	int atomOne, atomTwo;
++	NSUInteger i, j;
  	double factor, charge, bornRadius, magnitude;
 -	double valueOne, valueTwo, separation;
  	double** coordinates, *array;
@@ -1611,6 +2592,15 @@ Last-Update: 2019-01-24
  }
  
  //custom term methods
+@@ -434,7 +432,7 @@
+ 
+ - (void) clearForces
+ {
+-	int i,j;
++	NSUInteger i,j;
+ 
+ 	for(i=0; i<forceMatrix->no_rows; i++)
+ 		for(j=0; j<3; j++)
 @@ -500,7 +498,7 @@
  
  	//Check if any of the terms not found above are custom terms.
@@ -1662,6 +2652,51 @@ Last-Update: 2019-01-24
  		{		
  			object = [customTerms objectForKey: term];
  			if([object canEvaluateEnergy])
+@@ -788,7 +786,7 @@
+ 
+ - (void) _initialisationForSystem
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	NSArray* interactionTypes;
+ 	AdDataMatrix *groups, *parameters;
+ 
+@@ -851,7 +849,7 @@
+ 		
+ 		for(i=0; i<angles->no_rows; i++)
+ 		{
+-			for(j=0; j<(int)[groups numberOfColumns]; j++)
++			for(j=0; j<[groups numberOfColumns]; j++)
+ 				angles->matrix[i][j] = [[groups elementAtRow: i column: j] doubleValue];
+ 
+ 			angles->matrix[i][3] = [[parameters elementAtRow: i 
+@@ -876,7 +874,7 @@
+ 		
+ 		for(i=0; i<torsions->no_rows; i++)
+ 		{
+-			for(j=0; j<(int)[groups numberOfColumns]; j++)
++			for(j=0; j<[groups numberOfColumns]; j++)
+ 				torsions->matrix[i][j] = [[groups elementAtRow: i column: j] doubleValue];
+ 
+ 			torsions->matrix[i][4] = [[parameters elementAtRow: i 
+@@ -903,7 +901,7 @@
+ 		
+ 		for(i=0; i<improperTorsions->no_rows; i++)
+ 		{
+-			for(j=0; j<(int)[groups numberOfColumns]; j++)
++			for(j=0; j<[groups numberOfColumns]; j++)
+ 				improperTorsions->matrix[i][j] = [[groups elementAtRow: i column: j] doubleValue];
+ 
+ 			improperTorsions->matrix[i][4] = [[parameters elementAtRow: i 
+@@ -1030,7 +1028,7 @@
+ 
+ - (void) _updateAccelerations
+ {
+-	int i,j;
++	NSUInteger i,j;
+ 
+ 	for(i=0; i<accelerationMatrix->no_rows; i++)
+ 		for(j=0; j<3; j++)
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunForceFieldCollection.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunForceFieldCollection.m
 @@ -144,11 +144,10 @@
@@ -1723,7 +2758,12 @@ Last-Update: 2019-01-24
  	{
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunBerendsenThermostat.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunBerendsenThermostat.m
-@@ -11,7 +11,7 @@
+@@ -1,3 +1,4 @@
++#include <math.h>
+ #include "AdunKernel/AdunBerendsenThermostat.h"
+ 
+ @implementation AdBerendsenThermostat
+@@ -11,7 +12,7 @@
  	
  	NSDebugLLog(@"AdBerendsenThermostat", @"Removing translational DOF for all systems");
  	systemEnum = [[systemCollection fullSystems] objectEnumerator];
@@ -1732,7 +2772,16 @@ Last-Update: 2019-01-24
  	{
  		NSDebugLLog(@"AdBerendsenThermostat", @"System %@", [system systemName]);
  		[system removeTranslationalDegreesOfFreedom];
-@@ -133,8 +133,6 @@
+@@ -27,7 +28,7 @@
+ 		currentTemperature - warmingIncrement, currentTemperature);
+ 	NSLog(@"%@", [self description]);
+ 	//If we've reached the target temperature stop warming
+-	if(abs(currentTemperature - targetTemperature) < 1)
++	if(fabs(currentTemperature - targetTemperature) < 1)
+ 	{
+ 		NSLog(@"Target temperature reached");
+ 		[[AdMainLoopTimer mainLoopTimer]
+@@ -133,8 +134,6 @@
  		willBeginProductionWithSystems: (AdSystemCollection*) aSystemCollection 
  		forceFields: (AdForceFieldCollection*) aForceFieldCollection
  {
@@ -1741,8 +2790,26 @@ Last-Update: 2019-01-24
  	timeStep = [aSimulator timeStep];
  	timePerCouplingFactor = (double)timeStep/couplingFactor;
  	systemCollection = aSystemCollection;
+@@ -165,7 +164,7 @@
+ 
+ - (void) simulatorDidPerformSecondVelocityUpdateForSystem: (AdSystem*) system
+ {
+-	int j,k;
++	NSUInteger j,k;
+ 	double temperature, factor;
+ 	AdMatrix* velocities;
+ 
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunLangevinThermostat.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunLangevinThermostat.m
+@@ -55,7 +55,7 @@
+ */
+ - (void) _generateRandomAccelerations: (AdMatrix*) matrix usingMasses: (double*) masses
+ {
+-	register int i, j;
++	register NSUInteger i, j;
+ 	double sigma, holder, randomMagnitude;
+ 	Vector3D vector;
+ 	
 @@ -116,7 +116,7 @@
  
  	memoryManager = [AdMemoryManager appMemoryManager];
@@ -1761,8 +2828,35 @@ Last-Update: 2019-01-24
  	{
  		NSDebugLLog(@"AdLangevinThermostat", @"System %@", [system systemName]);
  		[system removeTranslationalDegreesOfFreedom];
+@@ -258,7 +258,7 @@
+ 
+ - (void) simulatorWillPerformFirstVelocityUpdateForSystem: (AdSystem*) aSystem
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double halfTimeStep;
+ 	AdMatrix* velocities, *randomAccelerations;
+ 
+@@ -300,7 +300,7 @@
+ 
+ - (void) simulatorDidPerformSecondVelocityUpdateForSystem: (AdSystem*) aSystem
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double factor;
+ 	double *masses;
+ 	AdMatrix* velocities, *randomAccelerations;
 --- adun.app.orig/Kernel/AdunKernel/Framework/AdunMinimiser.m
 +++ adun.app/Kernel/AdunKernel/Framework/AdunMinimiser.m
+@@ -76,7 +76,7 @@
+ 
+ - (void) _storeConfigurationInVector: (gsl_vector*) vector
+ {
+-	int i, j, k;
++	NSUInteger i, j, k;
+ 	AdMatrix* coordinates;
+ 	NSRange range;
+ 	NSEnumerator* systemEnum;
 @@ -207,7 +207,7 @@
  
  	//Free any constraint matrices
@@ -1780,6 +2874,15 @@ Last-Update: 2019-01-24
  
  	//Check system exists
  	if(![[systemCollection fullSystems] containsObject: system])
+@@ -586,7 +585,7 @@
+ 
+ - (void) _updateSystemsWithConfiguration: (const gsl_vector*) configuration
+ {
+-	int i,j,k;
++	NSUInteger i,j,k;
+ 	double movement = 0;
+ 	AdMatrix* coordinates;
+ 	NSRange range;
 @@ -738,7 +737,7 @@
  {
  	unsigned int i;
@@ -2113,17 +3216,22 @@ Last-Update: 2019-01-24
  #undef DEBUG_COMPUTING_TIME
  #undef VERBOSE_TRACEBACK
  #undef DEBUG_OPTIMISATION
-@@ -233,7 +229,6 @@
+@@ -232,18 +228,20 @@
+ 	MTSelection *matching1;
  	MTSelection *matching2;
  	NSArray *t_arr;
++#ifdef DEBUG_OPTIMISATION
  	int nowaligned=0;
 -	int maxaligned=0;
++#endif
  	int counter=1;
  	float seldist = OPTIMIZE_SELECTION_DISTANCE; /* ranges from OPTIMIZ... to 3.5 decreasing by 0.25 each round */
  	t_arr = [chain1 selectResiduesCloseTo: chain2 maxDistance: seldist];
-@@ -241,9 +236,8 @@
+ 	matching1 = [t_arr objectAtIndex: 0];
  	matching2 = [t_arr objectAtIndex: 1];
++#ifdef DEBUG_OPTIMISATION
  	nowaligned = [matching1 count];
++#endif
  	MTMatrix53 *rtop;
 -	double sumerr, preverr,t;
 +	double sumerr, t;
@@ -2132,7 +3240,7 @@ Last-Update: 2019-01-24
  	while (matching1 && (counter <= MAXIMUM_NUMBER_OPTIMISATIONS))
  	{
  		if (sumerr < MAXIMUM_TRAFO_VALUE) { break; } 
-@@ -253,7 +247,6 @@
+@@ -253,7 +251,6 @@
  			break;
  		}
  */
@@ -2140,8 +3248,13 @@ Last-Update: 2019-01-24
  #ifdef DEBUG_OPTIMISATION
  		printf("DEBUG            %d (%1.2e) we have %d aligned residues\n",counter,sumerr,nowaligned);
  #endif
-@@ -270,7 +263,6 @@
+@@ -267,10 +264,11 @@
+ 		t_arr = [chain1 selectResiduesCloseTo: chain2 maxDistance: seldist];
+ 		matching1 = [t_arr objectAtIndex: 0];
+ 		matching2 = [t_arr objectAtIndex: 1];
++#ifdef DEBUG_OPTIMISATION
  		nowaligned = [matching1 count];
++#endif
  		counter++;
  		if (seldist > 3.5f) seldist -= 0.25f;
 -		preverr = sumerr;
@@ -2671,6 +3784,24 @@ Last-Update: 2019-01-24
  
  	NSDebugLLog(@"AdunServer", @"Recieved a start simulation message");
  	NSDebugLLog(@"AdunServer", @"Process Object is %@", [process description]);
+@@ -369,7 +366,7 @@
+ - (void) haltProcess: (id) process
+ {
+ 	NSNumber* pid;
+-	id task;
++	NSTask* task;
+ 
+ 	pid = [NSNumber numberWithInt: [process processIdentifier]];
+ 	task = [tasks objectForKey: pid];
+@@ -389,7 +386,7 @@
+ - (void) restartProcess: (id) process
+ {
+ 	NSNumber* pid;
+-	id task;
++	NSTask *task;
+ 
+ 	pid = [NSNumber numberWithInt: [process processIdentifier]];
+ 	task = [tasks objectForKey: pid];
 @@ -421,7 +418,7 @@
  		
  	messages = [storedMessages objectForKey: pid];
@@ -4067,3 +5198,601 @@ Last-Update: 2019-01-24
  }
  
  
+--- adun.app.orig/Kernel/Base/AdMatrix.h
++++ adun.app/Kernel/Base/AdMatrix.h
+@@ -23,6 +23,7 @@
+ #ifndef _ADUN_MATRIX_
+ #define _ADUN_MATRIX_
+ #include <stdio.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <stdbool.h>
+ 
+@@ -33,8 +34,8 @@
+ 
+ typedef struct
+ {
+-	int no_rows;
+-	int no_columns;
++	uintptr_t no_rows;
++	uintptr_t no_columns;
+ 	int** matrix;
+ }
+ IntMatrix;
+@@ -46,8 +47,8 @@
+ */
+ typedef struct floatmatrix
+ {
+-	int no_rows;
+-	int no_columns;
++	uintptr_t no_rows;
++	uintptr_t no_columns;
+ 	float** matrix;
+ }
+ FloatMatrix;
+@@ -58,8 +59,8 @@
+ */
+ typedef struct doublematrix
+ {
+-	int no_rows;
+-	int no_columns;
++	uintptr_t no_rows;
++	uintptr_t no_columns;
+ 	double** matrix;
+ }
+ DoubleMatrix;
+@@ -118,29 +119,29 @@
+ void AdSetFloatMatrixWithValue(FloatMatrix *,  float);
+ void AdSetIntMatrixWithValue(IntMatrix *, int);
+ 
+-IntMatrix* AdIntMatrixFromRowSection(IntMatrix *, int , int);
+-FloatMatrix* AdFloatMatrixFromRowSection(FloatMatrix *, int , int);
+-DoubleMatrix* AdDoubleMatrixFromRowSection(DoubleMatrix *, int , int);
+-
+-IntMatrix* AdIntMatrixFromRowSelection(IntMatrix *, int* , int);
+-FloatMatrix* AdFloatMatrixFromRowSelection(FloatMatrix *, int* , int);
+-DoubleMatrix* AdDoubleMatrixFromRowSelection(DoubleMatrix *, int* , int);
+-
+-IntMatrix* AdIntMatrixFromColumnSection(IntMatrix *, int , int);
+-FloatMatrix* AdFloatMatrixFromColumnSection(FloatMatrix *, int , int);
+-DoubleMatrix* AdDoubleMatrixFromColumnSection(DoubleMatrix *, int , int);
+-
+-IntMatrix* AdIntMatrixFromColumnSelection(IntMatrix *, int* , int);
+-FloatMatrix* AdFloatMatrixFromColumnSelection(FloatMatrix *, int* , int);
+-DoubleMatrix* AdDoubleMatrixFromColumnSelection(DoubleMatrix *, int* , int);
++IntMatrix* AdIntMatrixFromRowSection(IntMatrix *, uintptr_t, uintptr_t);
++FloatMatrix* AdFloatMatrixFromRowSection(FloatMatrix *, uintptr_t, uintptr_t);
++DoubleMatrix* AdDoubleMatrixFromRowSection(DoubleMatrix *, uintptr_t, uintptr_t);
++
++IntMatrix* AdIntMatrixFromRowSelection(IntMatrix *, uintptr_t*, uintptr_t);
++FloatMatrix* AdFloatMatrixFromRowSelection(FloatMatrix *, uintptr_t*, uintptr_t);
++DoubleMatrix* AdDoubleMatrixFromRowSelection(DoubleMatrix *, uintptr_t*, uintptr_t);
++
++IntMatrix* AdIntMatrixFromColumnSection(IntMatrix *, uintptr_t, uintptr_t);
++FloatMatrix* AdFloatMatrixFromColumnSection(FloatMatrix *, uintptr_t, uintptr_t);
++DoubleMatrix* AdDoubleMatrixFromColumnSection(DoubleMatrix *, uintptr_t, uintptr_t);
++
++IntMatrix* AdIntMatrixFromColumnSelection(IntMatrix *, uintptr_t*, uintptr_t);
++FloatMatrix* AdFloatMatrixFromColumnSelection(FloatMatrix *, uintptr_t* , uintptr_t);
++DoubleMatrix* AdDoubleMatrixFromColumnSelection(DoubleMatrix *, uintptr_t* , uintptr_t);
+ 
+ void AdFreeDoubleMatrix(DoubleMatrix*);
+ void AdFreeIntMatrix(IntMatrix*);
+ void AdFreeFloatMatrix(FloatMatrix*);
+ 
+-IntMatrix* AdAllocateIntMatrix(int, int);
+-FloatMatrix* AdAllocateFloatMatrix(int, int);
+-DoubleMatrix* AdAllocateDoubleMatrix(int, int);
++IntMatrix* AdAllocateIntMatrix(uintptr_t, uintptr_t);
++FloatMatrix* AdAllocateFloatMatrix(uintptr_t, uintptr_t);
++DoubleMatrix* AdAllocateDoubleMatrix(uintptr_t, uintptr_t);
+ 
+ /**
+ AdMatrix copy function.
+--- adun.app.orig/Kernel/Base/AdVector.h
++++ adun.app/Kernel/Base/AdVector.h
+@@ -23,6 +23,7 @@
+ #ifndef VECTORS
+ #define VECTORS
+ 
++#include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <math.h>
+@@ -57,8 +58,8 @@
+ 
+ typedef struct 
+ {
+-	int length;		//!< The length of the vector
+-	int* array; 	//!< An array 
++	uintptr_t length;	//!< The length of the vector
++	uintptr_t* array; 	//!< An array
+ }
+ IntArrayStruct;
+ 
+--- adun.app.orig/Kernel/Base/AdVector.c
++++ adun.app/Kernel/Base/AdVector.c
+@@ -214,12 +214,12 @@
+ 
+ void AdIntArrayIntersectionAndDifference(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *intersection, IntArrayStruct *complement)
+ {
+-	int i, j;
+-	int complementCount, intersectionCount;	
+-	int* intersectionArray, *complementArray, *primeArray, *queryArray;
++	uintptr_t i, j;
++	uintptr_t complementCount, intersectionCount;
++	uintptr_t* intersectionArray, *complementArray, *primeArray, *queryArray;
+ 
+-	intersection->array = (int*)malloc(prime->length*sizeof(int));
+-	complement->array = (int*)malloc(prime->length*sizeof(int));
++	intersection->array = (uintptr_t*)malloc(prime->length*sizeof(uintptr_t));
++	complement->array = (uintptr_t*)malloc(prime->length*sizeof(uintptr_t));
+ 
+ 	primeArray = prime->array;
+ 	queryArray = query->array;
+@@ -268,11 +268,11 @@
+ 
+ void AdIntArrayIntersection(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *intersection)
+ {
+-	int i, j;
+-	int intersectionCount;	
+-	int* intersectionArray,  *primeArray, *queryArray;
++	uintptr_t i, j;
++	uintptr_t intersectionCount;
++	uintptr_t* intersectionArray,  *primeArray, *queryArray;
+ 
+-	intersection->array = (int*)malloc(prime->length*sizeof(int));
++	intersection->array = (uintptr_t*)malloc(prime->length*sizeof(uintptr_t));
+ 
+ 	primeArray = prime->array;
+ 	queryArray = query->array;
+@@ -309,11 +309,11 @@
+ 
+ void AdIntArrayDifference(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *difference)
+ {
+-	int i, j;
+-	int differenceCount;	
+-	int* differenceArray,  *primeArray, *queryArray;
++	uintptr_t i, j;
++	uintptr_t differenceCount;
++	uintptr_t* differenceArray,  *primeArray, *queryArray;
+ 
+-	difference->array = (int*)malloc(prime->length*sizeof(int));
++	difference->array = (uintptr_t*)malloc(prime->length*sizeof(uintptr_t));
+ 
+ 	primeArray = prime->array;
+ 	queryArray = query->array;
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMoleculeCavity.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMoleculeCavity.m
+@@ -58,7 +58,7 @@
+ 
+ - (void) _calculateCavityExtremes
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double radius, a, b;
+ 	double min[3], max[3];
+ 	NSArray* axisExtremes;
+@@ -306,7 +306,7 @@
+ 
+ - (BOOL) isPointInCavity: (double*) point
+ {
+-	int j;
++	NSUInteger j;
+ 	double radius;
+ 	Vector3D dist;
+ 
+--- adun.app.orig/Kernel/Base/AdBaseFunctions.c
++++ adun.app/Kernel/Base/AdBaseFunctions.c
+@@ -2,7 +2,8 @@
+ 
+ double AdCalculateKineticEnergy(DoubleMatrix* velocities, double* masses)
+ {
+-	register int i, j;
++	register int j;
++	register uintptr_t i;
+ 	double *vhold;
+ 	double **matrix;
+ 	double en, enhold;
+--- adun.app.orig/Kernel/Base/AdBaseFunctions.h
++++ adun.app/Kernel/Base/AdBaseFunctions.h
+@@ -14,7 +14,8 @@
+ */
+ extern inline double AdCalculateKineticEnergy(DoubleMatrix* velocities, double* masses)
+ {
+-	register int i, j;
++	register int j;
++	register uintptr_t i;
+ 	double *vhold;
+ 	double **matrix;
+ 	double en, enhold;
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunCellListHandler.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunCellListHandler.h
+@@ -61,9 +61,9 @@
+ 	@private
+ 	BOOL cellsInitialised;
+ 	BOOL listCreated;
+-	int numberOfCells;
+-	int baseSize;		//The initial size of each array in cellContentsMatrix
+-	int* cellsPerAxis;
++	NSUInteger numberOfCells;
++	NSUInteger baseSize;	//The initial size of each array in cellContentsMatrix
++	NSUInteger* cellsPerAxis;
+ 	int* cellNumber;	//An array containing the number of the cell each atom is in
+ 	double cellSize;
+ 	double cutoff;
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunContainerDataSource.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunContainerDataSource.h
+@@ -78,7 +78,7 @@
+ 	//System variables		
+ 	double solventDensity;		//!< the target solvent density
+ 	double solventMass;		//!< the mass of the solvent
+-	int currentNumberOfMolecules;	//!< the no of molecules that are currently in the sphere
++	NSUInteger currentNumberOfMolecules; //!< the no of molecules that are currently in the sphere
+ 	int numberOccludedMolecules;	//!< the number of solvent molecules hidden by the solute
+ 	int atomsPerMolecule;		//!< the number of atoms in a solvent molecule
+ 	AdMutableDataMatrix* elementProperties;
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunLinkedList.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunLinkedList.h
+@@ -62,9 +62,9 @@
+ 	ListElement* blocks[50];	//array containing the current blocks
+ 	ListElement* current_block;	//the current block
+ 	NSMutableArray* freeElements;	//array of pointers to freed elements
+-	id (*getElement)(id, SEL);
+-	void (*removeElement)(id, SEL);
+-	void (*addElement)(id, SEL, id);
++	IMP getElement;
++	IMP removeElement;
++	IMP addElement;
+ 	NSZone* listZone;
+ }
+ /**
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunGRFNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunGRFNonbondedTerm.m
+@@ -646,7 +646,7 @@
+ 
+ - (void) setExternalForceMatrix: (AdMatrix*) matrix
+ {
+-	int numberOfElements;
++	NSUInteger numberOfElements;
+ 
+ 	numberOfElements = [system numberOfElements];
+ 
+@@ -678,7 +678,7 @@
+ 
+ - (void) clearForces
+ {
+-	int i,j;
++	NSUInteger i,j;
+ 
+ 	for(i=0; i<forces->no_rows; i++)
+ 		for(j=0; j<3; j++)
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunPureNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunPureNonbondedTerm.m
+@@ -648,7 +648,7 @@
+ 
+ - (void) setExternalForceMatrix: (AdMatrix*) matrix
+ {
+-	int numberOfElements;
++	NSUInteger numberOfElements;
+ 
+ 	numberOfElements = [system numberOfElements];
+ 
+@@ -680,7 +680,7 @@
+ 
+ - (void) clearForces
+ {
+-	int i,j;
++	NSUInteger i, j;
+ 
+ 	for(i=0; i<forces->no_rows; i++)
+ 		for(j=0; j<3; j++)
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunShiftedNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunShiftedNonbondedTerm.m
+@@ -630,7 +630,7 @@
+ 
+ - (void) setExternalForceMatrix: (AdMatrix*) matrix
+ {
+-	int numberOfElements;
++	NSUInteger numberOfElements;
+ 
+ 	numberOfElements = [system numberOfElements];
+ 
+@@ -662,7 +662,7 @@
+ 
+ - (void) clearForces
+ {
+-	int i,j;
++	NSUInteger i, j;
+ 
+ 	for(i=0; i<forces->no_rows; i++)
+ 		for(j=0; j<3; j++)
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunSmoothedGBTerm.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunSmoothedGBTerm.h
+@@ -56,7 +56,7 @@
+ */
+ @interface AdSmoothedGBTerm: NSObject
+ {
+-	int numberOfAtoms;		//!< The number of atoms in the system
++	NSUInteger numberOfAtoms;	//!< The number of atoms in the system
+ 	double coefficentOne;		//!< Empirical coefficent a_0
+ 	double coefficentTwo;		//!< Empriccal coefficent a_1	
+ 	double smoothingLength;		//!< The smoothing length
+@@ -95,13 +95,13 @@
+ 	AdGrid* soluteGrid;		//!< A cartesian grid in a volume defined by the solute vdw radius + delta R.
+ 	AdCuboidBox* cavity;		//!< The cavity object defining the volume where the grid exists.
+ 	uint_fast8_t *overlapBuffer;	//!< Used to check if the grid needs to be rebuilt
+-	int (*getIndex)(id,SEL,Vector3D*);
++	IMP getIndex;
+ 	SEL gridSelector;
+ 	NSZone* lookupZone;
+ 	
+ 	//Integration Points
+-	int numberRadialPoints;
+-	int numberAngularPoints;
++	NSUInteger numberRadialPoints;
++	NSUInteger numberAngularPoints;
+ 	AdMatrix* radialInfo;	//The radial distances of each integration ''shell'' and the integration weight
+ 	AdMatrix* angularInfo;	//The angles of the points in each shell and their integration weights
+ 	Vector3D** integrationPoints;	//!< A matrix of vectors giving the position of each integration point.
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunAmberForceField.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunAmberForceField.m
+@@ -115,7 +115,7 @@
+ 
+ - (void) evaluateEnergies
+ {
+-	register int j;
++	register NSUInteger j;
+ 	double potential;
+ 	double **coordinates;
+ 	NSEnumerator* customTermsEnum;	
+@@ -177,7 +177,7 @@
+ - (void) evaluateEnergiesUsingInteractionsInvolvingElements: (NSIndexSet*) elementIndexes
+ {
+ 	BOOL evaluateInteraction = NO;
+-	register int j, i;
++	register NSUInteger j, i;
+ 	double **coordinates;
+ 
+ 	bnd_pot = ang_pot = tor_pot = itor_pot = vdw_pot = est_pot = 0;
+@@ -266,7 +266,7 @@
+ 
+ - (void) evaluateForces
+ {
+-	register int j, i;
++	register NSUInteger j, i;
+ 	double potential;
+ 	AdMatrix* customForce;
+ 	double **coordinates, **forces;
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunEnzymixForceField.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunEnzymixForceField.m
+@@ -110,7 +110,7 @@
+ 
+ - (void) evaluateEnergies
+ {
+-	register int j;
++	register NSUInteger j;
+ 	double potential;
+ 	double **coordinates;
+ 	NSEnumerator* customTermsEnum;	
+@@ -166,7 +166,7 @@
+ - (void) evaluateEnergiesUsingInteractionsInvolvingElements: (NSIndexSet*) elementIndexes
+ {
+ 	BOOL evaluateInteraction = NO;
+-	register int j, i;
++	register NSUInteger j, i;
+ 	double **coordinates;
+ 
+ 	bnd_pot = ang_pot = tor_pot = itor_pot = vdw_pot = est_pot = 0;
+@@ -256,7 +256,7 @@
+ 
+ - (void) evaluateForces
+ {
+-	register int j, i;
++	register NSUInteger j, i;
+ 	int error;
+ 	double potential;
+ 	double **coordinates, **forces;
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMemoryManager.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMemoryManager.m
+@@ -72,7 +72,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"Before Array Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON,
+ 		 	(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -141,7 +141,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"After Array Alloc (%d) - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", size, 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -154,9 +154,9 @@
+ 	return array;
+ }
+ 
+-- (AdMatrix*) allocateMatrixWithRows: (int) no_rows withColumns: (int) no_columns
++- (AdMatrix*) allocateMatrixWithRows: (NSUInteger) no_rows withColumns: (NSUInteger) no_columns
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	double *array;
+ 	AdMatrix *matrix;
+ 
+@@ -207,16 +207,16 @@
+ 	return matrix;
+ }
+ 
+-- (IntMatrix*) allocateIntMatrixWithRows: (int) no_rows withColumns: (int) no_columns
++- (IntMatrix*) allocateIntMatrixWithRows: (NSUInteger) no_rows withColumns: (NSUInteger) no_columns
+ {
+-	int i, j;
++	NSUInteger i, j;
+ 	int *array;
+ 	IntMatrix *matrix;
+ 
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"Before Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -236,7 +236,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"After Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -253,7 +253,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"Before Array Free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -267,7 +267,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"After Array Free  - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf",  
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -280,7 +280,7 @@
+ /** Do not use this method to free matrices not allocated by one of the
+ above methods **/
+ 
+-- (void) freeDoubleMatrix: (double**) matrix withRows: (int) no_rows 
++- (void) freeDoubleMatrix: (double**) matrix withRows: (NSUInteger) no_rows
+ {
+ 	//matrices are allocated as arrays
+ 	//with another array of indexes
+@@ -354,7 +354,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"Before Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+@@ -373,7 +373,7 @@
+ #ifndef __FREEBSD__
+ 	if(MEMORY_STATS==YES)
+ 	{
+-		mem_struct = mallinfo();
++		mem_struct = mallinfo2();
+ 		NSLog(@"After Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunMemoryManager.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunMemoryManager.h
+@@ -52,7 +52,7 @@
+ {
+ 	@private
+ #ifndef __FREEBSD__	
+-	struct mallinfo mem_struct;
++	struct mallinfo2 mem_struct;
+ #endif	
+ #ifdef GNUSTEP
+ 	struct NSZoneStats matrixStats;
+@@ -86,14 +86,14 @@
+ \return A pointer to a ::AdMatrix struct which contain a reference to the allocated memory area
+ The matrix contents are initialised to 0.
+ */
+-- (AdMatrix*) allocateMatrixWithRows: (int) no_rows withColumns: (int) no_columns;
++- (AdMatrix*) allocateMatrixWithRows: (NSUInteger) no_rows withColumns: (NSUInteger) no_columns;
+ /**Allocates an ::IntMatrix with the requseted dimensions. The
+ \param no_rows The number of rows in the matrix
+ \param no_columns The number of columns in the matrix
+ \return A pointer to an ::IntMatrix struct which contain a reference to the allocated memory area
+ The matrix contents are initialised to 0.
+ */
+-- (IntMatrix*) allocateIntMatrixWithRows: (int) no_rows withColumns: (int) no_columns;
++- (IntMatrix*) allocateIntMatrixWithRows: (NSUInteger) no_rows withColumns: (NSUInteger) no_columns;
+ @end
+ 
+ #endif
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunGrid.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunGrid.m
+@@ -52,7 +52,7 @@
+ 
+ - (void) _translateBy: (Vector3D*) translationVector
+ {
+-	int i, k;
++	NSUInteger i, k;
+ 
+ 	for(i=0; i<gridPoints;i++)
+ 		for(k=0; k<3; k++)
+@@ -61,8 +61,8 @@
+ 
+ - (void) _trimGridToCavity
+ {
+-	int i,j;
+-	int cavityPoints;
++	NSUInteger i, j;
++	NSUInteger cavityPoints;
+ 	int* cavityArray;
+ 	AdMatrix* newGrid;
+ 
+@@ -395,7 +395,7 @@
+ 	return [NSArray arrayFromCIntArray: ticksPerAxis ofLength: 3];
+ }
+ 
+-- (int) numberOfPoints
++- (NSUInteger) numberOfPoints
+ {
+ 	return grid->no_rows;
+ }
+@@ -414,7 +414,7 @@
+ 	dy = 1/ySpacingR*0.5;
+ 	dz = 1/zSpacingR*0.5;
+ 	
+-	for(i=0; i<gridPoints; i++)
++	for(i=0; i<(int)gridPoints; i++)
+ 	{
+ 		if(!foundX)
+ 			if(fabs(grid->matrix[i][0] - point->vector[0]) < dx)
+@@ -431,7 +431,7 @@
+ 	
+ 	//The point may not be within dx,dy,dz of any grid point
+ 	//FIXME: Add searchCutoff
+-	if(i == gridPoints)
++	if(i == (int)gridPoints)
+ 		i  =  -1;
+ 	
+ 	return i;	
+--- adun.app.orig/Kernel/AdunKernel/Headers/AdunKernel/AdunGrid.h
++++ adun.app/Kernel/AdunKernel/Headers/AdunKernel/AdunGrid.h
+@@ -60,7 +60,7 @@
+ 	double zSpacingR;
+ 	double minPoint[3];	//!< The point with the minimum (x,y,z) values.
+ 	//Ivars
+-	int gridPoints;
++	NSUInteger gridPoints;
+ 	AdMatrix* grid;
+ 	int ticksPerAxis[3];
+ 	double searchCutoff;
+@@ -160,7 +160,7 @@
+ /**
+ Returns the total number of grid points.
+ */
+-- (int) numberOfPoints;
++- (NSUInteger) numberOfPoints;
+ /**
+ Returns the index of the row in the grid matrix that is nearest to \e point.
+ However if \e point isn't within the searchCutoff() of any grid point i.e. its more than


=====================================
debian/patches/scan-build-errors.patch
=====================================
@@ -0,0 +1,1996 @@
+Description: Fix some issues found by Clang and its static analyzer.
+ API Misuse (Apple):
+   Arguments passed to variadic method aren't all Objective-C pointer types
+   nil argument
+ Logic error:
+   Assigned value is garbage or undefined
+   Result of operation is garbage or undefined
+   Dereference of null pointer
+ Memory (Core Foundation/Objective-C/OSObject):
+   Bad release
+ Core Foundation/Objective-C:
+   Missing "self = [(super or self) init...]"
+   [super dealloc] should not be called more than once
+ .
+ Compiler warnings:
+   direct comparison of a string literal has undefined behavior
+     [-Wobjc-string-compare]
+   result of comparison of constant 'NSNotFound' (9223372036854775807)
+     with expression of type 'int' is always true
+     [-Wtautological-constant-out-of-range-compare] 
+   incompatible pointer types assigning to 'NSMutableDictionary *'
+     from 'NSMutableArray *' [-Wincompatible-pointer-types]
+   expression which evaluates to zero treated as a null pointer
+     constant of type 'NSArray *' [-Wnon-literal-null-conversion]
+Author: Yavor Doganov <yavor at gnu.org>
+Forwarded: no
+Last-Update: 2024-08-07
+---
+
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMolecularMechanicsForceField.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMolecularMechanicsForceField.m
+@@ -49,9 +49,9 @@
+ 	//Register base debug defaults - turned off
+ 	[userDefaults registerDefaults:
+ 		[NSDictionary dictionaryWithObjectsAndKeys:
+-			NO, @"DiagnoseForceFieldFunctions",
+-			NO, @"DiagoseBondedForceFieldFunctions",
+-			NO, @"DiagnoseNonbondedForceFieldFunctions",
++			@"NO", @"DiagnoseForceFieldFunctions",
++			@"NO", @"DiagoseBondedForceFieldFunctions",
++			@"NO", @"DiagnoseNonbondedForceFieldFunctions",
+ 			nil]];
+ 			
+ 	//Now read the values of the above defaults.
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdGBSWTermBornRadiiMethods.m
++++ adun.app/Kernel/AdunKernel/Framework/AdGBSWTermBornRadiiMethods.m
+@@ -285,6 +285,7 @@
+ 	position = coordinates->matrix[atomIndex];
+ 		
+ 	firstSum = secondSum = 0;
++	holder = 0;
+ 	
+ 	//We can skip all points the main atom completely overlaps.
+ 	//The volume exclusion function is 0 there and so is the gradient.
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMultithreadedNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMultithreadedNonbondedTerm.m
+@@ -340,7 +340,7 @@
+ 	forces = matrix;
+ }
+ 
+-- (double) electrostaticEnergy;
++- (double) electrostaticEnergy
+ {
+ 	int i;
+ 	double energy = 0;
+@@ -351,7 +351,7 @@
+ 	return energy;
+ }	
+ 
+-- (double) lennardJonesEnergy;
++- (double) lennardJonesEnergy
+ {
+ 	int i;
+ 	double energy = 0;
+@@ -420,6 +420,8 @@
+ 			[workerThreads addObject: workerThread];
+ 		}
+ 	}
++	else
++		return nil;
+ 
+ 	NSDebugLLog(@"Threading", @"Thread Manager - Waiting for worker threads to register with me");
+ 	i = 0;
+@@ -546,7 +548,7 @@
+ {
+ 	[lock lock];
+ 	finishedThreads++;
+-	NSDebugLLog(@"Threading", @"Thread Manager - Worker thread finished - total %d of %d", finishedThreads, [workerThreads count]);
++	NSDebugLLog(@"Threading", @"Thread Manager - Worker thread finished - total %d of %"PRIuPTR"", finishedThreads, [workerThreads count]);
+ 	if(finishedThreads == numberOfProcessors - 1)
+ 		isFinished = YES;
+ 	[lock unlock];
+@@ -578,10 +580,11 @@
+ 			self = nil;
+ 		}
+ 		else
++		{
+ 			manager = object;
+-			
+-		sendPort = [[NSPort port] retain];
+-		receivePort = [[NSPort port] retain];	
++			sendPort = [[NSPort port] retain];
++			receivePort = [[NSPort port] retain];
++		}
+ 	}
+ 	
+ 	return self;
+--- adun.app.orig/Kernel/AdunKernel/CoreAdditions/AdunFileSystemSimulationStorage.m
++++ adun.app/Kernel/AdunKernel/CoreAdditions/AdunFileSystemSimulationStorage.m
+@@ -43,7 +43,7 @@
+ 	bytes = (unsigned char*)[trajectoryData bytes];
+ 	
+ 	NSDebugLLog(@"AdFileSystemSimulationStorage", 
+-		@"Processing Trajectory - there is %d bytes of data.",
++		@"Processing Trajectory - there is %"PRIuPTR" bytes of data.",
+ 		[trajectoryData length]);
+ 		
+ 	/*
+@@ -58,7 +58,7 @@
+ 		//is complete. Therefore we have to handle
+ 		//this case here.
+ 		
+-		NSWarnLog(@"Only %d bytes in archive",
++		NSWarnLog(@"Only %"PRIuPTR" bytes in archive",
+ 			  [trajectoryData length]);
+ 		NSWarnLog(@"Either an error occurred during the simulation which generated this data or no coordinate data was collected");
+ 		//If there was some corrupted data in the file delete it
+@@ -321,7 +321,7 @@
+ 		error: NULL];
+ }
+ 
+-- (id) initForReadingSimulationDataAtPath: (NSString*) path error: (NSError**) anError;
++- (id) initForReadingSimulationDataAtPath: (NSString*) path error: (NSError**) anError
+ {
+ 	return [self initSimulationStorageAtPath: path 
+ 			mode: AdSimulationStorageReadMode 
+@@ -461,7 +461,7 @@
+ 		}	
+ 	}
+ 		
+-	if(anError != NULL)
++	if(self && anError != NULL)
+ 		*anError = accessError;
+ 	
+ 	return self;
+@@ -688,11 +688,11 @@
+ 	
+ 	numberTrajectoryCheckpoints++;
+ 	NSDebugLLog(@"AdFileSystemSimulationStorage",
+-		@"Added %d bytes of trajectory data to store (%d)", 
++		@"Added %"PRIuPTR" bytes of trajectory data to store (%d)",
+ 		[data length], numberTrajectoryCheckpoints);
+ }
+ 
+-- (void) removeTrajectoryCheckpoints: (int) number;
++- (void) removeTrajectoryCheckpoints: (int) number
+ {
+ 	int i, start, size, truncateSize;
+ 
+@@ -726,7 +726,7 @@
+ 	numberTrajectoryCheckpoints -= number;		
+ 
+ 	NSDebugLLog(@"AdFileSystemSimulationStorage",
+-		@"Number of checkpoints %d - Data sizes stored %d",
++		@"Number of checkpoints %d - Data sizes stored %"PRIuPTR"",
+ 		numberTrajectoryCheckpoints, 
+ 		[dataPerCheckpoint count]);
+ }
+--- adun.app.orig/MolTalk/MTQuaternion.m
++++ adun.app/MolTalk/MTQuaternion.m
+@@ -36,9 +36,11 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
+-	x=y=z=0.0;
+-	w=1.0;
++	if ((self = [super init]))
++	{
++		x=y=z=0.0;
++		w=1.0;
++	}
+ 	return self;
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunElementSelection.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunElementSelection.m
+@@ -140,7 +140,7 @@
+ - (id) initWithSelectionCategories: (NSDictionary*) categories
+ 		selectionString: (NSString*) aString
+ {
+-	if(self == [super init])
++	if((self = [super init]))
+ 	{	
+ 		groupCategory = [categories objectForKey: AdGroupCategory];
+ 		elementCategory = [categories objectForKey: AdElementCategory];
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMoleculeCavity.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMoleculeCavity.m
+@@ -169,7 +169,7 @@
+ 		vdwType: (NSString*) string
+ 		factor: (double) factorValue	
+ {
+-	if(self == [super init])
++	if((self = [super init]))
+ 	{
+ 		if(table != nil && matrix != nil)
+ 			if([matrix numberOfRows] != [table numberOfRows])
+--- adun.app.orig/MolTalk/MTPairwiseSequenceAlignment.m
++++ adun.app/MolTalk/MTPairwiseSequenceAlignment.m
+@@ -47,7 +47,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	chain1 = nil;
+ 	chain2 = nil;
+ 	positions = nil;
+--- adun.app.orig/MolTalk/MTMatrix.m
++++ adun.app/MolTalk/MTMatrix.m
+@@ -38,7 +38,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	transposed = NO;
+ 	rows = 0;
+ 	cols = 0;
+--- adun.app.orig/UL/ULFramework/ULTopologyFrameBuilder.m
++++ adun.app/UL/ULFramework/ULTopologyFrameBuilder.m
+@@ -117,7 +117,7 @@
+ 	NSString* topPath;
+ 	NSString* topologyFileName;
+ 
+-	if(self == [super init])
++	if((self = [super init]))
+ 	{
+ 		if(aString == nil)
+ 		{
+@@ -321,8 +321,8 @@
+ 	}
+ 
+ 	NSDebugLLog(@"ULTopologyFrameBuilder", @"Residue names %@", residueList);
+-	NSDebugLLog(@"ULTopologyFrameBuilder", @"There are %d atoms", [libraryNameList count]);
+-	[buildString appendFormat: @"There are %d atoms in the topology frame\n", 
++	NSDebugLLog(@"ULTopologyFrameBuilder", @"There are %"PRIuPTR" atoms", [libraryNameList count]);
++	[buildString appendFormat: @"There are %"PRIuPTR" atoms in the topology frame\n",
+ 					[libraryNameList count]];
+ 	[buildString appendFormat: @"\nCompleted topology frame build\n"];
+ 
+--- adun.app.orig/MolTalk/MTAlPos.m
++++ adun.app/MolTalk/MTAlPos.m
+@@ -28,7 +28,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	res1 = nil;
+ 	res2 = nil;
+ 	significant = YES;
+--- adun.app.orig/MolTalk/MTPDBParser.m
++++ adun.app/MolTalk/MTPDBParser.m
+@@ -84,7 +84,8 @@
+ 
+ -(id)initWithOptions:(long)p_opts
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 
+ 	// internal state variables
+ 	options = p_opts;
+--- adun.app.orig/MolTalk/MTFileStream.m
++++ adun.app/MolTalk/MTFileStream.m
+@@ -37,8 +37,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
+-	fstream = NULL;
++	if ((self = [super init]))
++		fstream = NULL;
+ 	return self;
+ }
+ 
+--- adun.app.orig/UL/ULFramework/ULTemplate.m
++++ adun.app/UL/ULFramework/ULTemplate.m
+@@ -636,7 +636,8 @@
+ 
+ - (id) initWithCoder: (NSCoder*) decoder
+ {
+-	[super initWithCoder: decoder];
++	if(!(self = [super initWithCoder: decoder]))
++		return nil;
+ 
+ 	if([decoder allowsKeyedCoding])
+ 	{
+--- adun.app.orig/UL/XMLLib/ULMolecularLibraryTree.m
++++ adun.app/UL/XMLLib/ULMolecularLibraryTree.m
+@@ -28,8 +28,8 @@
+ 
+ - (id) init
+ {
+-	[super init];
+-	level = 0;
++	if ((self = [super init]))
++		level = 0;
+ 	return self;
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunDataMatrix.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunDataMatrix.m
+@@ -116,7 +116,7 @@
+ 	{
+ 		if(index >= [self count])
+ 			[NSException raise: NSRangeException
+-				format: @"Index %d is out of range (%d)", 
++				format: @"Index %"PRIuPTR" is out of range (%"PRIuPTR")",
+ 				index,
+ 				[self count]];
+ 
+@@ -151,7 +151,7 @@
+ 	return count;		
+ }
+ 
+--(double*) cDoubleRepresentation;
++-(double*) cDoubleRepresentation
+ {
+ 	int i = 0;
+ 	double value;
+@@ -175,7 +175,7 @@
+ 	return cArray;
+ }
+ 
+--(gsl_vector*) gslVectorRepresentation;
++-(gsl_vector*) gslVectorRepresentation
+ {
+ 	int i = 0;
+ 	double value;
+@@ -523,7 +523,7 @@
+ 				[NSArray arrayWithObject:
+ 					[NSNumber numberWithDouble: gsl_vector_get(aVector, i)]]];
+ 
+-	[self initWithRows: array
++	self = [self initWithRows: array
+ 		columnHeaders: anArray
+ 		name: aString];
+ 
+@@ -551,7 +551,7 @@
+ 		[array addObject: row];
+ 	}	
+ 
+-	[self initWithRows: array
++	self = [self initWithRows: array
+ 		columnHeaders: anArray
+ 		name: aString];
+ 
+@@ -579,7 +579,7 @@
+ 		[array addObject: row];
+ 	}	
+ 
+-	[self initWithRows: array
++	self = [self initWithRows: array
+ 		columnHeaders: anArray
+ 		name: aString];
+ 
+@@ -607,7 +607,7 @@
+ 	if(aString == nil && dataMatrix != nil)
+ 		aString = [dataMatrix name];
+ 
+-	[self initWithRows: rows
++	self = [self initWithRows: rows
+ 		columnHeaders: anArray
+ 		name: aString];
+ 	
+@@ -694,7 +694,7 @@
+ 			{
+ 				[self release];
+ 				[NSException raise: NSInvalidArgumentException
+-					format: @"Number of headers %@ does not match number of columns %d",
++					format: @"Number of headers %"PRIuPTR" does not match number of columns %"PRIuPTR"",
+ 					[anArray count], numberOfColumns];
+ 			}
+ 			else
+@@ -841,7 +841,7 @@
+ */
+ 
+ - (id) elementAtRow: (unsigned int) rowIndex
+-	 column: (unsigned int) columnIndex;
++	 column: (unsigned int) columnIndex
+ {
+ 	return [[matrix objectAtIndex: rowIndex] objectAtIndex: columnIndex];
+ }
+@@ -964,13 +964,13 @@
+ 	
+ 	if(aMatrix->no_rows != numberOfRows)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Provided buffer has incorrect number of rows - required %d, provided %d",
++			format: @"Provided buffer has incorrect number of rows - required %"PRIuPTR", provided %d",
+ 			aMatrix->no_rows,
+ 			numberOfRows];
+ 	
+ 	if(aMatrix->no_columns != numberOfColumns)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Provided buffer has incorrect number of columns - required %d, provided %d",
++			format: @"Provided buffer has incorrect number of columns - required %"PRIuPTR", provided %d",
+ 			aMatrix->no_columns,
+ 			numberOfColumns];
+ 
+@@ -1157,7 +1157,7 @@
+ 	{
+ 		if(index >= numberOfRows)
+ 			[NSException raise: NSRangeException
+-				format: @"Index %d is out of row range (%d)", 
++				format: @"Index %"PRIuPTR" is out of row range (%d)",
+ 				index,
+ 				numberOfRows - 1];
+ 		
+@@ -1207,7 +1207,7 @@
+ 	{
+ 		if(index >= numberOfColumns)
+ 			[NSException raise: NSRangeException
+-				format: @"Index %d is out of column range (%d)", 
++				format: @"Index %"PRIuPTR" is out of column range (%d)",
+ 				index,
+ 				numberOfColumns - 1];
+ 
+@@ -1572,13 +1572,13 @@
+ 		numericData = [NSData dataWithBytesNoCopy: bytes 
+ 				length: length
+ 				freeWhenDone: NO];
+-		NSDebugLLog(@"AdDataMatrix", @"Numeric Data - %d bytes", length);		
++		NSDebugLLog(@"AdDataMatrix", @"Numeric Data - %"PRIuPTR" bytes", length);
+ 		bytes = (void*)[decoder decodeBytesForKey: @"StringColumns"
+ 				returnedLength: &length];
+ 		stringData = [NSData dataWithBytesNoCopy: bytes 
+ 				length: length
+ 				freeWhenDone: NO];
+-		NSDebugLLog(@"AdDataMatrix", @"String Data - %d bytes", length);		
++		NSDebugLLog(@"AdDataMatrix", @"String Data - %"PRIuPTR" bytes", length);
+ 
+ 		[self _extractMatrixFromNumericData: numericData
+ 			stringData: stringData
+@@ -1742,14 +1742,14 @@
+ 			name, numberOfRows, numberOfColumns, columnHeaders);
+ 		data = [self _encodeNumericColumnsAsData];
+ 		NSDebugLLog(@"AdDataMatrix", 
+-			@"Encoding %d bytes of numeric data", [data length]);
++			@"Encoding %"PRIuPTR" bytes of numeric data", [data length]);
+ 		[encoder encodeBytes: [data bytes] 
+ 			length: [data length]
+ 			forKey: @"NumericColumns"];
+ 
+ 		data = [self _encodeStringColumnsAsData];
+ 		NSDebugLLog(@"AdDataMatrix",
+-			@"Encoding %d bytes of string data", [data length]);
++			@"Encoding %"PRIuPTR" bytes of string data", [data length]);
+ 		[encoder encodeBytes: [data bytes] 
+ 			length: [data length]
+ 			forKey: @"StringColumns"];
+@@ -1892,7 +1892,7 @@
+ 		{
+ 			[self release];
+ 			[NSException raise: NSInvalidArgumentException
+-				format: @"Number of headers %d does not match number of columns %d",
++				format: @"Number of headers %"PRIuPTR" does not match number of columns %d",
+ 				[headers count], numberOfColumns];
+ 		}
+ 		else
+@@ -1904,7 +1904,7 @@
+ 			{
+ 				[self release];
+ 				[NSException raise: NSInvalidArgumentException
+-					format: @"Number of data types %d does not match number of columns %d",
++					format: @"Number of data types %"PRIuPTR" does not match number of columns %d",
+ 					[dataTypes count], numberOfColumns];
+ 			}
+ 			else
+@@ -1960,7 +1960,7 @@
+ 
+ - (void) setElementAtRow: (unsigned int) rowIndex 
+ 	column: (unsigned int) columnIndex 
+-	withValue: (id) value;
++	withValue: (id) value
+ {
+ 	//check element exists
+ 
+@@ -1981,7 +1981,7 @@
+ 
+ - (void) setElementAtRow: (unsigned int) row 
+ 	ofColumnWithHeader: (NSString*) columnHeader 
+-	withValue: (id) value;
++	withValue: (id) value
+ {
+ 	NSUInteger columnIndex;
+ 
+@@ -2040,7 +2040,7 @@
+ 	else 
+ 	{
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Incorrect number of elements in array (%d, %d)",
++			format: @"Incorrect number of elements in array (%"PRIuPTR", %d)",
+ 			[anArray count], numberOfColumns];	
+ 	}
+ }	
+@@ -2058,7 +2058,7 @@
+ 	if(numberOfColumns != 0 && numberOfRows != 0)
+ 		if([anArray count] != numberOfRows)
+ 			[NSException raise: NSInvalidArgumentException
+-				format: @"Incorrect number of elements in array (%d, %d)",
++				format: @"Incorrect number of elements in array (%"PRIuPTR", %d)",
+ 				[anArray count], numberOfRows];	
+ 				
+ 	//In the case where there are no rows but the column data types have been set
+@@ -2184,7 +2184,7 @@
+ 
+ 	if([indexSet lastIndex] >= numberOfRows)
+ 		[NSException raise: NSRangeException
+-			format: @"Index %d is out of row range %d",
++			format: @"Index %"PRIuPTR" is out of row range %d",
+ 			[indexSet lastIndex],
+ 			numberOfRows];
+ 
+@@ -2205,7 +2205,7 @@
+ {
+ 	if(NSMaxRange(aRange) > numberOfRows)
+ 		[NSException raise: NSRangeException
+-			format: @"Range exceeds the number of rows in the receiver (%d, %d)",
++			format: @"Range exceeds the number of rows in the receiver (%"PRIuPTR", %d)",
+ 			NSMaxRange(aRange), numberOfRows];
+ 
+ 	[matrix removeObjectsInRange: aRange];
+@@ -2229,7 +2229,7 @@
+ 
+ 	if([anArray count] != numberOfColumns)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Incorrect number of elements in array (%d, %d)",
++			format: @"Incorrect number of elements in array (%"PRIuPTR", %d)",
+ 			[anArray count], numberOfRows];	
+ 
+ 	if(anArray != columnHeaders)
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunDataSource.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunDataSource.m
+@@ -240,7 +240,7 @@
+ 		[interactionsDict setObject: dict forKey: interaction];
+ 	}	
+ 
+-	[self initWithElementProperties: [dataSource elementProperties]
++	self = [self initWithElementProperties: [dataSource elementProperties]
+ 		configuration: [dataSource elementConfiguration]
+ 		interactions: interactionsDict
+ 		groupProperties: [dataSource groupProperties]];
+@@ -335,7 +335,7 @@
+ 	return [[groupProperties copy] autorelease];
+ }
+ 
+-- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction
+ {
+ 	if(![interactions containsObject: interaction])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -361,7 +361,7 @@
+ 	return nil;
+ }
+ 
+-- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction
+ {
+ 	if(![interactions containsObject: interaction])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -372,7 +372,7 @@
+ 		
+ }
+ 
+-- (NSString*) categoryForInteraction: (NSString*) interaction;
++- (NSString*) categoryForInteraction: (NSString*) interaction
+ {
+ 	NSEnumerator* categoryEnum;
+ 	id category;
+@@ -393,7 +393,7 @@
+ 	return nil;
+ }
+ 
+-- (NSArray*) indexSetArrayForCategory: (NSString*) category;
++- (NSArray*) indexSetArrayForCategory: (NSString*) category
+ {  
+ 	NSWarnLog(@"AdDataSource %@ - Warning only partially implemented.",
+ 		NSStringFromSelector(_cmd));
+@@ -1225,7 +1225,7 @@
+ 	index = [indexSet lastIndex];
+ 	if(index >= [self numberOfElements])
+ 		[NSException raise: NSRangeException
+-			format: @"Index %d is out of range 0 - %d",
++			format: @"Index %"PRIuPTR" is out of range 0 - %d",
+ 			index, [self numberOfElements]];
+ 	
+ 	//Start from the end -
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunTimer.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunTimer.m
+@@ -150,7 +150,7 @@
+ 	if(mainLoopTimer != nil)
+ 		return mainLoopTimer;
+ 
+-	if(self == [super init])
++	if((self = [super init]))
+ 		mainLoopTimer = self;	
+ 
+ 	return self;
+--- adun.app.orig/MolTalk/MTCompressedFileStream.m
++++ adun.app/MolTalk/MTCompressedFileStream.m
+@@ -65,7 +65,7 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	self = [super init];
+ 	return self;
+ }
+ 
+--- adun.app.orig/MolTalk/MTMatrix44.m
++++ adun.app/MolTalk/MTMatrix44.m
+@@ -35,7 +35,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	[super setRows:4 cols:4];
+ 	[self atRow: 0 col: 0 value: 1.0];
+ 	[self atRow: 1 col: 1 value: 1.0];
+--- adun.app.orig/MolTalk/MTPairwiseStrxAlignment.m
++++ adun.app/MolTalk/MTPairwiseStrxAlignment.m
+@@ -56,7 +56,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	chain1 = nil;
+ 	chain2 = nil;
+ 	positions = nil;
+@@ -380,9 +381,9 @@
+ 		}
+ 	}
+ 	NSString *sequence = [chain1 get3DSequence]; // without 'X'
+-	[stream writeString:[NSString stringWithFormat:@"%@%d %d %@\n",[[chain1 structure] pdbcode],[chain1 code],[sequence length],sequence]];
++	[stream writeString:[NSString stringWithFormat:@"%@%d %"PRIuPTR" %@\n",[[chain1 structure] pdbcode],[chain1 code],[sequence length],sequence]];
+ 	sequence = [chain2 get3DSequence]; // without 'X'
+-	[stream writeString:[NSString stringWithFormat:@"%@%d %d %@\n",[[chain2 structure] pdbcode],[chain2 code],[sequence length],sequence]];
++	[stream writeString:[NSString stringWithFormat:@"%@%d %"PRIuPTR" %@\n",[[chain2 structure] pdbcode],[chain2 code],[sequence length],sequence]];
+ 	[stream writeString:@"#1 2\n"]; // as always the case
+ 	
+ 	int score;
+--- adun.app.orig/MolTalk/MTSelection.m
++++ adun.app/MolTalk/MTSelection.m
+@@ -40,7 +40,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	chain = nil;
+ 	selection = RETAIN([NSMutableArray new]);
+ 	return self;
+@@ -63,7 +64,7 @@
+ /*
+  *   returns the number of residues in selection
+  */
+--(unsigned long)count
++-(NSUInteger)count
+ {
+ 	return [selection count];
+ }
+@@ -74,7 +75,7 @@
+  */
+ -(NSString*)description
+ {
+-	NSString *res = [NSString stringWithFormat: @"Selection of '%@' with %d residues",chain, [self count]];
++	NSString *res = [NSString stringWithFormat: @"Selection of '%@' with %"PRIuPTR" residues",chain, [self count]];
+ 	return res;
+ }
+ 
+@@ -185,7 +186,7 @@
+ 	
+ 	if ([sel2 count] != [self count])
+ 	{
+-		NSLog(@"Selection-alignTo: both selections must be of the same size (%d != %d).",[self count],[sel2 count]);
++		NSLog(@"Selection-alignTo: both selections must be of the same size (%"PRIuPTR" != %"PRIuPTR").",[self count],[sel2 count]);
+ 		return nil;
+ 	}
+ 
+--- adun.app.orig/UL/ULOutlineViewDelegate.m
++++ adun.app/UL/ULOutlineViewDelegate.m
+@@ -202,6 +202,9 @@
+ 
+ - (id) initWithObject: (id) object parent: (id) par identifier: (id) aName
+ {
++	if(!(self = [super init]))
++		return nil;
++
+ 	children = [NSMutableArray new];
+ 	isExpandable = YES;
+ 	value = @"";
+@@ -499,6 +502,9 @@
+ 
+ - (id) initWithObject: (id) object parent: (id) par identifier: (id) aName
+ {
++	if (!(self = [super init]))
++		return nil;
++
+ 	noChildren = 0;
+ 	value = object;
+ 	parent = [par retain];
+--- adun.app.orig/UL/XMLLib/ULParameterTree.m
++++ adun.app/UL/XMLLib/ULParameterTree.m
+@@ -28,8 +28,8 @@
+ 
+ - (id) init
+ {
+-	[super init];
+-	level = 0;
++	if ((self = [super init]))
++		level = 0;
+ 	return self;
+ }
+ 
+@@ -61,7 +61,7 @@
+ 	NSMutableDictionary* classTopologies;
+ 	id topologies, topology;
+ 	NSEnumerator* topologyEnum, *classEnum;
+-	id class, holder;	
++	id class, holder = nil;
+ 	BOOL foundClass;
+ 
+ 	if(className == nil)
+--- adun.app.orig/MolTalk/MTMatrix53.m
++++ adun.app/MolTalk/MTMatrix53.m
+@@ -35,7 +35,8 @@
+ 
+ -(id)init	//@nodoc
+ {
+-	[super init];
++	if (!(self = [super init]))
++		return nil;
+ 	[super setRows:5 cols:3];
+ 	[self atRow: 0 col: 0 value: 1.0];
+ 	[self atRow: 1 col: 1 value: 1.0];
+--- adun.app.orig/UL/ULDatabaseBrowser.m
++++ adun.app/UL/ULDatabaseBrowser.m
+@@ -111,7 +111,7 @@
+ 
+ - (void) deselectAllRows: (id) sender
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows;
+ 	
+ 	selectedRows = [browserView selectedRowIndexes];
+@@ -361,7 +361,8 @@
+ {
+ 	BOOL singleCopy = NO;
+ 	BOOL outputRefsAreAccessible = NO;
+-	int row, lastRow, retval;
++	int retval;
++	NSUInteger row, lastRow = 0;
+ 	NSIndexSet* selectedRows;
+ 	NSEnumerator* errorEnum, *copyEnum, *refEnum;
+ 	NSString* database;
+--- adun.app.orig/UL/XMLLib/XMLDocumentRoot.m
++++ adun.app/UL/XMLLib/XMLDocumentRoot.m
+@@ -28,8 +28,8 @@
+ 
+ - (id) init
+ {
+-	[super init];
+-	level = 0;
++	if ((self = [super init]))
++		level = 0;
+ 	return self;
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunHarmonicConstraintTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunHarmonicConstraintTerm.m
+@@ -159,9 +159,9 @@
+ {
+ 	[elementIndexes release];
+ 	[constrainedSystem release];
+-	[super dealloc];
+ 	[memoryManager freeMatrix: originalCoordinates];
+ 	[memoryManager freeMatrix: forceMatrix];
++	[super dealloc];
+ }
+ 
+ - (void) evaluateForces
+--- adun.app.orig/UL/ULFramework/ULServerManager.m
++++ adun.app/UL/ULFramework/ULServerManager.m
+@@ -80,7 +80,7 @@
+ {
+ 	NSConnection* connection;
+ 	NSString* host;
+-	NSError* error;
++	NSError* error = nil;
+ 	NSMutableDictionary* userInfo;
+ 	
+ 	//Get the host
+@@ -113,7 +113,8 @@
+ 	{	
+ 		NSWarnLog(@"Detected server death");     
+ 		userInfo = [NSMutableDictionary dictionary];
+-		[userInfo setObject: error forKey: @"ULDisconnectionErrorKey"];
++		if(error)
++			[userInfo setObject: error forKey: @"ULDisconnectionErrorKey"];
+ 		[userInfo setObject: host forKey: @"ULDisconnectedHostKey"];
+ 		
+ 		[[NSNotificationCenter defaultCenter]
+--- adun.app.orig/UL/ULDatabaseBrowserDataDisplay.m
++++ adun.app/UL/ULDatabaseBrowserDataDisplay.m
+@@ -73,7 +73,8 @@
+ 	[path setItem: object forLevel: itemLevel + 1];
+ 	
+ 	//Have to retain a reference to the outline view objects.
+-	[currentObjects addObject: object];
++	if(object)
++		[currentObjects addObject: object];
+ 	return object;
+ }
+ 
+@@ -167,7 +168,7 @@
+ {
+ 	BOOL connectionState;
+ 	int itemLevel, index;
+-	id obj;
++	NSMutableAttributedString *obj;
+ 
+ 	itemLevel = [outlineView levelForItem: item];
+ 
+@@ -234,7 +235,7 @@
+ 
+ - (void) outlineViewSelectionDidChange: (NSNotification*) aNotification
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows, item;
+ 
+ 	//udpate whats been selected
+--- adun.app.orig/Kernel/AdunKernel/CoreAdditions/Commands/AdStatusCommand.m
++++ adun.app/Kernel/AdunKernel/CoreAdditions/Commands/AdStatusCommand.m
+@@ -88,12 +88,12 @@
+ 	return status;
+ }
+ 
+-- (NSMutableDictionary*) statusOptions;
++- (NSMutableDictionary*) statusOptions
+ {
+ 	return nil;
+ }
+ 
+-- (NSError*) statusError;
++- (NSError*) statusError
+ {
+ 	return [commandErrors objectForKey: @"status"];
+ }
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdFrameworkFunctions.m
++++ adun.app/Kernel/AdunKernel/Framework/AdFrameworkFunctions.m
+@@ -270,7 +270,7 @@
+ 	}	
+ 
+ 	NSWarnLog(@"Detected error from domain %@", [error domain]);
+-	NSWarnLog(@"Error code %d", [error code]);
++	NSWarnLog(@"Error code %"PRIiPTR"", [error code]);
+ 	if((string = [[error userInfo] objectForKey: NSLocalizedDescriptionKey]) !=  nil)
+ 		NSWarnLog(@"Description - %@", string);
+ 
+@@ -355,7 +355,7 @@
+ 	index = [indexSet indexGreaterThanIndex: matrix->no_rows - 1];
+ 	if(index != NSNotFound)
+ 		[NSException raise: NSRangeException 
+-			format: @"Index %d is out of range (%d, %d)", 
++			format: @"Index %"PRIuPTR" is out of range (%d, %"PRIuPTR")",
+ 				index, 0, matrix->no_rows];
+ 
+ 	index = [indexSet firstIndex];
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdGBSWTermIntegrationMethods.m
++++ adun.app/Kernel/AdunKernel/Framework/AdGBSWTermIntegrationMethods.m
+@@ -335,7 +335,7 @@
+ 		}
+ 		else
+ 		{
+-			NSWarnLog(@"Error - Atom %d is not a neighbour of its nearest grid point", i);
++			NSWarnLog(@"Error - Atom %"PRIuPTR" is not a neighbour of its nearest grid point", i);
+ 			retval = NO;
+ 			break;
+ 		}
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdIndexSetConversions.m
++++ adun.app/Kernel/AdunKernel/Framework/AdIndexSetConversions.m
+@@ -171,7 +171,7 @@
+ 	}
+ 
+ 	indexSet = [NSIndexSet indexSetFromRangeArray: rangeArray ofLength: length];
+-	NSDebugLLog(@"AdIndexSetConversions", @"Decoded %d bytes. complete", length);
++	NSDebugLLog(@"AdIndexSetConversions", @"Decoded %"PRIuPTR" bytes. complete", length);
+ 
+ 	if([self isMemberOfClass: [NSMutableIndexSet class]])
+ 	{
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunCellListHandler.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunCellListHandler.m
+@@ -244,7 +244,7 @@
+ 			cellContentsArray->array = new;
+ 			
+ 			if(j != cellContentsArray->length)
+-				NSWarnLog(@"Warning %d %d", j, cellContentsArray->length);
++				NSWarnLog(@"Warning %"PRIuPTR" %"PRIuPTR"", j, cellContentsArray->length);
+ 
+ 			//add to new array
+ 			
+@@ -376,7 +376,7 @@
+ 			[system systemName], cutoff, [nonbondedList listCount]];
+ 		[description appendFormat: @"\tSpace dimensions: (%10.5lf, %10.5lf, %10.5lf)\n",	
+ 			cellSpaceDimensions.vector[0], cellSpaceDimensions.vector[1], cellSpaceDimensions.vector[2]];
+-		[description appendFormat: @"\tCells per axis: (%d, %d, %d)\n",
++		[description appendFormat: @"\tCells per axis: (%"PRIuPTR", %"PRIuPTR", %"PRIuPTR")\n",
+ 			cellsPerAxis[0], cellsPerAxis[1], cellsPerAxis[2]];		
+ 	}
+ 	else
+@@ -442,7 +442,7 @@
+ 	interactionsEnum = [interactions objectEnumerator];
+ 
+ 	NSDebugLLog(@"AdCellListHandler",
+-		@"There are %d interactions for system %@", [interactions count], [system systemName]);
++		@"There are %"PRIuPTR" interactions for system %@", [interactions count], [system systemName]);
+ 	while((interaction = [interactionsEnum nextObject]))
+ 	{
+ 		if(([interaction count] == 0))
+@@ -1004,7 +1004,7 @@
+  * Delgate
+  */
+ 
+-- (void) setDelegate: (id) anObject;
++- (void) setDelegate: (id) anObject
+ {
+ 	if(![anObject conformsToProtocol: @protocol(AdListHandlerDelegate)])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -1116,7 +1116,7 @@
+ 	cellsPerAxis[1] = (int)ceil(cellSpaceDimensions.vector[1]/cellSize);
+ 	cellsPerAxis[2] = (int)ceil(cellSpaceDimensions.vector[2]/cellSize);
+ 
+-	NSDebugLLog(@"AdCellListHandler", @"Cells per axis: %d %d %d", 
++	NSDebugLLog(@"AdCellListHandler", @"Cells per axis: %"PRIuPTR" %"PRIuPTR" %"PRIuPTR"",
+ 			cellsPerAxis[0], 
+ 			cellsPerAxis[1],
+ 			cellsPerAxis[2]);
+@@ -1185,7 +1185,7 @@
+ 	for(numberOfCells=1, i=0; i<3; i++)
+ 		numberOfCells *= cellsPerAxis[i]; 
+ 
+-	NSDebugLLog(@"AdCellListHandler", @"Creating the cell matrices. There are %d cells", numberOfCells);
++	NSDebugLLog(@"AdCellListHandler", @"Creating the cell matrices. There are %"PRIuPTR" cells", numberOfCells);
+ 	
+ 	cellCenterMatrix = [memoryManager allocateMatrixWithRows: numberOfCells withColumns: 3];
+ 	cellIndexMatrix = [memoryManager allocateMatrixWithRows: numberOfCells withColumns: 3];
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunContainerDataSource.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunContainerDataSource.m
+@@ -339,7 +339,7 @@
+ 	currentNumberOfMolecules = solventDensity*[gridDelegate cavityVolume]/solventMass;
+ 	atomsPerMolecule = [singleMoleculeConfiguration numberOfRows];
+ 	NSDebugLLog(@"AdContainerDataSource",
+-		@"Current number of molecules %d. Atoms per molecule %d.", 
++		@"Current number of molecules %"PRIuPTR". Atoms per molecule %d.",
+ 		currentNumberOfMolecules, atomsPerMolecule);
+ }
+ 
+@@ -355,7 +355,7 @@
+ 	AdMatrix* gridMatrix;	
+ 
+ 	NSDebugLLog(@"AdContainerDataSource",
+-		@"Choosing grid_points for %d molecules.\n", 
++		@"Choosing grid_points for %"PRIuPTR" molecules.\n",
+ 		currentNumberOfMolecules);
+ 
+ 	//create an array of size grid_points, containing the numbers between 0 and grid_points
+@@ -689,7 +689,7 @@
+ 	return [[groupProperties copy] autorelease];
+ }
+ 
+-- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction
+ {
+ 	if(![interactions containsObject: interaction])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -699,7 +699,7 @@
+ 			copy] autorelease];
+ }
+ 
+-- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction
+ {
+ 	if(![interactions containsObject: interaction])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -709,7 +709,7 @@
+ 			copy] autorelease];
+ }
+ 
+-- (NSString*) categoryForInteraction: (NSString*) interaction;
++- (NSString*) categoryForInteraction: (NSString*) interaction
+ {
+ 	NSEnumerator* categoryEnum;
+ 	id category;
+@@ -824,7 +824,7 @@
+ -(void) _removeAtomsWithIndexes: (NSIndexSet*) indexes
+ {
+ 	NSDebugLLog(@"AdContainerDataSource", @"Clearing the current system");
+-	NSDebugLLog(@"AdContainerDataSource", @"There are %d current molecules", currentNumberOfMolecules);
++	NSDebugLLog(@"AdContainerDataSource", @"There are %"PRIuPTR" current molecules", currentNumberOfMolecules);
+ 
+ 	[elementConfiguration removeRowsWithIndexes: indexes];
+ 	currentNumberOfMolecules = [elementConfiguration numberOfRows]/atomsPerMolecule;
+@@ -969,7 +969,7 @@
+ 	[memoryManager freeMatrix: coordinates];
+ 
+ 	NSDebugLLog(@"AdContainerDataSource", 
+-		@"Current number of molecules %d. Number removed %d. Number of atoms %d", 
++		@"Current number of molecules %"PRIuPTR". Number removed %d. Number of atoms %d",
+ 		currentNumberOfMolecules, 
+ 		numberRemovedMolecules,
+ 		[elementConfiguration numberOfRows]);
+@@ -990,7 +990,7 @@
+ 	numberOccludedMolecules -= j;
+ 	
+ 	NSDebugLLog(@"AdContainerDataSource",
+-		@"There are now %d molecules and %d occluded molecules", 
++		@"There are now %"PRIuPTR" molecules and %d occluded molecules",
+ 		currentNumberOfMolecules, 
+ 		numberOccludedMolecules);
+ 	
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunDataSet.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunDataSet.m
+@@ -41,7 +41,7 @@
+ 			inputReferences: nil];
+ }
+ 
+--(id) initWithName: (NSString*) aString inputReferences: (NSDictionary*) aDict;
++-(id) initWithName: (NSString*) aString inputReferences: (NSDictionary*) aDict
+ {
+ 	return [self initWithName: aString
+ 		inputReferences: aDict
+@@ -145,7 +145,7 @@
+ 	return [dataMatrices valueForKey: @"name"];
+ }
+ 
+-- (BOOL) containsDataMatrix: (AdDataMatrix*) aDataMatrix;
++- (BOOL) containsDataMatrix: (AdDataMatrix*) aDataMatrix
+ {
+ 	if([dataMatrices indexOfObject: aDataMatrix] != NSNotFound)
+ 		return YES;
+@@ -153,7 +153,7 @@
+ 		return NO;
+ }
+ 
+-- (BOOL) containsDataMatrixWithName: (NSString*) aString;
++- (BOOL) containsDataMatrixWithName: (NSString*) aString
+ {
+ 	AdDataMatrix* dataMatrix;
+ 
+@@ -252,10 +252,10 @@
+ 
+ 	[string appendFormat: @"%@\n", [self name]];
+ 	if([dataMatrices count] == 1)
+-		[string appendFormat: @"\nContains %d data matrix\n\n", 
++		[string appendFormat: @"\nContains %"PRIuPTR" data matrix\n\n",
+ 			[dataMatrices count]];
+ 	else
+-		[string appendFormat: @"\nContains %d data matrices\n\n", 
++		[string appendFormat: @"\nContains %"PRIuPTR" data matrices\n\n",
+ 			[dataMatrices count]];
+ 
+ 	matrixEnum = [dataMatrices objectEnumerator];
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunDynamics.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunDynamics.m
+@@ -401,7 +401,7 @@
+ 
+ //AdMatrixModification
+ 
+-- (BOOL) allowsDirectModificationOfMatrix: (AdMatrix*) matrix;
++- (BOOL) allowsDirectModificationOfMatrix: (AdMatrix*) matrix
+ {
+ 	if(matrix == coordinates || matrix == velocities)
+ 		return YES;
+@@ -414,7 +414,7 @@
+ acquire it we return NO. If we do aquire we
+ immediatly unlock it and return YES.
+ */
+-- (BOOL) matrixIsAvailableForModification: (AdMatrix*) matrix;
++- (BOOL) matrixIsAvailableForModification: (AdMatrix*) matrix
+ {
+ 	NSLock* lock;
+ 
+@@ -435,7 +435,7 @@
+ 
+ }
+ 
+-- (void) object: (id) object willBeginWritingToMatrix: (AdMatrix*) matrix;
++- (void) object: (id) object willBeginWritingToMatrix: (AdMatrix*) matrix
+ {
+ 	if(matrix == coordinates)
+ 	{
+@@ -449,7 +449,7 @@
+ 	return;
+ }
+ 
+-- (void) object: (id) object didFinishWritingToMatrix: (AdMatrix*) matrix;
++- (void) object: (id) object didFinishWritingToMatrix: (AdMatrix*) matrix
+ {
+ 	if(matrix == coordinates)
+ 	{
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunEllipsoidBox.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunEllipsoidBox.m
+@@ -38,7 +38,7 @@
+ 
+ - (id) initWithALength: (double) l1
+ 	bLength: (double) l2
+-	cLength: (double) l3;
++	cLength: (double) l3
+ {
+ 	return [self initWithCavityCentre: nil
+ 		aLength: l1
+@@ -49,7 +49,7 @@
+ - (id) initWithCavityCentre: (NSArray*) array
+ 	aLength: (double) l1
+ 	bLength: (double) l2
+-	cLength: (double) l3;
++	cLength: (double) l3
+ {
+ 	if((self = [super init]))
+ 	{
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunForceFieldCollection.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunForceFieldCollection.m
+@@ -178,7 +178,7 @@
+ 	}	
+ }
+ 
+-- (void) deactivateForceField: (AdForceField*) aForceField;
++- (void) deactivateForceField: (AdForceField*) aForceField
+ {
+ 	if(![self isMember: aForceField])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -191,7 +191,7 @@
+ 	}	
+ }
+ 
+-- (BOOL) isActive: (AdForceField*) aForceField;
++- (BOOL) isActive: (AdForceField*) aForceField
+ {
+ 	if(![self isMember: aForceField])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -200,15 +200,15 @@
+ 	return [activeForceFields containsObject: aForceField];	
+ }
+ 
+-- (BOOL) isMember: (AdForceField*) aForceField;
++- (BOOL) isMember: (AdForceField*) aForceField
+ {
+ 	return [forceFields containsObject: aForceField];
+ }
+ 
+ - (NSString*) description
+ {
+-	return [NSString stringWithFormat: @"Force-Field collection containing %d force-field(s)\n" 
+-			@"%d active, %d inactive", 
++	return [NSString stringWithFormat: @"Force-Field collection containing %"PRIuPTR" force-field(s)\n"
++			@"%"PRIuPTR" active, %"PRIuPTR" inactive",
+ 			[forceFields count], [activeForceFields count], [inactiveForceFields count]];
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunGRFNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunGRFNonbondedTerm.m
+@@ -384,7 +384,7 @@
+  * Force & Potential Calculation
+  */
+ 
+-- (void) evaluateForces;
++- (void) evaluateForces
+ {
+ 	ListElement* list_p;
+ 	AdMatrix* coordinates;
+@@ -453,7 +453,7 @@
+ 	NSWarnLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+ 
+-- (void) evaluateEnergy;
++- (void) evaluateEnergy
+ {
+ 	ListElement* list_p;
+ 	AdMatrix* coordinates;
+@@ -656,7 +656,7 @@
+ 			format: @"Matrix cannot be NULL"];
+ 	else if(matrix->no_rows != numberOfElements)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Matrix has incorrect number of rows (%d - required %d)",
++			format: @"Matrix has incorrect number of rows (%"PRIuPTR" - required %"PRIuPTR")",
+ 			matrix->no_rows, numberOfElements];
+ 	else if(matrix->no_columns != 3)
+ 		[NSException raise: NSInvalidArgumentException
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunGrid.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunGrid.m
+@@ -74,7 +74,7 @@
+ 			cavityPoints++;
+ 		}
+ 
+-	NSDebugLLog(@"AdGrid", @"There are %d points in the cavity", cavityPoints);
++	NSDebugLLog(@"AdGrid", @"There are %"PRIuPTR" points in the cavity", cavityPoints);
+ 
+ 	newGrid = [memoryManager allocateMatrixWithRows: cavityPoints withColumns: 3];
+ 	for(i=0; i<cavityPoints; i++)
+@@ -96,7 +96,7 @@
+ 	for(gridPoints = 1, i=0; i<3; i++)
+ 		gridPoints *= ticksPerAxis[i]; 
+ 	
+-	NSDebugLLog(@"AdGrid", @"Number of grid points is %d.\n", gridPoints);
++	NSDebugLLog(@"AdGrid", @"Number of grid points is %"PRIuPTR".\n", gridPoints);
+ 
+ 	//first we create the grid in the (+,+,+) sector. Then we move it so its
+ 	//centred on the origin
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunLinkedList.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunLinkedList.m
+@@ -341,7 +341,7 @@
+ - (void) stats
+ {
+ 	NSLog(@"Freed elements count is %d.", freeElementsCount);
+-	NSLog(@"Count from array %d", [freeElements count]);
++	NSLog(@"Count from array %"PRIuPTR"", [freeElements count]);
+ 	NSLog(@"Number of elements in the list %d", listCount);
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMemoryManager.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMemoryManager.m
+@@ -217,7 +217,7 @@
+ 	if(MEMORY_STATS==YES)
+ 	{
+ 		mem_struct = mallinfo2();
+-		NSLog(@"Before Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
++		NSLog(@"Before Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %zu",
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+ 			(float)mem_struct.uordblks/(float)MEM_CON, 
+@@ -237,7 +237,7 @@
+ 	if(MEMORY_STATS==YES)
+ 	{
+ 		mem_struct = mallinfo2();
+-		NSLog(@"After Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
++		NSLog(@"After Matrix Alloc - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %zu",
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+ 			(float)mem_struct.uordblks/(float)MEM_CON, 
+@@ -355,7 +355,7 @@
+ 	if(MEMORY_STATS==YES)
+ 	{
+ 		mem_struct = mallinfo2();
+-		NSLog(@"Before Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
++		NSLog(@"Before Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %zu",
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+ 			(float)mem_struct.uordblks/(float)MEM_CON, 
+@@ -374,7 +374,7 @@
+ 	if(MEMORY_STATS==YES)
+ 	{
+ 		mem_struct = mallinfo2();
+-		NSLog(@"After Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %lf", 
++		NSLog(@"After Matrix free - Arena : %lf MB. Hblks : %lf MB. Uordblocks %lf MB. Fordblocks %zu",
+ 			(float)mem_struct.arena/(float)MEM_CON, 
+ 			(float)mem_struct.hblkhd/(float)MEM_CON, 
+ 			(float)mem_struct.uordblks/(float)MEM_CON, 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunMinimiser.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunMinimiser.m
+@@ -473,7 +473,7 @@
+ 	return absoluteTolerance; 
+ }
+ 
+-- (void) setAbsoluteTolerance: (double) aDouble;
++- (void) setAbsoluteTolerance: (double) aDouble
+ {
+ 	absoluteTolerance = fabs(aDouble);
+ }
+@@ -506,7 +506,7 @@
+ 	//Check they are the right dimension
+ 	if((int)[aMatrix numberOfRows] != 3*numberOfElements)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Constraint matrix has incorrect number of rows (%@, Expected - %d)"
++			format: @"Constraint matrix has incorrect number of rows (%u, Expected - %d)"
+ 				,[aMatrix numberOfRows], numberOfElements*3];
+ 	
+ 	//Remove any previous constraints set for system (if any)
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunModelObject.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunModelObject.m
+@@ -681,12 +681,12 @@
+ 	return [volatileMetadata objectForKey: aString];
+ }
+ 
+-- (void) setValue: (id) value forVolatileMetadataKey: (NSString*) aString;
++- (void) setValue: (id) value forVolatileMetadataKey: (NSString*) aString
+ {
+ 	[volatileMetadata setObject: value forKey: aString];
+ }
+ 
+-- (void) removeVolatileMetadataKey: (NSString*) aString;
++- (void) removeVolatileMetadataKey: (NSString*) aString
+ {
+ 	[volatileMetadata removeObjectForKey: aString];
+ }
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunNonbondedTerm.m
+@@ -43,12 +43,12 @@
+ 	return nil;
+ }
+ 
+-- (void) clearForces;
++- (void) clearForces
+ {
+ 	NSLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+ 
+-- (void) evaluateForces;
++- (void) evaluateForces
+ {
+ 	NSLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+@@ -73,7 +73,7 @@
+ 	NSLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+ 
+-- (void) evaluateEnergy;
++- (void) evaluateEnergy
+ {
+ 	NSLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunPureNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunPureNonbondedTerm.m
+@@ -354,7 +354,7 @@
+  * Force & Potential Calculation
+  */
+ 
+-- (void) evaluateForces;
++- (void) evaluateForces
+ {
+ 	ListElement* list_p;
+ 	double electrostaticConstant;
+@@ -421,7 +421,7 @@
+ 	NSWarnLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+ 
+-- (void) evaluateEnergy;
++- (void) evaluateEnergy
+ {
+ 	ListElement* list_p;
+ 	double electrostaticConstant;
+@@ -658,7 +658,7 @@
+ 			format: @"Matrix cannot be NULL"];
+ 	else if(matrix->no_rows != numberOfElements)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Matrix has incorrect number of rows (%d - required %d)",
++			format: @"Matrix has incorrect number of rows (%"PRIuPTR" - required %"PRIuPTR")",
+ 			matrix->no_rows, numberOfElements];
+ 	else if(matrix->no_columns != 3)
+ 		[NSException raise: NSInvalidArgumentException
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunSCAAS.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunSCAAS.m
+@@ -95,7 +95,7 @@
+ 
+ - (double) _calculatePolarisationAngleOf: (int*)molecule 
+ 		withCenterOfMass: (Vector3D*) CoM 
+-		dipoleVector: (Vector3D*) dipole;
++		dipoleVector: (Vector3D*) dipole
+ {
+ 	int i,j;
+ 	double angle;	
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunShiftedNonbondedTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunShiftedNonbondedTerm.m
+@@ -360,7 +360,7 @@
+  * Force & Potential Calculation
+  */
+ 
+-- (void) evaluateForces;
++- (void) evaluateForces
+ {
+ 	ListElement* list_p;
+ 	double electrostaticConstant;
+@@ -428,7 +428,7 @@
+ 	NSWarnLog(@"Method (%@) not implemented", NSStringFromSelector(_cmd));
+ }
+ 
+-- (void) evaluateEnergy;
++- (void) evaluateEnergy
+ {
+ 	ListElement* list_p;
+ 	double electrostaticConstant;
+@@ -640,7 +640,7 @@
+ 			format: @"Matrix cannot be NULL"];
+ 	else if(matrix->no_rows != numberOfElements)
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Matrix has incorrect number of rows (%d - required %d",
++			format: @"Matrix has incorrect number of rows (%"PRIuPTR" - required %"PRIuPTR"",
+ 			matrix->no_rows, numberOfElements];
+ 	else if(matrix->no_columns != 3)
+ 		[NSException raise: NSInvalidArgumentException
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunSimpleListHandler.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunSimpleListHandler.m
+@@ -268,7 +268,7 @@
+  * Delgate
+  */
+ 
+-- (void) setDelegate: (id) anObject;
++- (void) setDelegate: (id) anObject
+ {
+ 	if(![anObject conformsToProtocol: @protocol(AdListHandlerDelegate)])
+ 		[NSException raise: NSInvalidArgumentException
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunSmoothedGBTerm.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunSmoothedGBTerm.m
+@@ -434,7 +434,7 @@
+ 	return YES;
+ }
+ 
+-- (BOOL) canEvaluateForces;
++- (BOOL) canEvaluateForces
+ {
+ 	return YES;
+ }
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunSystem.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunSystem.m
+@@ -126,7 +126,7 @@
+ 	[dynamics moveCentreOfMassToOrigin];
+ }
+ 
+-- (NSArray*) centre;
++- (NSArray*) centre
+ {
+ 	int i;
+ 	Vector3D com;
+@@ -140,7 +140,7 @@
+ 	return array;		
+ }
+ 
+-- (void) setCentre: (NSArray*) point;
++- (void) setCentre: (NSArray*) point
+ {
+ 	int i;
+ 	double p[3];
+@@ -197,12 +197,12 @@
+ 	[dynamics reinitialiseVelocities];
+ }	
+ 
+-- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) groupsForInteraction: (NSString*) interaction
+ {
+ 	return [dataSource groupsForInteraction: interaction];
+ }
+ 
+-- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction;
++- (AdDataMatrix*) parametersForInteraction: (NSString*) interaction
+ {
+ 	return [dataSource parametersForInteraction: interaction];
+ }
+@@ -231,7 +231,7 @@
+ 	mementoMask = mask;
+ }
+ 
+-- (void) returnToState: (id) stateMemento;
++- (void) returnToState: (id) stateMemento
+ {
+ 	int captureMask;
+ 	AdMatrix* matrixStruct;
+@@ -276,7 +276,7 @@
+ 	}
+ }
+ 
+-- (id) captureState;
++- (id) captureState
+ {
+ 	AdDataSet* mementoData;
+ 	AdDataMatrix* matrix;
+@@ -436,22 +436,22 @@
+ 
+ //AdMatrixModification
+ 
+-- (BOOL) allowsDirectModificationOfMatrix: (AdMatrix*) matrix;
++- (BOOL) allowsDirectModificationOfMatrix: (AdMatrix*) matrix
+ {
+ 	return [dynamics allowsDirectModificationOfMatrix: matrix]; 
+ }
+ 
+-- (BOOL) matrixIsAvailableForModification: (AdMatrix*) matrix;
++- (BOOL) matrixIsAvailableForModification: (AdMatrix*) matrix
+ {
+ 	return [dynamics matrixIsAvailableForModification: matrix];
+ }
+ 
+-- (void) object: (id) object willBeginWritingToMatrix: (AdMatrix*) matrix;
++- (void) object: (id) object willBeginWritingToMatrix: (AdMatrix*) matrix
+ {
+ 	[dynamics object: object willBeginWritingToMatrix: matrix];
+ }
+ 
+-- (void) object: (id) object didFinishWritingToMatrix: (AdMatrix*) matrix;
++- (void) object: (id) object didFinishWritingToMatrix: (AdMatrix*) matrix
+ {
+ 	int i;
+ 
+--- adun.app.orig/Kernel/AdunKernel/Framework/AdunSystemCollection.m
++++ adun.app/Kernel/AdunKernel/Framework/AdunSystemCollection.m
+@@ -221,7 +221,7 @@
+ 	return [[systems copy] autorelease];
+ }
+ 
+-- (NSArray*) containerSystems;
++- (NSArray*) containerSystems
+ {
+ 	return [[containerSystems copy] autorelease];
+ }
+@@ -246,7 +246,7 @@
+ 		return nil;
+ }
+ 
+-- (NSArray*) interactionSystemsInvolvingSystem: (AdSystem*) aSystem;
++- (NSArray*) interactionSystemsInvolvingSystem: (AdSystem*) aSystem
+ {
+ 	NSEnumerator* interactionSystemsEnum;
+ 	NSMutableArray* array = [NSMutableArray array];
+@@ -262,7 +262,7 @@
+ 
+ - (NSString*) description
+ {
+-	return [NSString stringWithFormat: @"System collection containing %d system(s)\n%d full system(s), %d interaction system(s)",
++	return [NSString stringWithFormat: @"System collection containing %"PRIuPTR" system(s)\n%"PRIuPTR" full system(s), %"PRIuPTR" interaction system(s)",
+ 			[systems count], [fullSystems count], [interactionSystems count]];
+ }
+ 
+--- adun.app.orig/Kernel/AdunKernel/CoreAdditions/AdunIOManager.m
++++ adun.app/Kernel/AdunKernel/CoreAdditions/AdunIOManager.m
+@@ -99,7 +99,7 @@
+  * AdServer instance
+  */
+ 
+-- (BOOL) connectToServer: (NSError**) error;
++- (BOOL) connectToServer: (NSError**) error
+ {
+ 	NSDebugLLog(@"Server", 
+ 		@"Server debug - Attempting to  connecting to AdServer using message ports");
+@@ -1020,7 +1020,7 @@
+ 				format: @"Controller results can only be AdDataSet instances.\
+ 				 This indicates a bug in the controller used."];
+ 			
+-		if([result name] != @"None")
++		if(![[result name] isEqual: @"None"])
+ 			fileName = [result name];
+ 		else
+ 			fileName = [NSString stringWithFormat: @"results%d.out", i];
+@@ -1090,7 +1090,7 @@
+ 	return core;
+ }
+ 
+-- (id) execute: (NSDictionary*) commandDict error: (NSError**) errorResult;
++- (id) execute: (NSDictionary*) commandDict error: (NSError**) errorResult
+ {
+ 	NSString* command;
+ 	SEL commandSelector;
+@@ -1151,7 +1151,7 @@
+ 	return result;
+ }
+ 
+-- (NSMutableDictionary*) optionsForCommand: (NSString*) command;
++- (NSMutableDictionary*) optionsForCommand: (NSString*) command
+ {
+ 	return [core optionsForCommand: command];
+ }
+--- adun.app.orig/Kernel/AdunKernel/CoreAdditions/AdunSimulationData.m
++++ adun.app/Kernel/AdunKernel/CoreAdditions/AdunSimulationData.m
+@@ -26,7 +26,7 @@
+ 
+ @implementation AdSimulationData
+ 
+-- (void) _loadStateData: (NSData*) data;
++- (void) _loadStateData: (NSData*) data
+ {	
+ 	NSDebugLLog(@"AdSimulationData", @"Load Energies...");	
+ 	stateData = [NSKeyedUnarchiver unarchiveObjectWithData: data];
+@@ -323,7 +323,7 @@
+ 		return string;
+ 	}	
+ 	
+-	[string appendFormat: @"%d System(s):\n\n",
++	[string appendFormat: @"%"PRIuPTR" System(s):\n\n",
+ 		[[systemCollection allSystems] count]];
+ 	systemEnum = [[systemCollection allSystems] objectEnumerator];
+ 	while((system = [systemEnum nextObject]))
+@@ -443,11 +443,11 @@
+ 	end = NSMaxRange(range);
+ 	if(end > (int)[frames numberOfRows])
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Specified range (%d,%d) falls outside the available frames %d",
++			format: @"Specified range (%"PRIuPTR",%"PRIuPTR") falls outside the available frames %d",
+ 			range.location, range.length, [frames numberOfRows]];
+ 	
+ 	NSDebugLLog(@"AdSimulationData", 
+-		@"Searching range %d-%d for data source", 
++		@"Searching range %"PRIuPTR"-%d for data source",
+ 		range.location, end);
+ 	dataSource = nil;
+ 	for(i = ([self numberTopologyCheckpoints] - 1); i>=0; i++ )
+@@ -864,7 +864,7 @@
+ 	{
+ 		[dataStorage addTrajectoryCheckpoint: trajectoryData];
+ 		NSDebugLLog(@"AdSimulationDataWriter",
+-			@"Checkpointed %d bytes of trajectory data",
++			@"Checkpointed %"PRIuPTR" bytes of trajectory data",
+ 			[trajectoryData length]);
+ 		[checkpointed addObject: [NSNumber numberWithInt: 1]];
+ 		NSDebugLLog(@"AdSimulationDataWriter",
+@@ -913,7 +913,7 @@
+ 		[archiver release];
+ 		[dataStorage addTopologyCheckpoint: data];
+ 		NSDebugLLog(@"AdSimulationDataWriter",
+-			@"Checkpointed %d bytes of topology data", [data length]);
++			@"Checkpointed %"PRIuPTR" bytes of topology data", [data length]);
+ 		[data release];
+ 		[checkpointed addObject: [NSNumber numberWithInt: 1]];
+ 		[topologyData removeAllObjects];
+@@ -1211,7 +1211,7 @@
+ 	[archiver encodeObject: stateData forKey: @"root"];
+ 	[archiver finishEncoding];
+ 	[dataStorage setEnergyData: data];
+-	NSDebugLLog(@"AdSimulationDataWriter", @"Wrote %d bytes of energy data", [data length]);
++	NSDebugLLog(@"AdSimulationDataWriter", @"Wrote %"PRIuPTR" bytes of energy data", [data length]);
+ 	[archiver release];
+ 	[data release];
+ 
+@@ -1221,7 +1221,7 @@
+ 	[archiver encodeObject: frames forKey: @"root"];
+ 	[archiver finishEncoding];
+ 	[dataStorage setFrameData: data];
+-	NSDebugLLog(@"AdSimulationDataWriter", @"Wrote %d bytes of frame data", [data length]);
++	NSDebugLLog(@"AdSimulationDataWriter", @"Wrote %"PRIuPTR" bytes of frame data", [data length]);
+ 	[archiver release];
+ 
+ 	[dataStorage synchronizeStore];
+--- adun.app.orig/Kernel/AdunKernel/CoreAdditions/AdunTrajectory.m
++++ adun.app/Kernel/AdunKernel/CoreAdditions/AdunTrajectory.m
+@@ -38,7 +38,7 @@
+ 
+ @implementation AdTrajectory (DataLoadingMethods)
+ 
+-- (void) _loadStateData: (NSData*) data;
++- (void) _loadStateData: (NSData*) data
+ {	
+ 	NSDebugLLog(@"AdTrajectory", @"Load Energies...");	
+ 	stateData = [NSKeyedUnarchiver unarchiveObjectWithData: data];
+@@ -235,7 +235,7 @@
+ 		if(!AdCompareDoubleMatrices(matrixOne, matrixTwo, 1E-12))
+ 		{	
+ 			retval = NO;
+-			NSWarnLog(@"Detected differences between frame %d", i);
++			NSWarnLog(@"Detected differences between frame %"PRIuPTR"", i);
+ 			break;
+ 		}
+ 	}
+@@ -379,7 +379,7 @@
+ 	}	
+ 	
+ 	[string appendFormat: @"AdTrajectory - location %@ - ", [self dataPath]];
+-	[string appendFormat: @"%d System(s):\n\n",
++	[string appendFormat: @"%"PRIuPTR" System(s):\n\n",
+ 	[[systemCollection allSystems] count]];
+ 	systemEnum = [[systemCollection allSystems] objectEnumerator];
+ 	while((system = [systemEnum nextObject]))
+@@ -494,11 +494,11 @@
+ 	end = NSMaxRange(range);
+ 	if(end > (int)[frames numberOfRows])
+ 		[NSException raise: NSInvalidArgumentException
+-			    format: @"Specified range (%d,%d) falls outside the available frames %d",
++			    format: @"Specified range (%"PRIuPTR",%"PRIuPTR") falls outside the available frames %d",
+ 		 range.location, range.length, [frames numberOfRows]];
+ 	
+ 	NSDebugLLog(@"AdTrajectory", 
+-		    @"Searching range %d-%d for data source", 
++		    @"Searching range %"PRIuPTR"-%d for data source",
+ 		    range.location, end);
+ 	dataSource = nil;
+ 	for(i = ([self numberTopologyCheckpoints] - 1); i>=0; i++ )
+@@ -901,7 +901,7 @@
+ 	{
+ 		[dataStorage addTrajectoryCheckpoint: trajectoryData];
+ 		NSDebugLLog(@"AdMutableTrajectory",
+-			    @"Checkpointed %d bytes of trajectory data",
++			    @"Checkpointed %"PRIuPTR" bytes of trajectory data",
+ 			    [trajectoryData length]);
+ 		[checkpointed addObject: [NSNumber numberWithInt: 1]];
+ 	}
+@@ -943,7 +943,7 @@
+ 		[archiver release];
+ 		[dataStorage addTopologyCheckpoint: data];
+ 		NSDebugLLog(@"AdMutableTrajectory",
+-			    @"Checkpointed %d bytes of topology data", [data length]);
++			    @"Checkpointed %"PRIuPTR" bytes of topology data", [data length]);
+ 		[data release];
+ 		[checkpointed addObject: [NSNumber numberWithInt: 1]];
+ 		[topologyData removeAllObjects];
+@@ -1241,7 +1241,7 @@
+ 	[archiver encodeObject: stateData forKey: @"root"];
+ 	[archiver finishEncoding];
+ 	[dataStorage setEnergyData: data];
+-	NSDebugLLog(@"AdMutableTrajectory", @"Wrote %d bytes of energy data", [data length]);
++	NSDebugLLog(@"AdMutableTrajectory", @"Wrote %"PRIuPTR" bytes of energy data", [data length]);
+ 	[archiver release];
+ 	[data release];
+ 	
+@@ -1251,7 +1251,7 @@
+ 	[archiver encodeObject: frames forKey: @"root"];
+ 	[archiver finishEncoding];
+ 	[dataStorage setFrameData: data];
+-	NSDebugLLog(@"AdMutableTrajectory", @"Wrote %d bytes of frame data", [data length]);
++	NSDebugLLog(@"AdMutableTrajectory", @"Wrote %"PRIuPTR" bytes of frame data", [data length]);
+ 	[archiver release];
+ 	
+ 	[dataStorage synchronizeStore];
+--- adun.app.orig/MolTalk/MTSelection.h
++++ adun.app/MolTalk/MTSelection.h
+@@ -38,7 +38,7 @@
+ }
+ 
+ /* access */
+--(unsigned long)count;
++-(NSUInteger)count;
+ -(NSString*)description;
+ -(NSMutableArray*)getSelection;
+ -(NSEnumerator*)selectedResidues;
+--- adun.app.orig/UL/XMLLib/ULMoleculeNode.m
++++ adun.app/UL/XMLLib/ULMoleculeNode.m
+@@ -107,7 +107,7 @@
+ 
+ -(void) _createBondedAtomsList
+ {
+-	int  bondedIndex;
++	NSUInteger bondedIndex;
+ 	NSMutableArray* bondedAtoms;
+ 	NSArray *atomList;	
+ 	NSEnumerator* rowEnum, *atomEnum;
+--- adun.app.orig/UL/ULFramework/PDBConfigurationBuilder.m
++++ adun.app/UL/ULFramework/PDBConfigurationBuilder.m
+@@ -257,7 +257,7 @@
+ 	NSDebugLLog(@"PDBConfigurationBuilder",
+ 			@"\tSection processed:\nSequence %@\nAtoms %@\nAtoms per Residue %@",
+ 			sequence, atomNames, atomsPerResidue);
+-	[buildString appendFormat: @"\t%d residues\n\t%d atoms\n",
++	[buildString appendFormat: @"\t%"PRIuPTR" residues\n\t%"PRIuPTR" atoms\n",
+ 			[sequence count], [atomNames count]];
+ 
+ 	
+--- adun.app.orig/UL/ULFramework/ULDatabaseInterface.m
++++ adun.app/UL/ULFramework/ULDatabaseInterface.m
+@@ -94,7 +94,7 @@
+ 		clientConfigurations = [NSMutableArray new];
+ 
+ 	[clientConfigurations retain];
+-	backendErrors = [NSMutableArray new];
++	backendErrors = [NSMutableDictionary new];
+ 
+ 	configurationEnum = [clientConfigurations objectEnumerator];
+ 	while((configuration = [configurationEnum nextObject]))
+--- adun.app.orig/UL/ULFramework/ULFileSystemDatabaseBackend.m
++++ adun.app/UL/ULFramework/ULFileSystemDatabaseBackend.m
+@@ -1211,7 +1211,7 @@
+ 	NSDictionary* retval;
+ 	
+ 	if(![self _checkOperation: @"Read" error: error])
+-		return NO;
++		return nil;
+ 
+ 	if(![schema isEqual: @"Local"])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -1267,7 +1267,7 @@
+ 	id index;
+ 	
+ 	if(![self _checkOperation: @"Read" error: error])
+-		return NO;
++		return nil;
+ 
+ 	if(![schema isEqual: @"Local"])
+ 		[NSException raise: NSInvalidArgumentException
+@@ -1289,7 +1289,7 @@
+ 	id index;
+ 	
+ 	if(![self _checkOperation: @"Read" error: error])
+-		return NO;
++		return nil;
+ 
+ 	if(![schema isEqual: @"Local"])
+ 		[NSException raise: NSInvalidArgumentException
+--- adun.app.orig/UL/ULFramework/ULInteractionsBuilder.m
++++ adun.app/UL/ULFramework/ULInteractionsBuilder.m
+@@ -353,7 +353,7 @@
+ 	{
+ 		NSWarnLog(@"Parameters %@. Units %@", parameters, units);
+ 		[NSException raise: NSInvalidArgumentException
+-			format: @"Number of parameters %d does not match number of units %d",
++			format: @"Number of parameters %"PRIuPTR" does not match number of units %"PRIuPTR"",
+ 			[parameters count],
+ 			[units count]];
+ 	}
+@@ -634,7 +634,7 @@
+ 		else	
+ 		{
+ 			[errorString appendString: failString];
+-			[buildString appendFormat: @"\t\tRemoved %d %@ interactions.\nSee errors.\n", 
++			[buildString appendFormat: @"\t\tRemoved %"PRIuPTR" %@ interactions.\nSee errors.\n",
+ 			 [unknownInteractions count],
+ 			 interactionType];
+ 		}
+@@ -895,7 +895,7 @@
+ 		withBondedInteractions: (NSMutableArray*) bondedInteractions 
+ 		withVDWAtoms: (NSMutableArray*) vdwAtomsList
+ {
+-	int i,index;
++	NSUInteger i,index;
+ 	int noAtoms,noTorsions,noList14;
+ 	int firstatm,lastatm, noInteraction14;
+ 	double eps1,eps2,rmin1,rmin2;
+@@ -1100,7 +1100,8 @@
+ 		atomsPerResidue: (NSMutableArray*) atomsPerResidue
+ {
+ 	int i, j, elementsPerInteraction;
+-	int noAtoms, noResidues, index, residueStart, residueEnd;
++	int noAtoms, noResidues, residueStart, residueEnd;
++	NSUInteger index;
+ 	NSMutableArray* nonbonded; 
+ 	NSMutableIndexSet* indexes, *topIndexes, *interactionIndexes;
+ 	NSEnumerator *interactionEnum;
+@@ -1127,7 +1128,7 @@
+ 		index += [[nonbonded objectAtIndex:i] count];
+ 
+ 	NSDebugLLog(@"ULInteractionsBuilder", 
+-		@"There are %d nonbonded interactions before removal", 
++		@"There are %"PRIuPTR" nonbonded interactions before removal",
+ 		index);
+ 
+ 	for(i=0; i<noResidues; i++)
+@@ -1180,7 +1181,7 @@
+ 		index += [[nonbonded objectAtIndex:i] count];
+ 
+ 	GSPrintf(buildOutput, @"There are %d nonbonded interactions\n", index);
+-	[buildString appendFormat: @"\t\tThere are %d nonbonded interactions\n", index];
++	[buildString appendFormat: @"\t\tThere are %"PRIuPTR" nonbonded interactions\n", index];
+ 
+ 	return nonbonded;
+ }
+--- adun.app.orig/UL/ULFramework/ULMerger.m
++++ adun.app/UL/ULFramework/ULMerger.m
+@@ -89,7 +89,7 @@
+ 
+ 	if([missingAtoms count] != 0)
+ 	{
+-		[errorString appendFormat: @"%d residues are missing atoms\n\n", [missingAtoms count]];
++		[errorString appendFormat: @"%"PRIuPTR" residues are missing atoms\n\n", [missingAtoms count]];
+ 		residues = [[missingAtoms allKeys]
+ 				 sortedArrayUsingFunction: residueSort context: NULL];
+ 		residueEnum = [residues objectEnumerator];
+@@ -105,7 +105,7 @@
+ 
+ 	if([extraAtoms count] != 0)
+ 	{
+-		[errorString appendFormat: @"%d residues have unidentified atoms\n\n", [extraAtoms count]];
++		[errorString appendFormat: @"%"PRIuPTR" residues have unidentified atoms\n\n", [extraAtoms count]];
+ 		
+ 		if(([[NSUserDefaults standardUserDefaults] boolForKey: @"VerboseBuildOutput"]) || ([extraAtoms count] <= 2))
+ 		{
+@@ -176,7 +176,7 @@
+ 
+ 	[buildString appendString: @"\nBeginning merge of expected topology and configuration from the \
+ coordinates file.\n"];
+-	[buildString appendFormat: @"Expecting %d atoms based on topology.\nThere are %d atoms in the molecule file.\n",
++	[buildString appendFormat: @"Expecting %"PRIuPTR" atoms based on topology.\nThere are %"PRIuPTR" atoms in the molecule file.\n",
+ 			[frameAtomList count], [confAtomList count]];
+ 	if([frameAtomList count] > [confAtomList count])
+ 		[buildString appendFormat: @"The configuration is missing atoms. There will be errors.\n"];
+--- adun.app.orig/UL/ULFramework/ULProcessManager.m
++++ adun.app/UL/ULFramework/ULProcessManager.m
+@@ -432,7 +432,7 @@
+ 		object: self];
+ 
+ 	NSDebugLLog(@"ULProcessManager",
+-		@"Added process to newStack. Currently %d objects on newStack", 
++		@"Added process to newStack. Currently %"PRIuPTR" objects on newStack",
+ 		[newStack count]);
+ 	NSDebugLLog(@"ULProcessManager", 
+ 		@"New object id %@", 
+--- adun.app.orig/UL/ULFramework/ULSimpleMergerDelegate.m
++++ adun.app/UL/ULFramework/ULSimpleMergerDelegate.m
+@@ -117,11 +117,11 @@
+ 	[configuration setValue: [topologyFrame valueForKey:@"PartialCharges"] forKey: @"PartialCharges"];
+ 	[configuration setValue: [topologyFrame valueForKey:@"BondedAtoms"] forKey: @"BondedAtoms"];
+ 
+-	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %d library names", 
++	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %"PRIuPTR" library names",
+ 			[[configuration valueForKey: @"LibraryNames"] count]);
+-	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %d pdb names",
++	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %"PRIuPTR" pdb names",
+ 			 [[configuration valueForKey: @"AtomNames"] count]);
+-	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %d partial charges", 
++	NSDebugLLog(@"ULSimpleMergerDelegate", @"There are %"PRIuPTR" partial charges",
+ 			[[configuration valueForKey: @"PartialCharges"] count]);
+ 
+ 	return configuration;
+--- adun.app.orig/UL/ULAnalyser.m
++++ adun.app/UL/ULAnalyser.m
+@@ -339,7 +339,7 @@
+ - (NSNumber*) _validateAnalyse: (id) sender
+ {
+ 	if([window isKeyWindow])
+-		return NO;
++		return nil;
+ 	else	
+ 		return [self _validateLoad: sender];
+ }
+@@ -779,7 +779,7 @@
+ 
+ - (void) deselectAllRows: (id) sender
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows;
+ 	
+ 	selectedRows = [loadedObjectsTable selectedRowIndexes];
+@@ -918,7 +918,7 @@
+ - (void) tableViewSelectionDidChange: (NSNotification*) aNotification
+ {
+ 	BOOL containsSimulationData;
+-	int row;
++	NSUInteger row;
+ 	id selectedRows, object;
+ 	
+ 	[selectedObjects removeAllObjects];
+--- adun.app.orig/UL/ULAnalyserDataSetView.m
++++ adun.app/UL/ULAnalyserDataSetView.m
+@@ -298,7 +298,7 @@
+ 	writeRowsWithIndexes: (NSIndexSet*) indexSet
+ 	toPasteboard: (NSPasteboard*) aPasteboard
+ {	
+-	int index;
++	NSUInteger index;
+ 	NSMutableString* string;
+ 	
+ 	string = [NSMutableString string];
+--- adun.app.orig/UL/ULPropertiesPanel.m
++++ adun.app/UL/ULPropertiesPanel.m
+@@ -478,7 +478,7 @@
+ 
+ - (void) tableViewSelectionDidChange: (NSNotification*) aNotification
+ {
+-	int row;
++	NSUInteger row;
+ 	NSDictionary* item;
+ 	NSString* class;
+ 	NSMutableArray* array;
+@@ -530,7 +530,7 @@
+ //Work around for gnustep deselectAll bug
+ - (void) deselectAllRows: (id) sender
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows;
+ 	
+ 	selectedRows = [referenceTable selectedRowIndexes];
+--- adun.app.orig/UL/ULStatusTable.m
++++ adun.app/UL/ULStatusTable.m
+@@ -31,7 +31,7 @@
+ //makes things simpler
+ - (void) deselectAllRows: (id) sender
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows;
+ 	
+ 	selectedRows = [statusTable selectedRowIndexes];
+@@ -357,7 +357,7 @@
+ 
+ - (void) tableViewSelectionDidChange: (NSNotification*) aNotification
+ {
+-	int row;
++	NSUInteger row;
+ 	id selectedRows;
+ 	
+ 	[selectedProcesses removeAllObjects];


=====================================
debian/patches/series
=====================================
@@ -10,3 +10,5 @@ spelling-errors.patch
 check-return-value.patch
 ftbfs-powerpcspe.patch
 gcc-10.patch
+scan-build-errors.patch
+set-delegate-before-source.patch


=====================================
debian/patches/set-delegate-before-source.patch
=====================================
@@ -0,0 +1,18 @@
+Description: Fix crash when switching the NSPopUpButton in the Template window.
+Author: Yavor Doganov <yavor at gnu.org>
+Forwarded: no
+Last-Update: 2024-08-07
+---
+
+--- adun.app.orig/UL/ULTemplateViewController.m
++++ adun.app/UL/ULTemplateViewController.m
+@@ -71,8 +71,8 @@
+ 	outlineDelegate  = [[ULOutlineViewDelegate alloc]
+ 				initWithOptions: menu
+ 				outlineColumnIdentifier: @"Component"];
++	[currentTemplateView setDelegate: outlineDelegate];
+ 	[currentTemplateView setDataSource: outlineDelegate];
+-	[currentTemplateView setDelegate: outlineDelegate];
+ 	[currentTemplateView reloadData];
+ 	[currentTemplateView expandAllItems];
+ }


=====================================
debian/rules
=====================================
@@ -51,23 +51,20 @@ override_dh_auto_install:
 	dh_auto_install -- $(verbose) DESTDIR=$(d_app) \
 	  GNUSTEP_SYSTEM_LIBRARIES=/usr/lib/adun.app \
 	  GNUSTEP_INSTALLATION_DOMAIN=SYSTEM
-	mkdir -p $(d_app)/usr/share/GNUstep
-	mv $(d_app)$(GNUSTEP_SYSTEM_APPS)/UL.app/Resources \
-	   $(d_app)/usr/share/GNUstep/UL.app
-	convert UL/Resources/icon.tiff -resize 64x64 \
-	   $(d_app)/usr/share/GNUstep/UL.app/UL.png
 # Delete empty directories (fixes a lintian warning).
 	rm -r $(d_app)/usr/include/GNUstep/Framework \
-	      $(d_app)/usr/lib/GNUstep/Tools
-# Delete the invalid .desktop file and install ours.
-	rm $(d_app)/usr/share/GNUstep/UL.app/*.desktop
-	find $(d_app)/usr/share/GNUstep/UL.app -type f -exec chmod -x '{}' \;
-	chmod -x $(d_app)/usr/lib/GNUstep/Frameworks/ULFramework.framework/Versions/0/Resources/ForceFields/Enzymix/*.ffml
+	  $(d_app)/usr/lib/GNUstep/Tools
+
+execute_before_dh_link:
+	gsdh_gnustep -padun.app --app
+	gsdh_gnustep -padun-core
+	convert UL/Resources/icon.tiff -resize 64x64 \
+	  debian/adun.app/usr/share/GNUstep/UL.app/UL.png
 
-override_dh_link:
-	gsdh_gnustep
-	dh_link usr/share/GNUstep/UL.app \
-	  $(GNUSTEP_SYSTEM_APPS)/UL.app/Resources
+execute_after_dh_fixperms:
+	find debian/adun.app/usr/share/GNUstep/UL.app -type f \
+	  -exec chmod -x '{}' \;
+	chmod -x debian/adun-core/usr/lib/GNUstep/Frameworks/ULFramework.framework/Versions/0/Resources/ForceFields/Enzymix/*.ffml
 
 # We install the libraries at /usr/lib/adun.app.
 override_dh_makeshlibs:



View it on GitLab: https://salsa.debian.org/med-team/adun-app/-/compare/bb5427b507699a7508cb8d16738ef49ae7c1d7c9...f1bb6a75920a03bb78e5aeec82825dc8f8968d35

-- 
View it on GitLab: https://salsa.debian.org/med-team/adun-app/-/compare/bb5427b507699a7508cb8d16738ef49ae7c1d7c9...f1bb6a75920a03bb78e5aeec82825dc8f8968d35
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240807/47c3f46b/attachment-0001.htm>


More information about the debian-med-commit mailing list