build_db.py: Add magnetic ordering