def test_Mcsqs_Caller_supercell(self): struc = self.struc.copy() struc.replace_species({ 'Ti': { 'Ti': 0.5, 'Zr': 0.5 }, 'Zr': { 'Ti': 0.5, 'Zr': 0.5 } }) sqs = run_mcsqs(struc, { 2: 6, 3: 4 }, supercell=[2, 1, 1], total_atoms=None, search_time=0.01) self.assertEqual(atat.Mcsqs(sqs).to_string() in self.pztstrings, True) os.remove('sqscell.out') os.remove('rndstrgrp.out') os.remove('bestcorr.out') os.remove('rndstr.in') os.remove('sym.out') os.remove('mcsqs.log') os.remove('bestsqs.out') os.remove('clusters.out')
def test_mcsqs_caller_total_atoms_auto_instances(self): struc = self.struc.copy() struc.replace_species({"Ti": {"Ti": 0.5, "Zr": 0.5}, "Zr": {"Ti": 0.5, "Zr": 0.5}}) sqs = run_mcsqs(struc, {2: 6, 3: 4}, scaling=2, search_time=0.01, instances=None) matches = [sqs.bestsqs.matches(s) for s in self.pztstructs2] self.assertIn(True, matches)
def test_mcsqs_caller_supercell(self): struc = self.struc.copy() struc.replace_species({ "Ti": { "Ti": 0.5, "Zr": 0.5 }, "Zr": { "Ti": 0.5, "Zr": 0.5 } }) sqs = run_mcsqs(struc, { 2: 6, 3: 4 }, scaling=[2, 1, 1], search_time=0.01, instances=1) matches = [sqs.bestsqs.matches(s) for s in self.pztstructs] self.assertIn(True, matches) self.assertIsInstance(sqs.bestsqs, Structure) # ensures specific keys are present in cluster parsing for use in atomate self.assertSetEqual( set(sqs.clusters[0].keys()), { "multiplicity", "coordinates", "longest_pair_length", "num_points_in_cluster" }) self.assertSetEqual( set(sqs.clusters[0]["coordinates"][0].keys()), {"cluster_function", "coordinates", "num_possible_species"})
def test_mcsqs_caller_parallel(self): # explicitly test with four instances struc = self.struc.copy() struc.replace_species({"Ti": {"Ti": 0.5, "Zr": 0.5}, "Zr": {"Ti": 0.5, "Zr": 0.5}}) sqs = run_mcsqs(struc, {2: 6, 3: 4}, scaling=2, search_time=0.01, instances=4) matches = [sqs.bestsqs.matches(s) for s in self.pztstructs2] self.assertIn(True, matches)
def test_mcsqs_caller_supercell(self): struc = self.struc.copy() struc.replace_species( {"Ti": {"Ti": 0.5, "Zr": 0.5}, "Zr": {"Ti": 0.5, "Zr": 0.5}} ) sqs = run_mcsqs( struc, {2: 6, 3: 4}, scaling=[2, 1, 1], search_time=0.01, instances=1 ) matches = [sqs.bestsqs.matches(s) for s in self.pztstructs] self.assertIn(True, matches)
def test_mcsqs_perfect_match_error_parallel(self): scale = 32 / self.perfect_match_zzn_rs.num_sites sqs = run_mcsqs( self.perfect_match_zzn_rs, {2: 6, 3: 4}, scaling=scale, search_time=1, instances=4, ) self.assertEqual(sqs.objective_function, "Perfect_match")
def test_Mcsqs_Caller_total_atoms(self): struc = self.struc.copy() struc.replace_species({ "Ti": { "Ti": 0.5, "Zr": 0.5 }, "Zr": { "Ti": 0.5, "Zr": 0.5 } }) sqs = run_mcsqs(struc, {2: 6, 3: 4}, total_atoms=20, search_time=0.01) self.assertEqual(atat.Mcsqs(sqs).to_string() in self.pztstrings2, True)