def get_refcode(atoms_filename):
	"""
	Get the name of the MOF

	Args:
		atoms_filename (string): filename of the ASE Atoms object (accepts
		CIFS, POSCARs, and CONTCARs)
		
	Return:
		refcode (string): name of MOF (defaults to 'mof' if the original
		filename is just named CONTCAR or POSCAR)
	"""
	if '.cif' in atoms_filename:
		refcode = atoms_filename.split('.cif')[0]
	elif 'CAR_' in atoms_filename:
		refcode = atoms_filename.split('CAR_')[-1]
	elif '_CAR' in atoms_filename:
		refcode = atoms_filename.split('_CAR')[0]
	elif atoms_filename == 'CONTCAR' or atoms_filename == 'POSCAR':
		refcode = 'mof'
	else:
		raise ValueError('Unknown file naming scheme')
		
	return refcode