GAP code to calculate the a certain subgroup $E(G)$ of a group I am a research scholar from India.  At present,
I am working on a problem. For this problem,  I need to construct the subgroup
$E(G)$ of a group $G$ in GAP. Please help me. My question is as follows:
Questions:
For any group $G$, the absolute center $L(G)$ of $G$ is defined as
$$L(G) = \lbrace g\in G\mid \alpha(g)=g,\forall\alpha\in Aut(G)
\rbrace,$$ where $Aut(G)$ denote the group of all automorphisms of
$G$. An automorphism $\alpha$ of $G$ is called an absolute central
automorphism if $g^{-1}\alpha(g)\in L(G)$ for all $g\in G$. Let
$Var(G)$ denote the group of all absolute central automorphisms of
$G$. Let
$$C_{Aut(G)}(Var(G))= \lbrace \alpha\in Aut(G)\mid\alpha\beta =
\beta\alpha, \forall\beta \in Var(G)\rbrace$$ denote the centralizer
of $Var(G)$ in $Aut(G)$.
Let $$E(G)=[G,C_{Aut(G)}(Var(G))]=\langle g^{-1}\alpha(g)\mid g\in
G, \alpha\in C_{Aut(G)}(Var(G))\rangle.$$ One can easily see that
$E(G)$ is a characteristic subgroup of $G$ containing the derived
group $G^{\prime}=[G,Inn(G)]$. How to calculate $E(G)$ in GAP? I already have code which calculates $L(G)$. Will this be helpful for calculating $E(G)$?
The GAP code for finding the absolute center $L(G)$ of a group $G$ is written below:
Fusionclass:=function(G,g)
local a,aut,l;
l:=[];
aut:=AutomorphismGroup(G);
for a in aut do
  Add(l,Image(a,g));
od;
return Set(l);
end;

autocenter:=function(G)
local M,N,g;
M:=Filtered(G,g->Size(Fusionclass(G,g))=1);
N:=Subgroup(G,M);
return N;
end;

 A: Since you only want fusion classes of size 1, it should be quicker to find the elements of the center that are fixed under automorphisms:
autocenter:=function(G)
local z,au,N,x;
  z:=Centre(G);
  au:=AutomorphismGroup(G);
  N:=TrivialSubgroup(G);
  for x in Elements(z) do
    if not x in N
      and ForAll(GeneratorsOfGroup(au),a->ImagesRepresentative(a,x)=x) then
      N:=ClosureGroup(N,x);
    fi;
  od;
  return N;
end;

Then the next task will be to check that an automorphism is almost central. Since you state that this test is sufficient on generators, this is easy to implement:
IsAlmostCentral:=function(a,G)
local L;
  L:=autocenter(G);
  return ForAll(GeneratorsOfGroup(G),g->g^-1*ImagesRepresentative(a,g) in L);
end;

Next you'll need to find $Var(G)$, that is you need to run through $Aut(G)$ and collect the elements that are almost central, and calculate its centralizer and so on.
Implementingthis will not bve hard, based on what I have already shown and will help you get some practice in GAP. Feel free to post another question with your code if you have problems with that.
A: @ahulpke.... With your suggestions, the GAP code to calculate $Var(G)$ has been constructed and is given below:
IsAlmostCentral:=function(G)

local L;

result:=[];

  L:=autocenter(G);

 aut:=AutomorphismGroup(G);

 for a in aut do

  result:=ForAll(GeneratorsOfGroup(G),g->g^-1*ImagesRepresentative(a,g) in L);

  if result = true then

  Print(a,"\n");

  fi;

  od;

end;

Now please guide me how to calculate the centralizer of $Var(G)$ in $Aut(G)$ and next how to calculate $E(G)$.
