NikNaks: https://github.com/Nak2/NikNaks
This would help increase performance at least a little bit, and doesn't require much work to integrate.
local oldLeaf
local bsp = NikNaks.Map()
local endPosVector = Vector(0, 0, 32768)
-- NOTE: helper for checking if a position is outside of a building
function atmos_outside(pos)
	if !bsp then bsp = NikNaks.Map() end
	local leaf = bsp:PointInLeafCache(0, pos, oldLeaf)
	oldleaf = leaf -- this shouldn't cause issues even though this is a shared function
	local trace = {}
	trace.start = pos
	trace.endpos = trace.start + endPosVector
	trace.mask = MASK_SOLID
	local tr = util.TraceLine(trace)
	Atmos.HeightMin = (tr.HitPos - pos):Length() -- how do we replicate this in NikNaks without doing a trace?
	return leaf:IsOutsideMap()
end