├── .gitignore ├── 0_conv_tests ├── 1_submit.py ├── 2_plot_results.py └── input.py ├── 1_lin_response ├── 1_submit.py ├── 2_plot_results.py └── input.py ├── 2_coll ├── 1_submit.py ├── 2_plot_results.py └── input.py ├── 3_monte_carlo ├── 1_coupling_constants.py ├── 2_write_vampire_ucf.py ├── 3_plot_results.py ├── input.py └── vampire_input │ ├── input │ └── vamp.mat ├── CalcFold └── .gitignore ├── LICENSE ├── README.md ├── ase └── run_vasp.py ├── common ├── SubmitFirework.py └── utilities.py ├── geometries ├── Ca3MnCoO6_primitive.vasp ├── Fe2O3-alpha_conventional.vasp ├── Fe2O3-alpha_primitive.vasp ├── Ni3TeO6_primitive.vasp └── Ni3TeO6_setting005_1x2x1.vasp └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /.venv 2 | /.idea 3 | __pycache__ 4 | *.pyc 5 | .DS_Store 6 | .pytest_cache 7 | .hypothesis 8 | -------------------------------------------------------------------------------- /0_conv_tests/1_submit.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.0_conv_tests.1_submit 3 | ============================= 4 | 5 | Script which submits convergence tests. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | from pymatgen.core.structure import Structure 13 | 14 | from common.SubmitFirework import SubmitFirework 15 | 16 | # full path to poscar file 17 | path_to_poscar = '../geometries/' + poscar_file 18 | 19 | # magnetic configuration to use for the convergence test 20 | if 'configuration' not in globals(): 21 | configuration = [] 22 | structure = Structure.from_file(path_to_poscar) 23 | for atom in structure.species: 24 | if 'magnetic_atoms' not in globals(): 25 | if atom.is_transition_metal: 26 | configuration.append(4.0) 27 | else: 28 | configuration.append(0.0) 29 | else: 30 | if atom in magnetic_atoms: 31 | configuration.append(4.0) 32 | else: 33 | configuration.append(0.0) 34 | 35 | # convergence test w.r.t. encut 36 | if mode == 'encut': 37 | if 'encut_values' not in globals(): 38 | encut_values = range(500, 1010, 10) 39 | 40 | convtest = SubmitFirework(path_to_poscar, mode='encut', fix_params=params, magmoms=configuration, 41 | encut_values=encut_values) 42 | convtest.submit() 43 | 44 | # convergence test w.r.t. sigma and kpts 45 | if mode == 'kgrid': 46 | if 'sigma_values' not in globals(): 47 | sigma_values = [item / 100 for item in range(5, 25, 5)] 48 | 49 | if 'kpts_values' not in globals(): 50 | kpts_values = range(20, 110, 10) 51 | 52 | convtest = SubmitFirework(path_to_poscar, mode='kgrid', fix_params=params, magmoms=configuration, 53 | sigma_values=sigma_values, kpts_values=kpts_values) 54 | convtest.submit() 55 | -------------------------------------------------------------------------------- /0_conv_tests/2_plot_results.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.0_conv_tests.2_plot_results 3 | =================================== 4 | 5 | Script which plots results of convergence tests. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import mode, poscar_file 11 | 12 | import os 13 | import numpy as np 14 | import matplotlib.pyplot as plt 15 | 16 | from ase.io import read 17 | 18 | # increase matplotlib pyplot font size 19 | plt.rcParams.update({'font.size': 20}) 20 | 21 | # create an ase atoms object 22 | path_to_poscar = '../geometries/' + poscar_file 23 | atoms = read(path_to_poscar) 24 | 25 | # minimum and maximum values on the x axis for plotting, can be omitted 26 | # XMIN = 250 27 | # XMAX = 1000 28 | 29 | 30 | def single_plot(X, Y, label=None): 31 | X = np.array(X, dtype=int) 32 | Y = np.array(Y, dtype=float) / len(atoms) 33 | 34 | # plot only between XMIN and XMAX 35 | if 'XMAX' in globals() and 'XMIN' in globals(): 36 | indices = np.where(np.logical_and(X >= XMIN, X <= XMAX)) 37 | X = X[indices] 38 | Y = Y[indices] 39 | 40 | # sort the arrays 41 | indices = np.argsort(X) 42 | X = X[indices] 43 | Y = Y[indices] 44 | 45 | for x, y in zip(X[:-1], Y[:-1]): 46 | if abs(y - Y[-1]) < 0.001: 47 | if mode == 'encut': 48 | print(f'ENCUT = {x} eV gives an error of less than 1 meV/atom w. r. t. the most accurate result.') 49 | else: 50 | print(f'kpts = {x} eV with {label} gives an error of less than 1 meV/atom w. r. t. ' 51 | f'the most accurate result.') 52 | break 53 | 54 | # plot 55 | if label is None: 56 | plt.plot(X, Y, 'o') 57 | else: 58 | plt.plot(X, Y, 'o-', label=label) 59 | 60 | 61 | # set figure size 62 | plt.figure(figsize=(16, 9)) 63 | 64 | # read only lines which do not start with space 65 | lines = [] 66 | calcfold = os.path.join(os.environ.get('AUTOMAG_PATH'), 'CalcFold') 67 | with open(os.path.join(calcfold, f"{atoms.get_chemical_formula(mode='metal', empirical=True)}_{mode}.txt"), 'r') as f: 68 | for line in f: 69 | if line[0] != ' ': 70 | lines.append(line) 71 | 72 | # extract the results 73 | params, energies, = [], [] 74 | for line in lines: 75 | values = line.split() 76 | params.append(values[0].strip(mode)) 77 | energies.append(values[-1].split('=')[1]) 78 | 79 | if mode == 'encut': 80 | single_plot(params, energies) 81 | 82 | elif mode == 'kgrid': 83 | sigmas, kptss = [], [] 84 | for param in params: 85 | sigma, kpts = param.split('-') 86 | sigmas.append(sigma) 87 | kptss.append(kpts) 88 | 89 | sigmas = np.array(sigmas) 90 | kptss = np.array(kptss) 91 | energies = np.array(energies) 92 | sigma_values = sorted(set(sigmas)) 93 | for sigma_value in sigma_values: 94 | indices = np.where(sigmas == sigma_value) 95 | single_plot(kptss[indices], energies[indices], label=f'SIGMA = {sigma_value}') 96 | else: 97 | raise ValueError('MODEs currently implemented: encut, kgrid.') 98 | 99 | if mode == 'encut': 100 | plt.xlabel('ENCUT (eV)') 101 | else: 102 | plt.xlabel(r'$R_k$') 103 | plt.legend() 104 | 105 | plt.ylabel('energy (eV/atom)') 106 | plt.savefig(f'{mode}.png', bbox_inches='tight') 107 | # plt.show() 108 | -------------------------------------------------------------------------------- /0_conv_tests/input.py: -------------------------------------------------------------------------------- 1 | # choose the desired mode: 'encut' or 'kgrid' 2 | mode = 'encut' 3 | 4 | # name of the poscar file to use in the automag/geometries folder 5 | poscar_file = 'Fe2O3-alpha_primitive.vasp' 6 | 7 | # define the VASP parameters 8 | params = { 9 | 'xc': 'PBE', 10 | 'setups': 'recommended', 11 | 'istart': 0, 12 | 'prec': 'Normal', 13 | 'ncore': 4, 14 | 'ediff': 1e-6, 15 | 'ismear': 1, 16 | 'lcharg': False, 17 | 'lwave': False, 18 | 'sigma': 0.1, 19 | 'kpts': 30, 20 | # 'encut': 830, 21 | } 22 | 23 | # choose the atomic types to be considered magnetic (default transition metals) 24 | # magnetic_atoms = ['Fe', 'Co'] 25 | 26 | # choose the magnetic configuration to use for convergence tests (default FM-HS) 27 | # configuration = 6 * [4.0] + 6 * [-4.0] + 18 * [0.0] 28 | 29 | # choose the trial values for ENCUT (default from 500 to 1000 eV at steps of 10 eV) 30 | # encut_values = range(350, 610, 10) 31 | 32 | # choose the trial values for SIGMA (default from 0.05 to 0.2 eV at steps of 0.05 eV) 33 | # sigma_values = [item / 100 for item in range(5, 25, 5)] 34 | 35 | # choose the trial values for R_k (default from 20 to 100 Ang^-1 at steps of 10 Ang^-1) 36 | # kpts_values = range(20, 110, 10) 37 | -------------------------------------------------------------------------------- /1_lin_response/1_submit.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.1_lin_response.1_submit 3 | =============================== 4 | 5 | Script which submits linear response U calculations. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | from ase.io import read 13 | from pymatgen.core.structure import Structure 14 | 15 | from common.SubmitFirework import SubmitFirework 16 | 17 | # full path to poscar file 18 | path_to_poscar = '../geometries/' + poscar_file 19 | 20 | # create ase.Atoms object 21 | atoms = read(path_to_poscar) 22 | 23 | if 'configuration' not in globals(): 24 | configuration = [] 25 | structure = Structure.from_file(path_to_poscar) 26 | for atom in structure.species: 27 | if 'magnetic_atoms' not in globals(): 28 | if atom.is_transition_metal: 29 | configuration.append(4.0) 30 | else: 31 | configuration.append(0.0) 32 | else: 33 | if atom in magnetic_atoms: 34 | configuration.append(4.0) 35 | else: 36 | configuration.append(0.0) 37 | 38 | # submit calculations 39 | run = SubmitFirework(path_to_poscar, mode='perturbations', fix_params=params, pert_values=perturbations, 40 | magmoms=configuration, dummy_atom=dummy_atom, dummy_position=dummy_position) 41 | run.submit() 42 | -------------------------------------------------------------------------------- /1_lin_response/2_plot_results.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.1_lin_response.2_plot_results 3 | ===================================== 4 | 5 | Script which plots results of linear response U calculation. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | import os 11 | import numpy as np 12 | import matplotlib.pyplot as plt 13 | 14 | from scipy import stats 15 | 16 | # increase matplotlib pyplot font size 17 | plt.rcParams.update({'font.size': 20}) 18 | 19 | calcfold = os.path.join(os.environ.get('AUTOMAG_PATH'), 'CalcFold') 20 | data = np.loadtxt(os.path.join(calcfold, 'charges.txt')) 21 | 22 | perturbations = data[:, 0] 23 | nscf = data[:, 1] 24 | scf = data[:, 2] 25 | 26 | plt.figure(figsize=(16, 9)) 27 | 28 | slope_nscf, intercept_nscf, r_value_nscf, p_value_nscf, std_err_nscf = stats.linregress(perturbations, nscf) 29 | slope_scf, intercept_scf, r_value_scf, p_value_scf, std_err_scf = stats.linregress(perturbations, scf) 30 | 31 | print(f'U = {(1/slope_scf) - (1/slope_nscf):4.2f}') 32 | 33 | plt.plot(perturbations, nscf, 'ro', label=f'NSCF (slope {slope_nscf:.4f})') 34 | plt.plot(perturbations, scf, 'bo', label=f'SCF (slope {slope_scf:.4f})') 35 | 36 | nscf_line = [value * slope_nscf + intercept_nscf for value in perturbations] 37 | scf_line = [value * slope_scf + intercept_scf for value in perturbations] 38 | plt.plot(perturbations, nscf_line, 'r-') 39 | plt.plot(perturbations, scf_line, 'b-') 40 | 41 | plt.xlabel('α (eV)') 42 | plt.ylabel('d-electrons on first Fe site') 43 | plt.legend() 44 | # plt.show() 45 | plt.savefig('Ucalc.png', bbox_inches='tight') 46 | -------------------------------------------------------------------------------- /1_lin_response/input.py: -------------------------------------------------------------------------------- 1 | # name of the poscar file to use in the automag/geometries folder 2 | poscar_file = 'Fe2O3-alpha_primitive.vasp' 3 | 4 | # define the atom to introduce as dummy atom 5 | dummy_atom = 'Zn' 6 | 7 | # define the position of the dummy atom (from 0 to N_ATOMS-1) 8 | dummy_position = 0 9 | 10 | # define the perturbations in eV to apply to the dummy atom 11 | perturbations = [-0.08, -0.05, -0.02, 0.02, 0.05, 0.08] 12 | 13 | # define the VASP parameters 14 | params = { 15 | 'xc': 'PBE', 16 | 'setups': 'recommended', 17 | 'prec': 'Accurate', 18 | 'ncore': 4, 19 | 'encut': 820, 20 | 'ediff': 1e-6, 21 | 'ismear': 0, 22 | 'sigma': 0.05, 23 | 'kpts': 20, 24 | 'lmaxmix': 4, 25 | 'nelm': 200, 26 | } 27 | 28 | # choose the atomic types to be considered magnetic (default transition metals) 29 | # magnetic_atoms = ['Fe', 'Co'] 30 | 31 | # choose the magnetic configuration to use for U calculation (default FM-HS) 32 | # configuration = 6 * [4.0] + 6 * [-4.0] + 18 * [0.0] 33 | -------------------------------------------------------------------------------- /2_coll/1_submit.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.2_coll.1_submit 3 | ======================= 4 | 5 | Script which runs enumlib and submits calculations. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | import os 13 | import subprocess 14 | import numpy as np 15 | 16 | from itertools import product 17 | from pymatgen.io.vasp import Poscar 18 | from pymatgen.core.structure import Structure 19 | from pymatgen.symmetry.analyzer import SpacegroupAnalyzer 20 | 21 | from common.SubmitFirework import SubmitFirework 22 | 23 | 24 | def launch_enumlib(count, split): 25 | os.mkdir(f'enumlib{count}') 26 | os.chdir(f'enumlib{count}') 27 | 28 | with open('struct_enum.in', 'w') as f: 29 | f.write('generated by Automag\n') 30 | f.write('bulk\n') 31 | 32 | for lat_vector in symmetrized_structure.lattice.matrix: 33 | for component in lat_vector: 34 | f.write(f'{component:14.10f} ') 35 | f.write('\n') 36 | 37 | case = len(split) + sum(split) 38 | f.write(f' {case} -nary case\n') 39 | f.write(f' {symmetrized_structure.num_sites} # Number of points in the multilattice\n') 40 | 41 | offset = 0 42 | for i, (s, wyckoff) in enumerate(zip(split, symmetrized_structure.equivalent_sites)): 43 | if s: 44 | offset += 1 45 | 46 | for atom in wyckoff: 47 | for component in atom.coords: 48 | f.write(f'{component:14.10f} ') 49 | if s: 50 | f.write(f'{i + offset - 1}/{i + offset}\n') 51 | else: 52 | f.write(f'{i + offset}\n') 53 | 54 | f.write(f' 1 {supercell_size} # Starting and ending cell sizes for search\n') 55 | f.write('0.10000000E-06 # Epsilon (finite precision parameter)\n') 56 | f.write('full list of labelings\n') 57 | f.write('# Concentration restrictions\n') 58 | 59 | for s, wyckoff in zip(split, symmetrized_structure.equivalent_sites): 60 | if s: 61 | for _ in range(2): 62 | f.write(f'{len(wyckoff):4d}') 63 | f.write(f'{len(wyckoff):4d}') 64 | f.write(f'{symmetrized_structure.num_sites * 2:4d}\n') 65 | else: 66 | f.write(f'{len(wyckoff) * 2:4d}') 67 | f.write(f'{len(wyckoff) * 2:4d}') 68 | f.write(f'{symmetrized_structure.num_sites * 2:4d}\n') 69 | 70 | # process = subprocess.Popen('/home/michele/softs/enumlib/src/enum.x') 71 | process = subprocess.Popen('enum.x') 72 | try: 73 | process.wait(timeout=60) 74 | except subprocess.TimeoutExpired: 75 | process.kill() 76 | 77 | # solve a bug of enumlib which produces an extra new line 78 | with open('struct_enum.out', 'rt') as file: 79 | lines = file.readlines() 80 | 81 | line_number = 0 82 | os.remove('struct_enum.out') 83 | with open('struct_enum.out', 'wt') as file: 84 | while line_number < len(lines): 85 | line = lines[line_number] 86 | if '(Non)Equivalency list' not in line: 87 | file.write(line) 88 | line_number += 1 89 | else: 90 | file.write(line.strip('\n')) 91 | 92 | offset = 0 93 | while not lines[line_number + offset + 1].startswith('start'): 94 | file.write(' ' + lines[line_number + offset + 1].strip('\n')) 95 | offset += 1 96 | 97 | file.write('\n') 98 | line_number += offset + 1 99 | 100 | # os.system('/home/michele/softs/enumlib/aux_src/makeStr.py 1 500') 101 | os.system('makeStr.py 1 500') 102 | 103 | for j in range(501): 104 | if os.path.isfile(f'vasp.{j + 1}'): 105 | conf_poscar = Poscar.from_file(f'vasp.{j + 1}') 106 | else: 107 | break 108 | 109 | if conf_poscar.structure.lattice in lattices: 110 | index = lattices.index(conf_poscar.structure.lattice) 111 | current_coords = conf_poscar.structure.frac_coords.tolist() 112 | reference_coords = coordinates[index].tolist() 113 | mapping = [np.nonzero([np.allclose(cur, ref) for cur in current_coords])[0][0] for ref in reference_coords] 114 | else: 115 | lattices.append(conf_poscar.structure.lattice) 116 | coordinates.append(conf_poscar.structure.frac_coords) 117 | configurations.append([]) 118 | index = len(lattices) - 1 119 | mapping = list(range(len(conf_poscar.structure.frac_coords))) 120 | 121 | counter = 0 122 | split_groups = [] 123 | site_magmoms = [] 124 | for to_split, states in zip(split, wyckoff_magmoms): 125 | if to_split: 126 | split_groups.append([counter, counter + 1]) 127 | for _ in range(2): 128 | site_magmoms.append([1, -1]) 129 | counter += 1 130 | else: 131 | site_magmoms.append(states) 132 | counter += 1 133 | 134 | # adapt equivalent_multipliers in case of supercells 135 | coefficient = len(conf_poscar.structure) // len(structure) 136 | 137 | current_multipliers = [] 138 | for multiplier in equivalent_multipliers: 139 | current_multipliers.append(np.repeat(multiplier, coefficient)) 140 | 141 | # use a flag to check that all sites which have been split are AFM 142 | for conf in product(*site_magmoms): 143 | flag = True 144 | conf_array = np.array(conf) 145 | for group in split_groups: 146 | if sum(conf_array[group]) != 0: 147 | flag = False 148 | if flag: 149 | configuration = np.repeat(conf, conf_poscar.natoms) 150 | transformed_configuration = configuration[mapping] 151 | 152 | for mult in current_multipliers: 153 | candidate_conf = np.multiply(transformed_configuration, mult).tolist() 154 | 155 | # if all spins are zero do not include the NM configuration 156 | if len(np.nonzero(candidate_conf)[0]) > 0: 157 | first_nonzero_index = np.nonzero(candidate_conf)[0][0] 158 | 159 | # if the first non-zero spin is negative flip all spins 160 | if candidate_conf[first_nonzero_index] < 0: 161 | candidate_conf = [-item for item in candidate_conf] 162 | 163 | # add to list of configurations for the current settings 164 | if candidate_conf not in configurations[index]: 165 | configurations[index].append(candidate_conf) 166 | 167 | os.chdir('..') 168 | 169 | 170 | # full path to poscar file 171 | path_to_poscar = '../geometries/' + poscar_file 172 | 173 | # create Structure and SymmetrizedStructure objects 174 | structure = Structure.from_file(path_to_poscar) 175 | analyzer = SpacegroupAnalyzer(structure) 176 | symmetrized_structure = analyzer.get_symmetrized_structure() 177 | 178 | # find out which atoms are magnetic 179 | for element in structure.composition.elements: 180 | if element.name in spin_values: 181 | element.is_magnetic = True 182 | else: 183 | element.is_magnetic = False 184 | 185 | if os.path.exists('trials'): 186 | print('Cannot create a folder named trials: an object with the same name already exists.') 187 | exit() 188 | 189 | os.mkdir('trials') 190 | os.chdir('trials') 191 | 192 | # geometrical settings and respective lists of magnetic configurations 193 | lattices = [structure.lattice] 194 | coordinates = [structure.frac_coords] 195 | configurations = [[]] 196 | 197 | # get the multiplicities of each Wyckoff position 198 | multiplicities = [len(item) for item in symmetrized_structure.equivalent_indices] 199 | 200 | wyckoff_magmoms = [] 201 | equivalent_multipliers = [] 202 | for multiplicity, wyckoff in zip(multiplicities, symmetrized_structure.equivalent_sites): 203 | if wyckoff[0].specie.is_magnetic: 204 | wyckoff_magmoms.append([1, 0, -1]) 205 | 206 | if len(spin_values[wyckoff[0].specie.name]) == 2: 207 | val1 = spin_values[wyckoff[0].specie.name][0] 208 | val2 = spin_values[wyckoff[0].specie.name][1] 209 | 210 | if len(equivalent_multipliers) == 0: 211 | equivalent_multipliers.append(np.repeat(val1, multiplicity)) 212 | equivalent_multipliers.append(np.repeat(val2, multiplicity)) 213 | else: 214 | new_equivalent_multipliers = [] 215 | for multiplier in equivalent_multipliers: 216 | new_equivalent_multipliers.append(np.append(multiplier, np.repeat(val1, multiplicity))) 217 | new_equivalent_multipliers.append(np.append(multiplier, np.repeat(val2, multiplicity))) 218 | 219 | equivalent_multipliers = new_equivalent_multipliers 220 | 221 | elif len(spin_values[wyckoff[0].specie.name]) == 1: 222 | val1 = spin_values[wyckoff[0].specie.name][0] 223 | 224 | if len(equivalent_multipliers) == 0: 225 | equivalent_multipliers.append(np.repeat(val1, multiplicity)) 226 | else: 227 | new_equivalent_multipliers = [] 228 | for multiplier in equivalent_multipliers: 229 | new_equivalent_multipliers.append(np.append(multiplier, np.repeat(val1, multiplicity))) 230 | 231 | equivalent_multipliers = new_equivalent_multipliers 232 | 233 | else: 234 | raise ValueError('Max 2 spin values for each magnetic species.') 235 | 236 | else: 237 | wyckoff_magmoms.append([0]) 238 | 239 | if len(equivalent_multipliers) == 0: 240 | equivalent_multipliers.append(np.repeat(0, multiplicity)) 241 | else: 242 | new_equivalent_multipliers = [] 243 | for multiplier in equivalent_multipliers: 244 | new_equivalent_multipliers.append(np.append(multiplier, np.repeat(0, multiplicity))) 245 | 246 | equivalent_multipliers = new_equivalent_multipliers 247 | 248 | # get all possible configurations without any splitting 249 | for conf in product(*wyckoff_magmoms): 250 | configuration = np.repeat(conf, multiplicities) 251 | 252 | for mult in equivalent_multipliers: 253 | candidate_conf = np.multiply(configuration, mult).tolist() 254 | 255 | # if the configuration is not NM, get the index of the first non-zero element 256 | if len(np.nonzero(candidate_conf)[0]) > 0: 257 | first_nonzero_index = np.nonzero(candidate_conf)[0][0] 258 | 259 | # if the first non-zero spin is negative flip all spins 260 | if candidate_conf[first_nonzero_index] < 0: 261 | candidate_conf = [-item for item in candidate_conf] 262 | 263 | # add to list of configurations for the current settings 264 | if candidate_conf not in configurations[0]: 265 | configurations[0].append(candidate_conf) 266 | 267 | # split all possible combinations of Wyckoff positions 268 | splits = [] 269 | possibilities = [[0, 1] if len(item) > 1 else [0] for item in wyckoff_magmoms] 270 | for split in product(*possibilities): 271 | if sum(split) != 0: 272 | splits.append(split) 273 | 274 | for i, split in enumerate(splits): 275 | launch_enumlib(i + 1, split) 276 | 277 | # merge the first and second settings if they are equivalent 278 | if len(lattices) > 1: 279 | transformation_matrix = np.dot(lattices[1].matrix, np.linalg.inv(lattices[0].matrix)) 280 | inv_transformation_matrix = np.linalg.inv(transformation_matrix) 281 | determinant = int(round(np.linalg.det(transformation_matrix), 6)) 282 | 283 | if determinant == 1: 284 | del_flag = True 285 | origin_shift = np.around(coordinates[1][0] - np.dot(coordinates[0][0], inv_transformation_matrix), decimals=6) 286 | for coord1, coord2 in zip(coordinates[0], coordinates[1]): 287 | if not np.allclose((np.dot(coord1, inv_transformation_matrix) + origin_shift) % 1, coord2): 288 | del_flag = False 289 | 290 | if del_flag: 291 | del lattices[0] 292 | del coordinates[0] 293 | configurations[0].extend(configurations[1]) 294 | del configurations[1] 295 | 296 | # write output and submit calculations 297 | fm_count = 1 298 | afm_count = 1 299 | fim_count = 1 300 | original_ch_symbols = [atom.name for atom in structure.species] 301 | for i, (lattice, frac_coords, confs) in enumerate(zip(lattices, coordinates, configurations)): 302 | magnification = len(frac_coords) // len(structure.frac_coords) 303 | ch_symbols = np.repeat(original_ch_symbols, magnification) 304 | setting = Structure(lattice, ch_symbols, frac_coords) 305 | setting.to(fmt='poscar', filename=f'setting{i + 1:03d}.vasp') 306 | mask = [item.is_magnetic for item in setting.species] 307 | 308 | for conf in confs: 309 | conf_array = np.array(conf) 310 | with open(f'configurations{i + 1:03d}.txt', 'a') as f: 311 | if np.sum(np.abs(conf)) == 0: 312 | state = 'nm' 313 | elif min(conf) >= 0: 314 | state = 'fm' + str(fm_count) 315 | fm_count += 1 316 | elif np.sum(conf) == 0: 317 | state = 'afm' + str(afm_count) 318 | afm_count += 1 319 | else: 320 | state = 'fim' + str(fim_count) 321 | fim_count += 1 322 | 323 | f.write(f'{state:>6s} ') 324 | f.write(' '.join(f'{e:2d}' for e in conf_array[mask])) 325 | f.write('\n') 326 | 327 | run = SubmitFirework(f'setting{i + 1:03d}.vasp', mode='singlepoint', fix_params=params, magmoms=conf, 328 | name=state) 329 | run.submit() 330 | -------------------------------------------------------------------------------- /2_coll/2_plot_results.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.2_coll.2_plot_results 3 | ============================= 4 | 5 | Script which plots results of magnetic relaxations. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | import os 13 | import json 14 | import shutil 15 | import numpy as np 16 | import matplotlib.pyplot as plt 17 | 18 | from copy import copy 19 | from ase.io import read 20 | from pymatgen.core.structure import Structure 21 | from pymatgen.symmetry.analyzer import SpacegroupAnalyzer 22 | 23 | 24 | def better_sort(state): 25 | if state[0] == 'nm': 26 | return 'aa' 27 | elif state[0][:2] == 'fm': 28 | return 'aaa' + f'{int(state[0][2:]):3d}' 29 | else: 30 | return state[0][:3] + f'{int(state[0][3:]):3d}' 31 | 32 | 33 | # take care of the case when lower_cutoff has not been specified 34 | if 'lower_cutoff' not in globals(): 35 | lower_cutoff = 0 36 | 37 | # create an ase atoms object 38 | path_to_poscar = '../geometries/' + poscar_file 39 | atoms = read(path_to_poscar) 40 | 41 | # get the multiplicities of each Wyckoff position 42 | structure = Structure.from_file(path_to_poscar) 43 | analyzer = SpacegroupAnalyzer(structure) 44 | symmetrized_structure = analyzer.get_symmetrized_structure() 45 | multiplicities = np.array([len(item) for item in symmetrized_structure.equivalent_indices]) 46 | 47 | # path to results file with data 48 | calcfold = os.path.join(os.environ.get('AUTOMAG_PATH'), 'CalcFold') 49 | output_file = os.path.join(calcfold, f"{atoms.get_chemical_formula(mode='metal', empirical=True)}_singlepoint.txt") 50 | 51 | # exit if no trials folder 52 | if not os.path.isdir('trials'): 53 | raise IOError('No trials folder found.') 54 | 55 | # read lines 56 | lines, maginfos, presents = [], [], [] 57 | with open(output_file, 'rt') as f: 58 | for line in f: 59 | if line[0] != ' ': 60 | presents.append(line.split()[0]) 61 | lines.append(line) 62 | else: 63 | maginfos.append(line) 64 | 65 | data = {} 66 | setting = 1 67 | not_found = [] 68 | while os.path.isfile(f'trials/configurations{setting:03d}.txt'): 69 | with open(f'trials/configurations{setting:03d}.txt', 'rt') as f: 70 | for line in f: 71 | values = line.split() 72 | init_state = values[0] 73 | if init_state in presents: 74 | dct = { 75 | 'setting': setting, 76 | 'init_spins': [int(item) for item in values[1:]], 77 | } 78 | data[init_state] = dct 79 | else: 80 | not_found.append(init_state) 81 | setting += 1 82 | 83 | # keep the maximum value of setting 84 | max_setting = copy(setting) 85 | 86 | # extract the results 87 | red = [] 88 | not_converged = [] 89 | all_final_magmoms = [] 90 | for line, maginfo in zip(lines, maginfos): 91 | values = line.split() 92 | init_state = values[0] 93 | 94 | if values[-4].split('=')[1] == 'NONCONVERGED': 95 | not_converged.append(init_state) 96 | del data[init_state] 97 | else: 98 | initial, final = maginfo.split('final_magmoms=') 99 | initial = initial[initial.index('[') + 1:initial.index(']')] 100 | final = final[final.index('[') + 1:final.index(']')] 101 | initial = np.array(initial.split(), dtype=float) 102 | final = np.array(final.split(), dtype=float) 103 | 104 | all_final_magmoms.extend(final.tolist()) 105 | 106 | # exclude low-spin configurations 107 | flag = False 108 | mask = np.nonzero(initial) 109 | if np.all(np.abs(final[mask]) > lower_cutoff) or init_state == 'nm': 110 | flag = True 111 | 112 | magnification = len(initial) // sum(multiplicities) 113 | current_multiplicities = magnification * multiplicities 114 | 115 | start = 0 116 | kept = True 117 | for multiplicity in current_multiplicities: 118 | w_initial = initial[start:start + multiplicity] 119 | w_final = final[start:start + multiplicity] 120 | start += multiplicity 121 | 122 | if not np.any(w_initial): 123 | if np.any(np.around(w_final)): 124 | kept = False 125 | else: 126 | prod = np.multiply(np.sign(w_initial), w_final) 127 | if prod.max() - prod.min() > 0.08: 128 | kept = False 129 | 130 | if kept and flag: 131 | data[init_state]['kept_magmoms'] = True 132 | else: 133 | data[init_state]['kept_magmoms'] = False 134 | red.append(init_state) 135 | 136 | data[init_state]['energy'] = float(values[-1].split('=')[1]) / len(initial) # energy per atom 137 | 138 | if len(red) != 0: 139 | print(f"The following {len(red)} configuration(s) did not keep the original magmoms and will be marked in red " 140 | f"on the graph: {', '.join(red)}") 141 | if len(not_converged) != 0: 142 | print(f"The energy calculation of the following {len(not_converged)} configuration(s) did not converge and will " 143 | f"not be shown on the graph: {', '.join(not_converged)}") 144 | if len(not_found) != 0: 145 | print(f"The following {len(not_found)} configuration(s) reported an error during energy calculation and will " 146 | f"not be shown on the graph: {', '.join(not_found)}") 147 | 148 | # plt.hist(np.abs(all_final_magmoms), bins=40) 149 | # plt.savefig('spin_distribution.png') 150 | 151 | setting = 1 152 | final_states = [] 153 | final_setting = setting 154 | final_energies = [] 155 | final_min = np.inf 156 | while setting < max_setting: 157 | current_states = [] 158 | current_energies = [] 159 | for init_state, value in data.items(): 160 | if init_state != 'nm' and value['setting'] == setting and value['kept_magmoms']: 161 | current_states.append(np.sign(value['init_spins']).tolist()) 162 | current_energies.append(value['energy']) 163 | if min(current_energies) < final_min: 164 | final_setting = setting 165 | final_states = current_states 166 | final_energies = current_energies 167 | final_min = min(current_energies) 168 | setting += 1 169 | 170 | # filter out configurations containing NM states 171 | tc_states = [] 172 | tc_energies = [] 173 | for state, energy in zip(final_states, final_energies): 174 | if 0 not in state: 175 | tc_states.append(state) 176 | tc_energies.append(energy) 177 | 178 | # write states to file 179 | with open(f'states{final_setting:03d}.txt', 'wt') as f: 180 | json.dump(tc_states, f) 181 | 182 | # write energies to file 183 | with open(f'energies{final_setting:03d}.txt', 'wt') as f: 184 | json.dump(tc_energies, f) 185 | 186 | # copy setting file with geometry 187 | shutil.copy(f'trials/setting{final_setting:03d}.vasp', '.') 188 | 189 | # extract values for plot 190 | bar_labels = [] 191 | energies = [] 192 | kept_magmoms = [] 193 | for key, value in sorted(data.items(), key=better_sort): 194 | bar_labels.append(key) 195 | energies.append(value['energy']) 196 | kept_magmoms.append(value['kept_magmoms']) 197 | 198 | energies = np.array(energies) 199 | kept_magmoms = np.array(kept_magmoms) 200 | 201 | # energies from eV/atom to meV/atom 202 | energies *= 1000 203 | 204 | # normalize energies for plot 205 | energies -= min(energies) 206 | toplim = max(energies) * 1.15 207 | bottomlim = -0.1 * max(energies) 208 | 209 | energies += 0.1 * max(energies) 210 | x_axis = np.arange(1, len(energies) + 1) 211 | 212 | # split into chunks if too many configurations 213 | n_chunks = len(energies) // 14 + 1 214 | x_axis_split = np.array_split(x_axis, n_chunks) 215 | energies_split = np.array_split(energies, n_chunks) 216 | kept_magmoms_split = np.array_split(kept_magmoms, n_chunks) 217 | bar_labels_split = np.array_split(bar_labels, n_chunks) 218 | 219 | for i, (X, Y, kept_magmoms_chunk, bar_labels_chunk) in \ 220 | enumerate(zip(x_axis_split, energies_split, kept_magmoms_split, bar_labels_split)): 221 | # increase matplotlib pyplot font size 222 | plt.rcParams.update({'font.size': 20}) 223 | 224 | # set figure size 225 | plt.figure(figsize=(16, 9)) 226 | 227 | # plot results 228 | plt.bar(X[~kept_magmoms_chunk], Y[~kept_magmoms_chunk], bottom=bottomlim, color='r') 229 | plt.bar(X[kept_magmoms_chunk], Y[kept_magmoms_chunk], bottom=bottomlim, color='b') 230 | 231 | # label bars 232 | ax = plt.gca() 233 | rects = ax.patches 234 | rects = sorted(rects, key=lambda x: x.get_x()) 235 | for bar_label, rect in zip(bar_labels_chunk, rects): 236 | height = rect.get_height() 237 | ax.text(rect.get_x() + rect.get_width() / 2, height + 0.85 * bottomlim, bar_label, 238 | fontsize='medium', ha='center', va='bottom', rotation='vertical') 239 | 240 | # label axes 241 | plt.xlabel('configurations') 242 | plt.ylabel(f'relative energy (meV/atom)') 243 | plt.xticks(X) 244 | plt.ylim(top=toplim) 245 | 246 | # save or show bar chart 247 | plt.savefig(f'stability{i + 1:02d}.png', bbox_inches='tight') 248 | plt.close() 249 | 250 | print(f'The most stable configuration is {bar_labels[np.argmin(energies)]}.') 251 | if np.logical_not(kept_magmoms[np.argmin(energies)]): 252 | print('WARNING: values of initial and final magnetic moments of the most stable configuration ' 253 | 'significantly differ.') 254 | -------------------------------------------------------------------------------- /2_coll/input.py: -------------------------------------------------------------------------------- 1 | # name of the poscar file to use in the automag/geometries folder 2 | poscar_file = 'Ni3TeO6_setting005_1x2x1.vasp' 3 | 4 | # maximum supercell size for generating distinct magnetic configurations 5 | supercell_size = 1 6 | 7 | # choose the absolute values given to up and down spins 8 | spin_values = { 9 | 'Ni': [2], 10 | } 11 | 12 | # define the VASP parameters 13 | params = { 14 | 'xc': 'PBE', 15 | 'setups': 'recommended', 16 | 'prec': 'Accurate', 17 | 'ncore': 4, 18 | 'encut': 830, 19 | 'ediff': 1e-6, 20 | 'ismear': 1, 21 | 'sigma': 0.1, 22 | 'nelm': 200, 23 | 'kpts': 20, 24 | 'lmaxmix': 4, 25 | 'lcharg': False, 26 | 'lwave': False, 27 | 'isym': 0, 28 | 'ldau': True, 29 | 'ldautype': 2, 30 | 'ldaul': [2, -1, -1], 31 | 'ldauu': [5.17, 0, 0], 32 | 'ldauj': [0, 0, 0], 33 | 'ldauprint': 2, 34 | } 35 | 36 | # specify a cutoff for picking only high-spin configurations from output 37 | # lower_cutoff = 1.7 38 | -------------------------------------------------------------------------------- /3_monte_carlo/1_coupling_constants.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.3_monte_carlo.1_coupling_constants.py 3 | ============================================= 4 | 5 | Script which computes the coupling constants between magnetic atoms. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | import os 13 | import json 14 | import numpy as np 15 | import matplotlib.pyplot as plt 16 | import matplotlib.ticker as ticker 17 | 18 | from pymatgen.core.structure import Structure 19 | 20 | # initialize variables 21 | structure = None 22 | states = None 23 | energies = None 24 | 25 | # read input files from previous step 26 | for item in os.listdir('../2_coll'): 27 | rel_path = os.path.join('../2_coll', item) 28 | if os.path.isfile(rel_path): 29 | if item.startswith('setting') and item.endswith('.vasp'): 30 | structure = Structure.from_file(rel_path) 31 | if item.startswith('states') and item.endswith('.txt'): 32 | with open(rel_path, 'rt') as f: 33 | states = json.load(f) 34 | if item.startswith('energies') and item.endswith('.txt'): 35 | with open(rel_path, 'rt') as f: 36 | energies = json.load(f) 37 | 38 | if structure is None: 39 | raise IOError('No setting file found in ../2_coll folder.') 40 | if states is None: 41 | raise IOError('No states file found in ../2_coll folder.') 42 | if energies is None: 43 | raise IOError('No energies file found in ../2_coll folder.') 44 | 45 | # find out which atoms are magnetic 46 | for element in structure.composition.elements: 47 | if 'magnetic_atoms' not in globals(): 48 | element.is_magnetic = element.is_transition_metal 49 | else: 50 | if element.name in magnetic_atoms: 51 | element.is_magnetic = True 52 | else: 53 | element.is_magnetic = False 54 | 55 | # from eV/atom to total energy of the unit cell 56 | energies = structure.num_sites * np.array(energies) 57 | 58 | 59 | def system(configurations): 60 | matrix = [] 61 | for item in configurations: 62 | equation = [1] 63 | for distance in unique_distances: 64 | count = 0 65 | for atom1, atom2, d in zip(center_indices, point_indices, distances): 66 | if np.isclose(d, distance, atol=0.02): 67 | count += item[atom1] * item[atom2] 68 | equation.append(-count // 2) 69 | matrix.append(equation) 70 | return np.array(matrix) 71 | 72 | 73 | non_magnetic_atoms = [element.symbol for element in structure.composition.elements if not element.is_magnetic] 74 | structure.remove_species(non_magnetic_atoms) 75 | center_indices, point_indices, offset_vectors, distances = structure.get_neighbor_list(cutoff_radius) 76 | 77 | # get unique distances 78 | unique_distances, counts = np.unique(np.around(distances, 2), return_counts=True) 79 | 80 | # create fit and control group 81 | fit_group_size = 1 - control_group_size 82 | index = int(round(len(states) * fit_group_size)) 83 | configurations_fit = np.array(states[:index]) 84 | configurations_control = np.array(states[index:]) 85 | energies_fit = energies[:index] 86 | energies_control = energies[index:] 87 | 88 | A = system(configurations_fit) 89 | values = np.linalg.lstsq(A, energies_fit, rcond=None) 90 | 91 | # DEBUG 92 | # all_states = [[1]] 93 | # for _ in range(structure.num_sites - 1): 94 | # new = [] 95 | # for item in all_states: 96 | # new.append(item + [1]) 97 | # new.append(item + [-1]) 98 | # all_states = new 99 | # 100 | # tmp = system(all_states) 101 | # pred = tmp @ values[0] 102 | # pred -= min(pred) 103 | # pred *= 1000 go to meV/unit cell 104 | # pred /= 40 go to meV/atom 105 | 106 | B = system(configurations_control) 107 | predictions = B @ values[0] 108 | PCC = np.corrcoef(predictions, energies_control) 109 | 110 | plt.rcParams.update({'font.size': 13}) 111 | plt.locator_params(axis='x', nbins=5) 112 | plt.xlabel(f'Heisenberg model energy (eV)') 113 | plt.ylabel(f'DFT energy (eV)') 114 | 115 | # print results 116 | if np.linalg.matrix_rank(A) == len(unique_distances) + 1: 117 | coupling_constants = values[0][1:] * 1.60218e-19 118 | print(f'distances between neighbors: {unique_distances.tolist()}') 119 | print(f'counts: {counts.tolist()}') 120 | print(f'coupling constants: {np.array2string(coupling_constants, precision=8, separator=", ")}') 121 | 122 | if append_coupling_constants: 123 | with open('input.py', 'a') as f: 124 | f.write('\n# LINE ADDED BY THE SCRIPT 1_coupling_constants.py') 125 | f.write(f'\ndistances_between_neighbors = {unique_distances.tolist()}\n') 126 | 127 | f.write('\n# LINE ADDED BY THE SCRIPT 1_coupling_constants.py') 128 | f.write(f'\ncoupling_constants = {np.array2string(coupling_constants, precision=8, separator=", ")}\n') 129 | 130 | plt.scatter(predictions, energies_control, label=f'PCC: {PCC[0, 1]:.2f}') 131 | ax = plt.gca() 132 | ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%.2f')) 133 | ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%.2f')) 134 | plt.legend() 135 | # plt.show() 136 | plt.savefig('model.png', bbox_inches='tight') 137 | print(f'PCC: {PCC[0, 1]:.2f}') 138 | else: 139 | print(f'ERROR: SYSTEM OF {np.linalg.matrix_rank(A)} INDEPENDENT EQUATION(S) ' 140 | f'IN {len(unique_distances) + 1} UNKNOWNS!') 141 | -------------------------------------------------------------------------------- /3_monte_carlo/2_write_vampire_ucf.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.3_monte_carlo.2_run_vampire.py 3 | ====================================== 4 | 5 | Script which runs Vampire for Monte Carlo simulation. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | from input import * 11 | 12 | import os 13 | import numpy as np 14 | 15 | from pymatgen.core.structure import Structure 16 | 17 | # raise IOError if no trials folder 18 | if not os.path.isdir('../2_coll/trials'): 19 | raise IOError('No trials folder found in ../2_coll.') 20 | 21 | setting = 1 22 | magmom = None 23 | while os.path.isfile(f'../2_coll/trials/configurations{setting:03d}.txt'): 24 | with open(f'../2_coll/trials/configurations{setting:03d}.txt', 'rt') as f: 25 | for line in f: 26 | values = line.split() 27 | if values[0] == configuration: 28 | magmom = [int(item) for item in values[1:]] 29 | break 30 | if magmom is not None: 31 | break 32 | setting += 1 33 | 34 | if magmom is None: 35 | raise IOError(f'configuration {configuration} not found.') 36 | 37 | # get materials from magmom 38 | materials = [0 if item >= 0 else 1 for item in magmom] 39 | 40 | # create a pymatgen Structure object 41 | structure = Structure.from_file(f'../2_coll/trials/setting{setting:03d}.vasp') 42 | 43 | # find out which atoms are magnetic 44 | for element in structure.composition.elements: 45 | if 'magnetic_atoms' not in globals(): 46 | element.is_magnetic = element.is_transition_metal 47 | else: 48 | if element.name in magnetic_atoms: 49 | element.is_magnetic = True 50 | else: 51 | element.is_magnetic = False 52 | 53 | non_magnetic_atoms = [element.symbol for element in structure.composition.elements if not element.is_magnetic] 54 | structure.remove_species(non_magnetic_atoms) 55 | center_indices, point_indices, offset_vectors, distances = structure.get_neighbor_list(cutoff_radius) 56 | 57 | # get thresholds for comparing atomic distances 58 | thresholds = [(a + b) / 2 for a, b in zip(distances_between_neighbors[:-1], distances_between_neighbors[1:])] 59 | thresholds = [0.0] + thresholds + [100.0] 60 | 61 | # print unit cell size for VAMPIRE input 62 | with open('vamp.ucf', 'w') as f: 63 | f.write('# Unit cell size:\n') 64 | f.write(f'{structure.lattice.a:19.16f} {structure.lattice.b:19.16f} {structure.lattice.c:19.16f}\n') 65 | 66 | f.write('# Unit cell vectors:\n') 67 | for i, (vector, modulus) in enumerate(zip(structure.lattice.matrix, structure.lattice.abc)): 68 | v = vector / modulus 69 | f.write(f'{v[0]: 10.8e} {v[1]: 10.8e} {v[2]: 10.8e}\n') 70 | 71 | # print fractional coordinates for VAMPIRE input 72 | f.write('# Atoms num_atoms num_materials; id cx cy cz mat cat hcat\n') 73 | f.write(f'{len(structure):d} {len(np.unique(materials))}\n') 74 | for i, (coord, material) in enumerate(zip(structure.frac_coords, materials)): 75 | coord += 0. # gets rid of the minus zero values 76 | for j, item in enumerate(coord): 77 | if item < 0: 78 | coord[j] += 1 79 | elif item >= 1: 80 | coord[j] -= 1 81 | f.write(f'{i:2d} {coord[0]:18.16f} {coord[1]:18.16f} {coord[2]:18.16f} {material} 0 0\n') 82 | 83 | f.write('# Interactions n exctype; id i j dx dy dz Jij\n') 84 | f.write(f'{len(center_indices)} isotropic\n') 85 | for i, (atom1, atom2, offset, distance) in enumerate(zip(center_indices, point_indices, offset_vectors, distances)): 86 | for low_lim, high_lim, coupling_constant in zip(thresholds[:-1], thresholds[1:], coupling_constants): 87 | if low_lim < distance < high_lim: 88 | f.write(f'{i:3d} {atom1:2d} {atom2:2d} ' 89 | f'{int(offset[0]):2d} {int(offset[1]):2d} {int(offset[2]):2d} {coupling_constant: 6.4e}\n') 90 | -------------------------------------------------------------------------------- /3_monte_carlo/3_plot_results.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.3_monte_carlo.3_plot_results.py 3 | ======================================= 4 | 5 | Script which plots the results of the Vampire run. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | import numpy as np 11 | import matplotlib.pyplot as plt 12 | 13 | from scipy.optimize import curve_fit 14 | 15 | 16 | def curve(x, Tc, beta): 17 | return np.where(x < Tc, np.sign(1 - x/Tc) * np.abs(1 - x/Tc) ** beta, 0) 18 | 19 | 20 | filename = 'output' 21 | 22 | results = np.loadtxt(filename) 23 | temperature = results[:, 0] 24 | magnetization = results[:, -1] 25 | 26 | pars, cov = curve_fit(f=curve, xdata=temperature, ydata=magnetization, p0=[900, 0.34]) 27 | 28 | # curve for plot 29 | data_curve = curve(temperature, pars[0], pars[1]) 30 | 31 | plt.rcParams.update({'font.size': 19}) 32 | plt.figure(figsize=(8, 6)) 33 | plt.plot(temperature, magnetization, label='Monte Carlo') 34 | plt.plot(temperature, data_curve, label='analytical fit') 35 | plt.xlabel('Temperature (K)') 36 | plt.ylabel('Mean magnetization length') 37 | plt.legend() 38 | # plt.show() 39 | plt.savefig('magnetization.png') 40 | 41 | print(f'Fitted critical exponent beta = {pars[1]:.2f}') 42 | print(f'Fitted critical temperature Tc = {pars[0]:.0f} K') 43 | -------------------------------------------------------------------------------- /3_monte_carlo/input.py: -------------------------------------------------------------------------------- 1 | # choose the configuration to use for Monte Carlo simulation 2 | configuration = 'afm61' 3 | 4 | # choose the cutoff radius in Angstrom for neighbor search 5 | cutoff_radius = 4.1 6 | 7 | # choose the size of the control group 8 | control_group_size = 0.4 9 | 10 | # append coupling constant before launching 2_write_vampire_ucf.py 11 | append_coupling_constants = False 12 | 13 | # choose the atomic types to be considered magnetic (default transition metals) 14 | # magnetic_atoms = ['Mn'] 15 | -------------------------------------------------------------------------------- /3_monte_carlo/vampire_input/input: -------------------------------------------------------------------------------- 1 | #------------------------------------------ 2 | # Vampire input file for Neel temperature 3 | #------------------------------------------ 4 | 5 | #------------------------------------------ 6 | # Creation attributes: 7 | #------------------------------------------ 8 | create:periodic-boundaries-x 9 | create:periodic-boundaries-y 10 | create:periodic-boundaries-z 11 | 12 | #------------------------------------------ 13 | # System Dimensions: 14 | #------------------------------------------ 15 | dimensions:system-size-x = 5 !nm 16 | dimensions:system-size-y = 5 !nm 17 | dimensions:system-size-z = 5 !nm 18 | 19 | #------------------------------------------ 20 | # Material Files: 21 | #------------------------------------------ 22 | material:file=vamp.mat 23 | material:unit-cell-file=vamp.ucf 24 | 25 | #------------------------------------------ 26 | # Simulation attributes: 27 | #------------------------------------------ 28 | sim:minimum-temperature=0 29 | sim:maximum-temperature=1200 30 | sim:temperature-increment=1 31 | 32 | sim:time-steps-increment=1 33 | sim:equilibration-time-steps=20000 34 | sim:loop-time-steps=40000 35 | 36 | #------------------------------------------ 37 | # Program and integrator details 38 | #------------------------------------------ 39 | sim:program=curie-temperature 40 | sim:integrator=monte-carlo 41 | 42 | #------------------------------------------ 43 | # data output 44 | #------------------------------------------ 45 | output:temperature 46 | output:mean-magnetisation-length 47 | output:material-mean-magnetisation-length 48 | screen:temperature 49 | screen:mean-magnetisation-length 50 | screen:material-mean-magnetisation-length 51 | -------------------------------------------------------------------------------- /3_monte_carlo/vampire_input/vamp.mat: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------- 2 | # Number of Materials 3 | #--------------------------------------------------- 4 | material:num-materials=2 5 | #--------------------------------------------------- 6 | # Material 1 Fe 7 | #--------------------------------------------------- 8 | material[1]:material-name=Fe-up 9 | material[1]:atomic-spin-moment=4.2 !muB 10 | material[1]:material-element=Fe 11 | material[1]:uniaxial-anisotropy-constant=0.0 12 | material[1]:initial-spin-direction=0,0,1 13 | #--------------------------------------------------- 14 | # Material 2 Fe 15 | #--------------------------------------------------- 16 | material[2]:material-name=Fe-dn 17 | material[2]:atomic-spin-moment=4.2 !muB 18 | material[2]:material-element=Fe 19 | material[2]:uniaxial-anisotropy-constant=0.0 20 | material[2]:initial-spin-direction=0,0,-1 21 | -------------------------------------------------------------------------------- /CalcFold/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Automag 2 | An automatic workflow software for calculating the ground collinear magnetic 3 | state of a given structure and for estimating the critical temperature of the 4 | magnetically ordered to paramagnetic phase transition. 5 | 6 | ## Installation 7 | Automag is meant to be run on a computing cluster. The first step in the 8 | installation is to clone the repository 9 | 10 | `git clone https://github.com/michelegalasso/automag.git` 11 | 12 | I assume that you have Python 3 installed on your system, accessible through 13 | the `python` command, with the `wheel` and the `venv` packages installed. 14 | After cloning, go to the `automag` directory which has appeared and initialize 15 | a Python virtual environment 16 | 17 | `cd automag` 18 | `python -m venv .venv` 19 | 20 | After that, activate your virtual environment. If you are working on an Unix-like 21 | system, you can do it with the command 22 | 23 | `source .venv/bin/activate` 24 | 25 | Finally, you need to install all the necessary Python dependencies for Automag 26 | with the command 27 | 28 | `pip install -r requirements.txt` 29 | 30 | Before using Automag, make sure that enumlib is installed on your system and 31 | that that your command line has access to the commands `enum.x` and `makeStr.py`. 32 | In addition, Automag needs to know how to use VASP, so you need to edit the file 33 | `automag/ase/run_vasp.py` for Automag to correctly load the MKL and MPI libraries 34 | (if needed) and call the `vasp_std` executable on your system. Then add the 35 | following lines to your `~/.bashrc` file 36 | 37 | `export PYTHONPATH=/PATH/TO/automag:$PYTHONPATH` 38 | `export VASP_SCRIPT=/PATH/TO/automag/ase/run_vasp.py` 39 | `export VASP_PP_PATH=/PATH/TO/pp` 40 | `export AUTOMAG_PATH=/PATH/TO/automag` 41 | 42 | obviously replacing `/PATH/TO` with the actual path to these files or directories. 43 | The `pp` folder is the VASP pseudopotential library and it should contain two 44 | subfolders named, respectively, `potpaw_LDA` and `potpaw_PBE`. 45 | 46 | Before starting to use Automag, you should also make sure to have the FireWorks 47 | library correctly pointing to a MongoDB database and configured for launching 48 | jobs through a queue management system (for more detailed information refer 49 | to the FireWorks documentation). Last but not least, open the file 50 | `automag/common/SubmitFirework.py` and edit line 23 with the location of your 51 | `my_launchpad.yaml` file. Now you are ready to use Automag. 52 | 53 | ## Convergence tests 54 | 55 | When studying a magnetic structure, you may want to start from convergence tests. 56 | Automag allows you to check for convergence of the VASP parameter `ENCUT`, which 57 | is the energy cut-off of the plane wave basis set, and to simultaneously check for 58 | convergence of the two parameters `SIGMA` and `kpts`, which are the electronic 59 | smearing parameter and the k-mesh resolution parameter for Brillouin zone sampling, 60 | respectively. 61 | 62 | In order to run convergence tests, go to the folder `0_conv_tests` and insert the 63 | following input parameters in the file `input.py`: 64 | 65 | - `mode` can be "encut" for convergence tests with respect to `ENCUT` or "kgrid" 66 | for convergence tests with respect to `SIGMA` and `kpts`; 67 | - `poscar_file` is the name of the file in POSCAR format which contains the input 68 | geometry and which has been put in the folder `automag/geometries`; 69 | - `params` is a collection of VASP parameters to be used during single-point 70 | energy calculations. 71 | 72 | In addition, the following optional parameters can be specified: 73 | 74 | - `magnetic_atoms` contains the atomic types to be considered magnetic (defaults 75 | to transition metals); 76 | - `configuration` is the magnetic configuration to use for convergence tests 77 | (defaults to ferromagnetic high-spin); 78 | - `encut_values` contains the trial values for `ENCUT` (defaults to the interval 79 | [500, 1000] eV at steps of 10 eV); 80 | - `sigma_values` contains the trial values for `SIGMA` (defaults to the interval 81 | [0.05, 0.20] eV at steps of 0.05 eV); 82 | - `kpts_values` contains the trial values for `kpts` (defaults to the interval 83 | [20, 100] A^-1 at steps of 10 A^-1). 84 | 85 | Once you have inserted the input parameters in the file `input.py`, launch the 86 | script `1_submit.py` using the `python` executable of your virtual environment and 87 | a number of workflows containing single-point VASP calculations will be saved in 88 | your remote database. These calculations need to be run in a separate directory 89 | called `CalcFold`. You can enter it and then submit the jobs with the following 90 | commands, being in the `automag` directory 91 | 92 | `cd CalcFold` 93 | `nohup qlaunch -r rapidfire -m 10 --nlaunches=infinite &` 94 | 95 | This will enter the directory `CalcFold` and it will invoke the `qlaunch` 96 | command in the background, which constantly checks for new calculations in the 97 | remote database and submits them to the queue management system of your cluster. 98 | The command line option `-m 10` means that `qlaunch` will allow a maximum number 99 | of 10 jobs to be in the queue of your system at the same time. If 10 or more 100 | jobs are waiting or running in your queue, `qlaunch` will not submit more jobs 101 | until their total number becomes less than 10. If you wish, you can change this 102 | parameter to a different number. In the following, I assume that the `qlaunch` 103 | process is always working in the background. 104 | 105 | After all calculations have been completed, you can launch the script named 106 | `2_plot_results.py` in the `0_conv_tests` folder. It will read the output file 107 | that Automag wrote in `CalcFold` and it will produce a plot of the parameters 108 | under study versus energy. In addition, the script will also print on screen the 109 | values of the parameters under study for which the error in energy is less than 110 | 1 meV/atom with respect to the most accurate result. 111 | 112 | ## Calculation of the electronic correlation parameter U by linear response 113 | 114 | The linear response formalism for the calculation of the Hubbard U is based on 115 | the application of a series of small perturbations to the first magnetic atom. 116 | During the whole process, the perturbed atom must be treated independently from 117 | the other atoms of the same species, and we achieve this using a simple trick: we 118 | change the chemical identity of the atom to which we want to apply perturbations 119 | to a dummy atomic species, but we place the POTCAR file of the original atomic 120 | species in the `pp` folder corresponding to the dummy atom. For example, if we are 121 | calculating the value of the Hubbard U for Fe in the system Fe12O18 and we choose 122 | Zn as dummy atom, we need to ensure that the same POTCAR file of Fe is used also 123 | for Zn in order to have, instead of Zn, a Fe atom that is treated independently 124 | from the others. This can be achieved with the following commands 125 | 126 | `cd $VASP_PP_PATH/potpaw_PBE/Zn` 127 | `mv POTCAR _POTCAR` 128 | `cp ../Fe/POTCAR .` 129 | 130 | In this way the Automag code, and in particular the ASE library, will treat the 131 | system as if it was ZnFe11O18, but when they will look for the POTCAR file in the 132 | `Zn` folder, they will find the POTCAR of Fe, so the system will remain Fe12O18. 133 | Before launching this calculation, go to the directory `1_lin_response` and set 134 | the necessary parameters in the file `input.py`: 135 | 136 | - `poscar_file` is the name of the file in POSCAR format which contains the input 137 | geometry and which has been put in the folder `automag/geometries`; 138 | - `dummy_atom` is the name of the dummy atomic species to use for the atom which 139 | is subject to perturbations (do not forget to manually put the right POTCAR file 140 | in the `pp` folder for this atom); 141 | - `dummy_position` is the position of the dummy atom in your POSCAR file (from 0 142 | to N - 1, where N is the number of atoms in the unit cell); 143 | - `perturbations` contains the values of the perturbations to apply to the chosen 144 | atom in eV; 145 | - `params` is a collection of VASP parameters to be used during single-point 146 | energy calculations. 147 | 148 | In addition, the following optional parameters can be specified: 149 | 150 | - `magnetic_atoms` contains the atomic types to be considered magnetic (defaults 151 | to transition metals); 152 | - `configuration` is the magnetic configuration to use for U calculation (defaults 153 | to ferromagnetic high-spin). 154 | 155 | Once the input parameters have been inserted in the file `input.py`, you can 156 | launch the script `1_submit.py` in order to save the necessary VASP jobs to the 157 | remote database. You will see that the instance of `qlaunch` which is running in 158 | the background will immediately send these jobs to the queue management system 159 | of your cluster. When all calculations are completed, you will find in `CalcFold` 160 | the file `charges.txt`, containing the amount of electrons on the partially 161 | occupied shell of the chosen atom for each value of the applied perturbation, 162 | for both the selfconsistent and the non-selfconsistent runs. Now you can execute 163 | the script `2_plot_results.py`, which will plot the selfconsistent and the 164 | non-selfconsistent responses, it will interpolate them as straight lines to the 165 | least squares and it will calculate their slopes. The value of U is obtained from 166 | U = 1/X - 1/X0, where X and X0 are the selfconsistent and the non-selfconsistent 167 | slopes, respectively. 168 | 169 | ## Search for the most stable magnetic state 170 | 171 | The search for the ground collinear magnetic state consists in generating a 172 | number of trial configurations and in computing their single-point energy, in 173 | order to determine which is the most thermodynamically stable. The trial 174 | configurations differ from each other only by the choice of the unit cell and by 175 | the initialization of the magnetic moments. Note that the value of the magnetic 176 | moment on each atom can change during the single-point energy calculation. 177 | Automag generates trial configurations by separately initializing each Wyckoff 178 | position occupied by magnetic atoms in a ferromagnetic (FM), antiferromagnetic 179 | (AFM) or non magnetic (NM) fashion, taking into account all possible combinations. 180 | A completely non-magnetic (NM) configuration is also generated. In this way, 181 | overall ferrimagnetic (FiM) states are allowed if the magnetic atoms occupy more 182 | than one Wyckoff position. For each magnetic atom, one or two absolute values for 183 | the magnetization can be given in input. In the first case, the given value is 184 | used for initializing all the spin-up and spin-down states in the configurations 185 | generated by Automag. Conversely, if two separate values are given for high-spin 186 | (HS) and low-spin (LS) states, then each Wyckoff position occupied by that 187 | magnetic atom is separately initialized in a HS or LS fashion, taking into account 188 | all possible combinations. In order to run such a calculation, go to the directory 189 | `2_coll` and set the necessary input parameters in the file `input.py`: 190 | 191 | - `poscar_file` is the name of the file in POSCAR format which contains the input 192 | geometry and which has been put in the folder `automag/geometries`; 193 | - `supercell_size` is the maximum supercell size for generating distinct magnetic 194 | configurations, in multiples of the input structure; 195 | - `spin_values` a maximum of two values (HS and LS) of the magnetization in Bohr 196 | magnetons for each magnetic atom, used to initialize spin-up and spin-down states; 197 | - `params` is a collection of VASP parameters to be used during single-point 198 | energy calculations. 199 | 200 | In addition, the following optional parameter can be specified: 201 | 202 | - `lower_cutoff` is the minimum value in Bohr magnetons to which a magnetic moment 203 | can fall in order for the corresponding configuration to be used for estimating 204 | the critical temperature of the material (defaults to zero). 205 | 206 | Once the input parameters have been inserted in the file `input.py`, you can 207 | launch the script `1_submit.py` in order to save the necessary VASP jobs to the 208 | remote database. The running instance of `qlaunch` will send these jobs to the 209 | queue management system of your cluster. Once all calculations have been 210 | completed, you can launch the script `2_plot_results.py` which will produce a 211 | number of files containing the histogram plot of the obtained energies for all 212 | trial configurations that successfully completed the single-point energy 213 | calculation. The script also prints on screen the name of the configuration 214 | with lowest energy. 215 | 216 | ## Calculation of the critical temperature 217 | 218 | Automag can calculate the critical temperature of the magnetically ordered to 219 | paramagnetic phase transition from a Monte Carlo simulation of the effective 220 | Hamiltonian which describes the magnetic interaction. Automag computes the 221 | coupling constants of the corresponding Heisenberg model and provides all the 222 | necessary input files to run the Monte Carlo simulation with the VAMPIRE software 223 | package. The simulation itself needs to be run by the user, while Automag can be 224 | used to plot and to fit the results. The accuracy of the Heisenberg model is 225 | evaluated by computing the Pearson Correlation Coefficient (PCC) between the 226 | DFT energies and the predicted energies of a control group of magnetic 227 | configurations. It is worth noting that this approach can be applied only if all 228 | magnetic atoms have the same absolute value of the magnetization. In order to 229 | estimate the critical temperature with Automag, go to the folder `3_monte_carlo` 230 | and set the necessary parameters in the file `input.py`: 231 | 232 | - `configuration` is the name of the magnetic configuration to use for the Monte 233 | Carlo simulation (usually you want to put here the name of the configuration with 234 | lowest energy, obtained at the previous step); 235 | - `cutoff_radius` is the maximum distance between two magnetic atoms to be 236 | considered as interacting neighbors; 237 | - `control_group_size` is the relative size of the control group used to evaluate 238 | the accuracy of the Heisenberg model; 239 | - `append_coupling_constants` is a boolean flag which tells Automag whether or not 240 | to append the computed values of the coupling constants to the file `input.py`, 241 | which are needed by the script `2_write_vampire_ucf.py`. 242 | 243 | In addition, the following optional parameter can be specified: 244 | 245 | - `magnetic_atoms` contains the atomic types to be considered magnetic (defaults 246 | to transition metals). 247 | 248 | Once the input parameters have been inserted in the file `input.py`, you can 249 | launch the script `1_coupling_constants.py`. It will compute the coupling 250 | constants for the given cutoff radius and it will print their values on screen. 251 | In addition, it will create a file `model.png`, which contains a plot of the 252 | Heisenberg model energies versus the DFT energies for all the configurations in 253 | the control group. The values of the distances between neighbors, the amounts of 254 | neighboring pairs of magnetic atoms in the unit cell at each distance and the 255 | value of the PCC are also printed on screen. 256 | 257 | We suggest to run the script `1_coupling_constants.py` a couple of times with the 258 | `append_coupling_constants` flag set to `False` and with different values of the 259 | `cutoff_radius`, in order to investigate how many neighbors you need to include 260 | for obtaining a well-converged Heisenberg model. Once you are satisfied with the 261 | model's accuracy, run the script a last time with the `append_coupling_constants` 262 | flag set to `True` and Automag will append the values of the coupling constants 263 | and the distances between neighbors to the file `input.py`. Now you are ready to 264 | run the script `2_write_vampire_ucf.py`, which will read the file `input.py` and 265 | will produce a VAMPIRE unit cell file `vamp.ucf`. Now you can run VAMPIRE on your 266 | cluster using the unit cell file written by Automag, an input file and a material 267 | file specific for your problem. Automag contains a sample input file and a sample 268 | material file in the folder `3_monte_carlo/vampire_input`, which can be simply 269 | edited and adapted to the problem under study. Once the VAMPIRE run is done, you 270 | can copy the `output` file in the folder `3_monte_carlo` and run the last script 271 | `3_plot_results.py`. It will produce a plot of the mean magnetization length (of 272 | the spin-up channel for antiferromagnetic materials) versus temperature obtained 273 | from the Monte Carlo simulation and it will fit the data using the analytical 274 | expression of the mean magnetization length, obtaining the values of the critical 275 | temperature and of the critical exponent. The fitted values of these two 276 | parameters are printed on screen. 277 | -------------------------------------------------------------------------------- /ase/run_vasp.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.ase.run_vasp 3 | ==================== 4 | 5 | Script which tells ase how to run VASP. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | import os 11 | 12 | # vasp 5 local 13 | # load_mkl = 'source /home/mgalasso/intel/compilers_and_libraries_2019.5.281/linux/mkl/bin/mklvars.sh intel64' 14 | # load_mpi = 'source /home/mgalasso/intel/compilers_and_libraries_2019.5.281/linux/mpi/intel64/bin/mpivars.sh intel64' 15 | # exitcode = os.system('{}; {}; mpirun -n 16 /home/mgalasso/softs/vasp.5.4.4/bin/vasp_std'.format(load_mkl, load_mpi)) 16 | 17 | # vasp 5 module 18 | # exitcode = os.system('module load intel/mkl-11.2.3 mpi/impi-5.0.3 vasp/vasp-5.4.4; mpirun vasp_std') 19 | 20 | # vasp 6 module 21 | exitcode = os.system('module load vasp/6.1.1; mpirun vasp_std') 22 | -------------------------------------------------------------------------------- /common/SubmitFirework.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.common.SubmitFirework 3 | ============================= 4 | 5 | Class which takes care of submitting FireWorks to the remote database. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | import numpy as np 11 | 12 | from copy import copy 13 | from ase.io import read 14 | from typing import Union 15 | from itertools import product 16 | from fireworks import LaunchPad, Firework, Workflow 17 | 18 | from common.utilities import atoms_to_encode, VaspCalculationTask, WriteOutputTask, WriteChargesTask 19 | 20 | 21 | # substitute with your launchpad file 22 | # launchpad = LaunchPad.from_file('/home/michele/.fireworks/my_launchpad.yaml') 23 | launchpad = LaunchPad.from_file('/home/mgalasso/.fireworks/my_launchpad.yaml') 24 | 25 | 26 | class SubmitFirework(object): 27 | def __init__(self, poscar_file: str, mode: str, fix_params: dict, magmoms: list, 28 | encut_values: Union[list, range] = None, sigma_values: Union[list, range] = None, 29 | kpts_values: Union[list, range] = None, pert_values: Union[list, range] = None, 30 | name: str = None, dummy_atom: str = None, dummy_position: int = None): 31 | if mode == 'encut': 32 | assert encut_values is not None 33 | assert sigma_values is None 34 | assert kpts_values is None 35 | assert pert_values is None 36 | assert dummy_atom is None 37 | assert dummy_position is None 38 | self.var_params = product(encut_values) 39 | elif mode == 'kgrid': 40 | assert encut_values is None 41 | assert sigma_values is not None 42 | assert kpts_values is not None 43 | assert pert_values is None 44 | assert dummy_atom is None 45 | assert dummy_position is None 46 | self.var_params = product(sigma_values, kpts_values) 47 | elif mode == 'perturbations': 48 | assert encut_values is None 49 | assert sigma_values is None 50 | assert kpts_values is None 51 | assert pert_values is not None 52 | assert dummy_atom is not None 53 | assert dummy_position is not None 54 | self.var_params = [] 55 | elif mode == 'singlepoint': 56 | assert encut_values is None 57 | assert sigma_values is None 58 | assert kpts_values is None 59 | assert pert_values is None 60 | assert dummy_atom is None 61 | assert dummy_position is None 62 | self.var_params = [] 63 | else: 64 | raise ValueError(f'Value of mode = {mode} not understood.') 65 | 66 | if mode == 'encut': 67 | self.energy_convergence = True 68 | else: 69 | self.energy_convergence = False 70 | 71 | self.magmoms = np.array(magmoms) 72 | self.mode = mode 73 | self.fix_params = fix_params 74 | self.poscar_file = poscar_file 75 | self.name = name 76 | self.pert_values = pert_values 77 | self.dummy_atom = dummy_atom 78 | self.dummy_position = dummy_position 79 | 80 | def submit(self): 81 | params = copy(self.fix_params) 82 | if self.var_params: 83 | for values in self.var_params: 84 | if len(values) == 1: 85 | if self.mode == 'encut': 86 | params['encut'] = values[0] 87 | # else: 88 | # params['ldauu'] = [values[0], 0, 0] 89 | # params['ldauj'] = [values[0], 0, 0] 90 | name = self.mode + str(values[0]) 91 | elif len(values) == 2: 92 | params['sigma'] = values[0] 93 | params['kpts'] = values[1] 94 | name = self.mode + str(values[0]) + '-' + str(values[1]) 95 | else: 96 | raise ValueError('Convergence tests for three parameters simultaneously are not supported.') 97 | 98 | self.add_wflow(params, name) 99 | else: 100 | if self.name is not None: 101 | self.add_wflow(params, f'{self.name}') 102 | else: 103 | self.add_wflow(params, self.mode) 104 | 105 | def add_wflow(self, params, name): 106 | # create an atoms object and encode it 107 | atoms = read(self.poscar_file) 108 | if self.mode == 'perturbations': 109 | ch_symbols = atoms.get_chemical_symbols() 110 | atom_ucalc = ch_symbols[self.dummy_position] 111 | ch_symbols[self.dummy_position] = self.dummy_atom 112 | atoms.set_chemical_symbols(ch_symbols) 113 | encode = atoms_to_encode(atoms) 114 | else: 115 | encode = atoms_to_encode(atoms) 116 | 117 | # here we will collect all fireworks of our workflow 118 | fireworks = [] 119 | 120 | if name == 'nm': 121 | # single-point run 122 | sp_firetask = VaspCalculationTask( 123 | calc_params=params, 124 | encode=encode, 125 | magmoms=self.magmoms, 126 | ) 127 | sp_firework = Firework( 128 | [sp_firetask], 129 | name='singlepoint', 130 | spec={'_pass_job_info': True}, 131 | fw_id=1 132 | ) 133 | fireworks.append([sp_firework]) 134 | else: 135 | # single-point run 136 | sp_firetask = VaspCalculationTask( 137 | calc_params=params, 138 | encode=encode, 139 | magmoms=self.magmoms, 140 | ) 141 | sp_firework = Firework( 142 | [sp_firetask], 143 | name='singlepoint', 144 | spec={'_pass_job_info': True}, 145 | fw_id=0 146 | ) 147 | fireworks.append([sp_firework]) 148 | 149 | # recalc run with magmoms from previous run 150 | recalc_firetask = VaspCalculationTask( 151 | calc_params=params, 152 | magmoms='previous', 153 | ) 154 | recalc_firework = Firework( 155 | [recalc_firetask], 156 | name='recalc', 157 | spec={'_pass_job_info': True}, 158 | fw_id=1, 159 | ) 160 | fireworks.append([recalc_firework]) 161 | 162 | if self.mode == 'perturbations': 163 | next_id = 2 164 | nsc_fireworks = [] 165 | sc_fireworks = [] 166 | out_fireworks = [] 167 | for perturbation in self.pert_values: 168 | nsc_firetask = VaspCalculationTask( 169 | calc_params=params, 170 | encode=encode, 171 | magmoms=self.magmoms, 172 | pert_step='NSC', 173 | pert_value=perturbation, 174 | dummy_atom=self.dummy_atom, 175 | atom_ucalc=atom_ucalc, 176 | ) 177 | 178 | nsc_firework = Firework( 179 | [nsc_firetask], 180 | name='nsc', 181 | spec={'_pass_job_info': True}, 182 | fw_id=next_id, 183 | ) 184 | 185 | nsc_fireworks.append(nsc_firework) 186 | next_id += 1 187 | 188 | sc_firetask = VaspCalculationTask( 189 | calc_params=params, 190 | encode=encode, 191 | magmoms=self.magmoms, 192 | pert_step='SC', 193 | pert_value=perturbation, 194 | dummy_atom=self.dummy_atom, 195 | atom_ucalc=atom_ucalc, 196 | ) 197 | 198 | sc_firework = Firework( 199 | [sc_firetask], 200 | name='sc', 201 | spec={'_pass_job_info': True}, 202 | fw_id=next_id, 203 | ) 204 | 205 | sc_fireworks.append(sc_firework) 206 | next_id += 1 207 | 208 | out_firetask = WriteChargesTask( 209 | filename='charges.txt', 210 | pert_value=perturbation, 211 | dummy_atom=self.dummy_atom, 212 | ) 213 | out_firework = Firework( 214 | [out_firetask], 215 | name='write_charges', 216 | spec={'_queueadapter': {'ntasks': 1, 'walltime': '00:30:00'}}, 217 | fw_id=next_id, 218 | ) 219 | 220 | out_fireworks.append(out_firework) 221 | next_id += 1 222 | 223 | fireworks.append(nsc_fireworks) 224 | fireworks.append(sc_fireworks) 225 | fireworks.append(out_fireworks) 226 | else: 227 | # write output 228 | output_firetask = WriteOutputTask( 229 | system=name, 230 | filename=f"{atoms.get_chemical_formula(mode='metal', empirical=True)}_{self.mode}.txt", 231 | initial_magmoms=self.magmoms, 232 | read_enthalpy=False, 233 | energy_convergence=self.energy_convergence, 234 | ) 235 | output_firework = Firework( 236 | [output_firetask], 237 | name='write_output', 238 | spec={'_queueadapter': {'ntasks': 1, 'walltime': '00:30:00'}}, 239 | fw_id=2, 240 | ) 241 | fireworks.append([output_firework]) 242 | 243 | # package the fireworks into a workflow and submit to the launchpad 244 | flat_fireworks = [fw for sublist in fireworks for fw in sublist] 245 | 246 | links_dict = {} 247 | for i, level in enumerate(fireworks[:-1]): 248 | next_level = fireworks[i + 1] 249 | if len(level) == 1: 250 | links_dict[level[0].fw_id] = [item.fw_id for item in next_level] 251 | elif len(next_level) == 1: 252 | for fw in level: 253 | links_dict[fw.fw_id] = [next_level[0].fw_id] 254 | else: 255 | for j, fw in enumerate(level): 256 | links_dict[fw.fw_id] = [next_level[j].fw_id] 257 | 258 | workflow = Workflow(flat_fireworks, name=name, links_dict=links_dict) 259 | launchpad.add_wf(workflow) 260 | -------------------------------------------------------------------------------- /common/utilities.py: -------------------------------------------------------------------------------- 1 | """ 2 | automag.common.utilities 3 | ======================== 4 | 5 | Classes and functions to efficiently handle FireWorks calculations. 6 | 7 | .. codeauthor:: Michele Galasso 8 | """ 9 | 10 | import os 11 | import json 12 | import shutil 13 | import numpy as np 14 | 15 | from ase import Atoms 16 | from ase.io import read 17 | from ase.calculators.vasp import Vasp 18 | from fireworks import FiretaskBase, explicit_serialize 19 | from pymatgen.core.structure import Structure 20 | from pymatgen.symmetry.analyzer import SpacegroupAnalyzer 21 | from pymatgen.core.periodic_table import Element 22 | from pymatgen.io.vasp import Incar, Outcar 23 | 24 | 25 | def atoms_to_encode(atoms): 26 | """ 27 | From Atoms to JSON. 28 | 29 | :param atoms: ase Atoms object. 30 | :return: JSON string. 31 | """ 32 | 33 | data = { 34 | 'cell': atoms.get_cell().tolist(), 35 | 'scaled_positions': atoms.get_scaled_positions().tolist(), 36 | 'numbers': atoms.get_atomic_numbers().tolist(), 37 | 'pbc': atoms.get_pbc().tolist(), 38 | } 39 | 40 | return json.dumps(data) 41 | 42 | 43 | def encode_to_atoms(encode): 44 | """ 45 | From JSON to Atoms. 46 | 47 | :param encode: JSON string. 48 | :return: ase Atoms object. 49 | """ 50 | data = json.loads(encode, encoding='utf-8') 51 | 52 | # construct the Atoms object 53 | atoms = Atoms( 54 | cell=data['cell'], 55 | scaled_positions=data['scaled_positions'], 56 | numbers=data['numbers'], 57 | pbc=data['pbc'], 58 | ) 59 | 60 | return atoms 61 | 62 | 63 | @explicit_serialize 64 | class VaspCalculationTask(FiretaskBase): 65 | """ 66 | Launches a VASP calculation with the given parameters. 67 | """ 68 | _fw_name = 'VaspCalculationTask' 69 | required_params = ['calc_params'] 70 | optional_params = ['encode', 'magmoms', 'pert_step', 'pert_value', 'dummy_atom', 'atom_ucalc'] 71 | 72 | def run_task(self, fw_spec): 73 | # if encode is given, use it as input structure 74 | if 'encode' in self: 75 | atoms = encode_to_atoms(self['encode']) 76 | 77 | # else, read the input structure from the output of the previous step 78 | else: 79 | job_info_array = fw_spec['_job_info'] 80 | prev_job_info = job_info_array[-1] 81 | atoms = read(os.path.join(prev_job_info['launch_dir'], 'OUTCAR')) 82 | 83 | if 'pert_step' in self: 84 | atom_ucalc = Element(self['atom_ucalc']) 85 | elem_list_sorted, indices = np.unique(atoms.get_chemical_symbols(), return_index=True) 86 | elem_list = elem_list_sorted[np.argsort(indices)] 87 | 88 | self['calc_params']['ldaul'] = [] 89 | self['calc_params']['ldauu'] = [] 90 | self['calc_params']['ldauj'] = [] 91 | for atom in elem_list: 92 | if atom == self['dummy_atom']: 93 | if atom_ucalc.is_transition_metal: 94 | self['calc_params']['ldaul'].append(2) 95 | elif atom_ucalc.is_lanthanoid or atom_ucalc.is_actinoid: 96 | self['calc_params']['ldaul'].append(3) 97 | else: 98 | raise ValueError(f"Cannot calculate U for the element {self['atom_ucalc']}") 99 | 100 | self['calc_params']['ldauu'].append(self['pert_value']) 101 | self['calc_params']['ldauj'].append(self['pert_value']) 102 | else: 103 | self['calc_params']['ldaul'].append(-1) 104 | self['calc_params']['ldauu'].append(0) 105 | self['calc_params']['ldauj'].append(0) 106 | 107 | self['calc_params']['ldau'] = True 108 | self['calc_params']['ldautype'] = 3 109 | 110 | job_info_array = fw_spec['_job_info'] 111 | prev_job_info = job_info_array[-1] 112 | shutil.copy(os.path.join(prev_job_info['launch_dir'], 'WAVECAR'), '.') 113 | 114 | # if pert_step is NSC, copy CHGCAR from previous step 115 | if self['pert_step'] == 'NSC': 116 | shutil.copy(os.path.join(prev_job_info['launch_dir'], 'CHGCAR'), '.') 117 | self['calc_params']['icharg'] = 11 118 | 119 | # if magnetic calculation 120 | if 'magmoms' in self: 121 | if self['magmoms'] == 'previous': 122 | assert 'encode' not in self 123 | magmoms = atoms.get_magnetic_moments().round() 124 | else: 125 | magmoms = np.array(self['magmoms']) 126 | 127 | if magmoms.any(): 128 | # add the necessary VASP parameters 129 | self['calc_params']['lorbit'] = 11 130 | self['calc_params']['ispin'] = 2 131 | atoms.set_initial_magnetic_moments(magmoms) 132 | 133 | # convert any lists from the parameter settings into arrays 134 | keys = self['calc_params'] 135 | for k, v in keys.items(): 136 | if isinstance(v, list): 137 | keys[k] = np.asarray(v) 138 | 139 | # initialize and run VASP 140 | calc = Vasp(**self['calc_params']) 141 | calc.calculate(atoms) 142 | 143 | # save information about convergence 144 | with open('is_converged', 'w') as f1: 145 | for filename in os.listdir('.'): 146 | if filename.endswith('.out'): 147 | with open(filename, 'r') as f2: 148 | if calc.converged is False and 'fatal error in bracketing' not in f2.read(): 149 | f1.write('NONCONVERGED') 150 | else: 151 | f1.write('converged') 152 | 153 | 154 | @explicit_serialize 155 | class WriteOutputTask(FiretaskBase): 156 | """ 157 | Write a simple output file. 158 | 159 | The file contains the USPEX structure ID, information about convergence of each VASP run, 160 | chemical formula, final energy, initial and final magnetic moments for magnetic calculations. 161 | """ 162 | _fw_name = 'WriteOutputTask' 163 | required_params = ['system', 'filename', 'read_enthalpy', 'energy_convergence'] 164 | optional_params = ['initial_magmoms'] 165 | 166 | def run_task(self, fw_spec): 167 | job_info_array = fw_spec['_job_info'] 168 | output_line = '{:12s} '.format(self['system']) 169 | output_line += '{:4d} '.format(job_info_array[0]['fw_id']) 170 | 171 | for job_info in job_info_array: 172 | with open(os.path.join(job_info['launch_dir'], 'is_converged'), 'r') as f: 173 | output_line += '{:>6s}={:12s} '.format(job_info['name'], f.readline()) 174 | 175 | atoms_final = read(os.path.join(job_info_array[-1]['launch_dir'], 'OUTCAR')) 176 | output_line += '{:12s} '.format(atoms_final.get_chemical_formula(mode='metal')) 177 | 178 | structure = Structure.from_file(os.path.join(job_info_array[-1]['launch_dir'], 'CONTCAR')) 179 | analyzer = SpacegroupAnalyzer(structure) 180 | output_line += '{:10s} '.format(analyzer.get_space_group_symbol()) 181 | 182 | if self['energy_convergence']: 183 | errors = [] 184 | with open(os.path.join(job_info_array[-1]['launch_dir'], 'OUTCAR'), 'r') as f: 185 | for line in f: 186 | if 'kinetic energy error' in line: 187 | errors.append(float(line.split()[5])) 188 | 189 | _, indices, counts = np.unique(atoms_final.numbers, return_index=True, return_counts=True) 190 | num_ions = counts[np.argsort(indices)] 191 | correction = sum(np.multiply(errors, num_ions)) 192 | else: 193 | correction = 0 194 | 195 | if self['read_enthalpy']: 196 | # get enthalpy from OUTCAR 197 | with open(os.path.join(job_info_array[-1]['launch_dir'], 'OUTCAR'), 'r') as f: 198 | for line in f: 199 | if 'enthalpy' in line: 200 | enthalpy_line = line 201 | 202 | output_line += 'enthalpy={}\n'.format(float(enthalpy_line.split()[4]) + correction) 203 | else: 204 | output_line += 'energy={}\n'.format(atoms_final.get_potential_energy() + correction) 205 | 206 | if 'initial_magmoms' in self: 207 | magmoms = np.array(self['initial_magmoms']) 208 | output_line += ' initial_magmoms={} '.format(np.array2string(magmoms, 10000)) 209 | 210 | try: 211 | magmoms_final = atoms_final.get_magnetic_moments() 212 | except: 213 | magmoms_final = np.zeros(len(magmoms)) 214 | 215 | output_line += 'final_magmoms={}\n'.format(np.array2string(magmoms_final, 10000)) 216 | 217 | with open(os.path.join(os.environ.get('AUTOMAG_PATH'), 'CalcFold', self['filename']), 'a') as f: 218 | f.write(output_line) 219 | 220 | @explicit_serialize 221 | class WriteChargesTask(FiretaskBase): 222 | """ 223 | Write charges for U calculation. 224 | """ 225 | _fw_name = 'WriteChargesTask' 226 | required_params = ['filename', 'pert_value', 'dummy_atom'] 227 | 228 | def run_task(self, fw_spec): 229 | write_output = True 230 | job_info_array = fw_spec['_job_info'] 231 | 232 | # get dummy index 233 | with open(os.path.join(job_info_array[-1]['launch_dir'], 'POSCAR'), 'rt') as f: 234 | poscar_lines = f.readlines() 235 | elem_list = poscar_lines[0].split() 236 | try: 237 | num_ions = [int(item) for item in poscar_lines[5].split()] 238 | except ValueError: 239 | num_ions = [int(item) for item in poscar_lines[6].split()] 240 | 241 | dummy_index = 0 242 | for elem, amount in zip(elem_list, num_ions): 243 | if elem == self['dummy_atom']: 244 | if amount == 1: 245 | break 246 | else: 247 | raise ValueError('More than one dummy atom in the structure') 248 | else: 249 | dummy_index += amount 250 | 251 | # get charges 252 | charges = [] 253 | incar_bare = Incar.from_file(os.path.join(job_info_array[0]['launch_dir'], 'INCAR')) 254 | outcar_bare = Outcar(os.path.join(job_info_array[0]['launch_dir'], 'OUTCAR')) 255 | bare_magmoms = [item['tot'] for item, ref in zip(outcar_bare.magnetization, incar_bare['MAGMOM']) if ref != 0] 256 | for step in [1, 2]: 257 | outcar = Outcar(os.path.join(job_info_array[step]['launch_dir'], 'OUTCAR')) 258 | with open(os.path.join(job_info_array[step]['launch_dir'], 'is_converged'), 'r') as f: 259 | conv_info = f.readline() 260 | 261 | if 'f' in outcar.charge[dummy_index]: 262 | charges.append(outcar.charge[dummy_index]['f']) 263 | else: 264 | charges.append(outcar.charge[dummy_index]['d']) 265 | 266 | final_magmoms = [item['tot'] for item, ref in zip(outcar.magnetization, incar_bare['MAGMOM']) if ref != 0] 267 | for bare_magmom, final_magmom in zip(bare_magmoms, final_magmoms): 268 | if bare_magmom != 0: 269 | # if the magnetic moment changes too much, do not write charges in output 270 | if final_magmom / bare_magmom < 0.5 or final_magmom / bare_magmom > 2.0 \ 271 | or conv_info == 'NONCONVERGED': 272 | write_output = False 273 | 274 | if write_output: 275 | with open(os.path.join(os.environ.get('AUTOMAG_PATH'), 'CalcFold', self['filename']), 'a') as f: 276 | f.write(f"{self['pert_value']:5.2f} {charges[0]} {charges[1]}\n") 277 | -------------------------------------------------------------------------------- /geometries/Ca3MnCoO6_primitive.vasp: -------------------------------------------------------------------------------- 1 | Ca6 Mn2 Co2 O12 2 | 1.0 3 | 6.3431482315 0.0000000000 0.0000000000 4 | -0.2294921521 6.3389954124 0.0000000000 5 | -0.2294921521 -0.2379508564 6.3345277826 6 | Ca Mn Co O 7 | 6 2 2 12 8 | Direct 9 | 0.887899995 0.612100005 0.250000000 10 | 0.612100005 0.250000000 0.887899995 11 | 0.250000000 0.887899995 0.612100005 12 | 0.387899995 0.750000000 0.112099998 13 | 0.750000000 0.112099998 0.387899995 14 | 0.112099998 0.387899995 0.750000000 15 | 0.000000000 0.000000000 0.000000000 16 | 0.500000000 0.500000000 0.500000000 17 | 0.250000000 0.250000000 0.250000000 18 | 0.750000000 0.750000000 0.750000000 19 | 0.954800010 0.285899997 0.083300002 20 | 0.285899997 0.083300002 0.954800010 21 | 0.083300002 0.954800010 0.285899997 22 | 0.454800010 0.583299994 0.785899997 23 | 0.583299994 0.785899997 0.454800010 24 | 0.785899997 0.454800010 0.583299994 25 | 0.545199990 0.416700006 0.214100003 26 | 0.416700006 0.214100003 0.545199990 27 | 0.214100003 0.545199990 0.416700006 28 | 0.045200001 0.714100003 0.916700006 29 | 0.714100003 0.916700006 0.045200001 30 | 0.916700006 0.045200001 0.714100003 31 | -------------------------------------------------------------------------------- /geometries/Fe2O3-alpha_conventional.vasp: -------------------------------------------------------------------------------- 1 | 0.65.Fe2O3-alpha.mcif -- in P1.1 2 | 1.0 3 | 5.0350999832 0.0000000000 0.0000000000 4 | -2.5175499916 4.3605244961 0.0000000000 5 | 0.0000000000 0.0000000000 13.7580995560 6 | Fe O 7 | 12 18 8 | Direct 9 | 0.000000000 0.000000000 0.355320007 10 | 0.000000000 0.000000000 0.644680023 11 | 0.333332986 0.666666985 0.021987000 12 | 0.666666985 0.333332986 0.688652992 13 | 0.333332986 0.666666985 0.311347008 14 | 0.666666985 0.333332986 0.978012979 15 | 0.000000000 0.000000000 0.144679993 16 | 0.000000000 0.000000000 0.855319977 17 | 0.333332986 0.666666985 0.811347008 18 | 0.333332986 0.666666985 0.521987021 19 | 0.666666985 0.333332986 0.478013009 20 | 0.666666985 0.333332986 0.188653007 21 | 0.306180000 0.000000000 0.250000000 22 | 0.693820000 0.000000000 0.750000000 23 | 0.639513016 0.666666985 0.916666985 24 | 0.972846985 0.333332986 0.583333015 25 | 0.027153000 0.666666985 0.416667014 26 | 0.360487014 0.333332986 0.083333001 27 | 0.000000000 0.306180000 0.250000000 28 | 0.000000000 0.693820000 0.750000000 29 | 0.333332986 0.972846985 0.916666985 30 | 0.666666985 0.639513016 0.583333015 31 | 0.333332986 0.360487014 0.416667014 32 | 0.666666985 0.027153000 0.083333001 33 | 0.693820000 0.693820000 0.250000000 34 | 0.306180000 0.306180000 0.750000000 35 | 0.027153000 0.360487014 0.916666985 36 | 0.639513016 0.972846985 0.416667014 37 | 0.360487014 0.027153000 0.583333015 38 | 0.972846985 0.639513016 0.083333001 39 | -------------------------------------------------------------------------------- /geometries/Fe2O3-alpha_primitive.vasp: -------------------------------------------------------------------------------- 1 | Fe4 O6 2 | 1.0 3 | 5.4297738075 0.0000000000 0.0000000000 4 | 3.0952166576 4.4611744466 0.0000000000 5 | 3.0952172516 1.6197442292 4.1567418007 6 | Fe O 7 | 4 6 8 | Direct 9 | 0.355320007 0.355320007 0.355320007 10 | 0.644680023 0.644680023 0.644680023 11 | 0.144679993 0.144679993 0.144679993 12 | 0.855319977 0.855319977 0.855319977 13 | 0.943820000 0.556180000 0.250000000 14 | 0.056180000 0.443820000 0.750000000 15 | 0.556180000 0.250000000 0.943820000 16 | 0.443820000 0.750000000 0.056180000 17 | 0.250000000 0.943820000 0.556180000 18 | 0.750000000 0.056180000 0.443820000 19 | -------------------------------------------------------------------------------- /geometries/Ni3TeO6_primitive.vasp: -------------------------------------------------------------------------------- 1 | Ni3 Te1 O6 2 | 1.0 3 | 5.4524235725 0.0000000000 0.0000000000 4 | 3.0672457956 4.5078737830 0.0000000000 5 | 3.0672457637 1.6229217552 4.2055982233 6 | Ni Te O 7 | 3 1 6 8 | Direct 9 | 0.493420005 0.493420005 0.493420005 10 | 0.785600007 0.785600007 0.785600007 11 | 0.987320006 0.987320006 0.987320006 12 | 0.291500002 0.291500002 0.291500002 13 | 0.385399997 0.085699998 0.675400019 14 | 0.675400019 0.385399997 0.085699998 15 | 0.085699998 0.675400019 0.385399997 16 | 0.189400002 0.561699986 0.912999988 17 | 0.912999988 0.189400002 0.561699986 18 | 0.561699986 0.912999988 0.189400002 19 | -------------------------------------------------------------------------------- /geometries/Ni3TeO6_setting005_1x2x1.vasp: -------------------------------------------------------------------------------- 1 | Ni6 Te2 O12 2 | 1.0 3 | 5.1000003815 0.0000000000 0.0000000000 4 | 0.0000000000 19.2775192261 0.0000000000 5 | 2.5500001907 -1.3492406501 4.2055977680 6 | Ni Te O 7 | 12 4 24 8 | Direct 9 | 0.753289998 0.370065004 0.493420005 10 | 0.753289998 0.870064974 0.493420005 11 | 0.253289998 0.120065004 0.493420005 12 | 0.253289998 0.620064974 0.493420005 13 | 0.607200027 0.089199997 0.785600007 14 | 0.607200027 0.589200020 0.785600007 15 | 0.107199997 0.339199990 0.785600007 16 | 0.107199997 0.839200020 0.785600007 17 | 0.506340027 0.240490004 0.987320006 18 | 0.506340027 0.740490019 0.987320006 19 | 0.006340000 0.490489990 0.987320006 20 | 0.006340000 0.990489960 0.987320006 21 | 0.854250014 0.218624994 0.291500002 22 | 0.854250014 0.718625009 0.291500002 23 | 0.354250014 0.468625009 0.291500002 24 | 0.354250014 0.968625009 0.291500002 25 | 0.812150002 0.286624998 0.675400019 26 | 0.812150002 0.786625028 0.675400019 27 | 0.312150002 0.036625002 0.675400019 28 | 0.312150002 0.536625028 0.675400019 29 | 0.102150001 0.286624998 0.085699998 30 | 0.102150001 0.786625028 0.085699998 31 | 0.602150023 0.036625002 0.085699998 32 | 0.602150023 0.536625028 0.085699998 33 | 0.512449980 0.286624998 0.385399997 34 | 0.512449980 0.786625028 0.385399997 35 | 0.012450000 0.036625002 0.385399997 36 | 0.012450000 0.536625028 0.385399997 37 | 0.357349992 0.416025013 0.912999988 38 | 0.357349992 0.916025043 0.912999988 39 | 0.857349992 0.166024998 0.912999988 40 | 0.857349992 0.666024983 0.912999988 41 | 0.080949999 0.416025013 0.561699986 42 | 0.080949999 0.916025043 0.561699986 43 | 0.580950022 0.166024998 0.561699986 44 | 0.580950022 0.666024983 0.561699986 45 | 0.729650021 0.416025013 0.189400002 46 | 0.729650021 0.916025043 0.189400002 47 | 0.229650006 0.166024998 0.189400002 48 | 0.229650006 0.666024983 0.189400002 49 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ase 2 | bcrypt 3 | certifi 4 | cffi 5 | chardet 6 | click 7 | cryptography 8 | cycler 9 | dataclasses 10 | decorator 11 | dnspython 12 | fabric 13 | FireWorks 14 | Flask 15 | flask-paginate 16 | future 17 | gunicorn 18 | idna 19 | invoke 20 | itsdangerous 21 | Jinja2 22 | kiwisolver 23 | MarkupSafe 24 | matplotlib 25 | monty 26 | mpmath 27 | networkx 28 | numpy 29 | palettable 30 | pandas 31 | paramiko 32 | Pillow 33 | pip 34 | plotly 35 | pycparser 36 | pymatgen 37 | pymongo 38 | PyNaCl 39 | pyparsing 40 | python-dateutil 41 | pytz 42 | requests 43 | retrying 44 | ruamel.yaml 45 | ruamel.yaml.clib 46 | scipy 47 | setuptools 48 | six 49 | spglib 50 | sympy 51 | tabulate 52 | tqdm 53 | uncertainties 54 | urllib3 55 | Werkzeug 56 | wheel 57 | --------------------------------------------------------------------------------