(* simple example problem *)
NewmarkTest[β_, γ_, dt_, control_] := Module[{history},
U2[t_] := 0.25 Sin[2π t];
t=0;
u=U2[t];
dudt=U2'[t];
d2udt2=0;
history = {dudt};
Do[
t+=dt;
u+=dudt*dt+((1/2)-β)d2udt2*dt*dt;
dudt+=(1-γ)d2udt2*dt;
If[control === "direct",
d2udt2=(U2[t]-u)/(β dt dt)
,
d2udt2=(U2'[t]-dudt)/(γ dt);
];
u+=β d2udt2 dt dt;
dudt+=γ d2udt2*dt;
AppendTo[history,dudt];
,
{i,1,(1/dt)}
];
history
]

(*stable*)
ListPlot[NewmarkTest[β = 1/4, γ=1/2, dt=0.025, "direct"], DataRange->1]

(*unstable*)
ListPlot[NewmarkTest[β = 1/6, γ=1/2, dt=0.025, "direct"], DataRange->1]

(*stable*)
ListPlot[NewmarkTest[β = 1/4, γ=1/2, dt=0.025, "rate"], DataRange->1]

(*stable*)
ListPlot[NewmarkTest[β = 1/6, γ=1/2, dt=0.025, "rate"], DataRange->1]