You might consider putting the "type" label inside an Association itself. This will complicate key addressing but simplify other handling.
asc = <|"atomData" ->
<|"Atom Names" -> {"N", "C", "O", "C", "H", "H"},
"Atom Nr" -> {56, 23, 117, 81, 211, 5},
"Resname" -> {ALA, ALA, TYR, LEU, GLY, GLY},
"Bias Value" -> {1, 5, 1, 5, 1, 1},
"getRandomAtom" :> RandomChoice[{56, 23, 117, 81, 211, 5}],
"atomExists" :> (MemberQ[{"N", "C", "O", "C", "H", "H"}, #] &)|>|>;
aDtest[a_Association /; Keys[a] === {"atomData"}] := True;
f1[a_?aDtest, args__] := a[[1]]["getRandomAtom"] + Total[a[[1]]["Atom Nr"]]
f1[asc, 2]
549
Using a[[1]]
each time is only one way to approach this; others include:
f1[aa_?aDtest, args__] :=
With[{a = aa[[1]]}, a["getRandomAtom"] + Total[a["Atom Nr"]]]
Or:
f1[a_?aDtest, args__] := f1core[a[[1]], args]
f1core[a_, args__] := a["getRandomAtom"] + Total[a["Atom Nr"]]
For Mathematica&Mathematica 10.4 or later
The method above can be improved for recent versions of Mathematica as follows:
ClearAll[f1]
p1 = <|"atomData" -> a_|>;
f1[p1, args__] := a["getRandomAtom"] + Total[a["Atom Nr"]]
f1[asc, 2]
549
Reference: