#how to read the tram file is a second step problem#

#the part where I recognize the molecular pairs that are in the same cluster#

for (t = 0; t < tram; t++) #t is associated to time steps
{
	for (i = 0; i < EAN; i++) #i is Just an index, EAN means “the number of  molecules”
	{
		for (J = 0; J < EAN; J++) #J is Just an index, EAN means “the number of  molecules”
		{
			if (i != J)
			{
				if (distance(EANm[i]; EANm[J]) <= limit) #distance is a function that calculate the distance of two points in space. EANm is an array with the identifiers of the various molecules
				{
					h [t] [i] [J] = true #h is a 3d matrix in which are saved booleans value for the molecular pairs. True means that the pair is in the same cluster, False that is not.
				}
				else
				{
					h [t] [i] [J] = false
				}
			}
		}
	}
}

#now the problem of “if A is in the same cluster as B and B is in the cluster with C, so C and A are in the same cluster”

#I propose this

for (t = 0; t < tram; t++) 
{
	for (i = 0; i < EAN; i++) 
	{
		for (J = 0; J < EAN; J++) 
		{
			if (h [t] [i] [J])
			{
				N [t] [i] [J] = true #N is a 3d matrix in which are saved booleans value. True values means that the i-J pair are in the same cluster even if they are not directly “bonded”
				for (u = 0; u < EAN; u++)
				{
					if (h [t] [J] [u])
					{
						N [t] [i] [u] = true
					}
				}
			}
		}
	}
}