Getting Started

Your First Simulation

We will start by doing an ML-Relax Simulation, this uses an MLIP to relax a structure to its ground state geometry.

1. Preparing your Input File

We need a structure to start with, for this example, we'll be using copper.

You can copy the copper structure below as Cu.cif. Alternatively, you can source your own structure from the Materials Project repository.

cu.cif
# generated using pymatgen
data_Cu
_symmetry_space_group_name_H-M   Fm-3m
_cell_length_a   3.57743067
_cell_length_b   3.57743067
_cell_length_c   3.57743067
_cell_angle_alpha   90.00000000
_cell_angle_beta   90.00000000
_cell_angle_gamma   90.00000000
_symmetry_Int_Tables_number   225
_chemical_formula_structural   Cu
_chemical_formula_sum   Cu4
_cell_volume   45.78399426
_cell_formula_units_Z   4
loop_
 _symmetry_equiv_pos_site_id
 _symmetry_equiv_pos_as_xyz
  1  'x, y, z'
  2  '-x, -y, -z'
  3  '-y, x, z'
  4  'y, -x, -z'
  5  '-x, -y, z'
  6  'x, y, -z'
  7  'y, -x, z'
  8  '-y, x, -z'
  9  'x, -y, -z'
  10  '-x, y, z'
  11  '-y, -x, -z'
  12  'y, x, z'
  13  '-x, y, -z'
  14  'x, -y, z'
  15  'y, x, -z'
  16  '-y, -x, z'
  17  'z, x, y'
  18  '-z, -x, -y'
  19  'z, -y, x'
  20  '-z, y, -x'
  21  'z, -x, -y'
  22  '-z, x, y'
  23  'z, y, -x'
  24  '-z, -y, x'
  25  '-z, x, -y'
  26  'z, -x, y'
  27  '-z, -y, -x'
  28  'z, y, x'
  29  '-z, -x, y'
  30  'z, x, -y'
  31  '-z, y, x'
  32  'z, -y, -x'
  33  'y, z, x'
  34  '-y, -z, -x'
  35  'x, z, -y'
  36  '-x, -z, y'
  37  '-y, z, -x'
  38  'y, -z, x'
  39  '-x, z, y'
  40  'x, -z, -y'
  41  '-y, -z, x'
  42  'y, z, -x'
  43  '-x, -z, -y'
  44  'x, z, y'
  45  'y, -z, -x'
  46  '-y, z, x'
  47  'x, -z, y'
  48  '-x, z, -y'
  49  'x+1/2, y+1/2, z'
  50  '-x+1/2, -y+1/2, -z'
  51  '-y+1/2, x+1/2, z'
  52  'y+1/2, -x+1/2, -z'
  53  '-x+1/2, -y+1/2, z'
  54  'x+1/2, y+1/2, -z'
  55  'y+1/2, -x+1/2, z'
  56  '-y+1/2, x+1/2, -z'
  57  'x+1/2, -y+1/2, -z'
  58  '-x+1/2, y+1/2, z'
  59  '-y+1/2, -x+1/2, -z'
  60  'y+1/2, x+1/2, z'
  61  '-x+1/2, y+1/2, -z'
  62  'x+1/2, -y+1/2, z'
  63  'y+1/2, x+1/2, -z'
  64  '-y+1/2, -x+1/2, z'
  65  'z+1/2, x+1/2, y'
  66  '-z+1/2, -x+1/2, -y'
  67  'z+1/2, -y+1/2, x'
  68  '-z+1/2, y+1/2, -x'
  69  'z+1/2, -x+1/2, -y'
  70  '-z+1/2, x+1/2, y'
  71  'z+1/2, y+1/2, -x'
  72  '-z+1/2, -y+1/2, x'
  73  '-z+1/2, x+1/2, -y'
  74  'z+1/2, -x+1/2, y'
  75  '-z+1/2, -y+1/2, -x'
  76  'z+1/2, y+1/2, x'
  77  '-z+1/2, -x+1/2, y'
  78  'z+1/2, x+1/2, -y'
  79  '-z+1/2, y+1/2, x'
  80  'z+1/2, -y+1/2, -x'
  81  'y+1/2, z+1/2, x'
  82  '-y+1/2, -z+1/2, -x'
  83  'x+1/2, z+1/2, -y'
  84  '-x+1/2, -z+1/2, y'
  85  '-y+1/2, z+1/2, -x'
  86  'y+1/2, -z+1/2, x'
  87  '-x+1/2, z+1/2, y'
  88  'x+1/2, -z+1/2, -y'
  89  '-y+1/2, -z+1/2, x'
  90  'y+1/2, z+1/2, -x'
  91  '-x+1/2, -z+1/2, -y'
  92  'x+1/2, z+1/2, y'
  93  'y+1/2, -z+1/2, -x'
  94  '-y+1/2, z+1/2, x'
  95  'x+1/2, -z+1/2, y'
  96  '-x+1/2, z+1/2, -y'
  97  'x+1/2, y, z+1/2'
  98  '-x+1/2, -y, -z+1/2'
  99  '-y+1/2, x, z+1/2'
  100  'y+1/2, -x, -z+1/2'
  101  '-x+1/2, -y, z+1/2'
  102  'x+1/2, y, -z+1/2'
  103  'y+1/2, -x, z+1/2'
  104  '-y+1/2, x, -z+1/2'
  105  'x+1/2, -y, -z+1/2'
  106  '-x+1/2, y, z+1/2'
  107  '-y+1/2, -x, -z+1/2'
  108  'y+1/2, x, z+1/2'
  109  '-x+1/2, y, -z+1/2'
  110  'x+1/2, -y, z+1/2'
  111  'y+1/2, x, -z+1/2'
  112  '-y+1/2, -x, z+1/2'
  113  'z+1/2, x, y+1/2'
  114  '-z+1/2, -x, -y+1/2'
  115  'z+1/2, -y, x+1/2'
  116  '-z+1/2, y, -x+1/2'
  117  'z+1/2, -x, -y+1/2'
  118  '-z+1/2, x, y+1/2'
  119  'z+1/2, y, -x+1/2'
  120  '-z+1/2, -y, x+1/2'
  121  '-z+1/2, x, -y+1/2'
  122  'z+1/2, -x, y+1/2'
  123  '-z+1/2, -y, -x+1/2'
  124  'z+1/2, y, x+1/2'
  125  '-z+1/2, -x, y+1/2'
  126  'z+1/2, x, -y+1/2'
  127  '-z+1/2, y, x+1/2'
  128  'z+1/2, -y, -x+1/2'
  129  'y+1/2, z, x+1/2'
  130  '-y+1/2, -z, -x+1/2'
  131  'x+1/2, z, -y+1/2'
  132  '-x+1/2, -z, y+1/2'
  133  '-y+1/2, z, -x+1/2'
  134  'y+1/2, -z, x+1/2'
  135  '-x+1/2, z, y+1/2'
  136  'x+1/2, -z, -y+1/2'
  137  '-y+1/2, -z, x+1/2'
  138  'y+1/2, z, -x+1/2'
  139  '-x+1/2, -z, -y+1/2'
  140  'x+1/2, z, y+1/2'
  141  'y+1/2, -z, -x+1/2'
  142  '-y+1/2, z, x+1/2'
  143  'x+1/2, -z, y+1/2'
  144  '-x+1/2, z, -y+1/2'
  145  'x, y+1/2, z+1/2'
  146  '-x, -y+1/2, -z+1/2'
  147  '-y, x+1/2, z+1/2'
  148  'y, -x+1/2, -z+1/2'
  149  '-x, -y+1/2, z+1/2'
  150  'x, y+1/2, -z+1/2'
  151  'y, -x+1/2, z+1/2'
  152  '-y, x+1/2, -z+1/2'
  153  'x, -y+1/2, -z+1/2'
  154  '-x, y+1/2, z+1/2'
  155  '-y, -x+1/2, -z+1/2'
  156  'y, x+1/2, z+1/2'
  157  '-x, y+1/2, -z+1/2'
  158  'x, -y+1/2, z+1/2'
  159  'y, x+1/2, -z+1/2'
  160  '-y, -x+1/2, z+1/2'
  161  'z, x+1/2, y+1/2'
  162  '-z, -x+1/2, -y+1/2'
  163  'z, -y+1/2, x+1/2'
  164  '-z, y+1/2, -x+1/2'
  165  'z, -x+1/2, -y+1/2'
  166  '-z, x+1/2, y+1/2'
  167  'z, y+1/2, -x+1/2'
  168  '-z, -y+1/2, x+1/2'
  169  '-z, x+1/2, -y+1/2'
  170  'z, -x+1/2, y+1/2'
  171  '-z, -y+1/2, -x+1/2'
  172  'z, y+1/2, x+1/2'
  173  '-z, -x+1/2, y+1/2'
  174  'z, x+1/2, -y+1/2'
  175  '-z, y+1/2, x+1/2'
  176  'z, -y+1/2, -x+1/2'
  177  'y, z+1/2, x+1/2'
  178  '-y, -z+1/2, -x+1/2'
  179  'x, z+1/2, -y+1/2'
  180  '-x, -z+1/2, y+1/2'
  181  '-y, z+1/2, -x+1/2'
  182  'y, -z+1/2, x+1/2'
  183  '-x, z+1/2, y+1/2'
  184  'x, -z+1/2, -y+1/2'
  185  '-y, -z+1/2, x+1/2'
  186  'y, z+1/2, -x+1/2'
  187  '-x, -z+1/2, -y+1/2'
  188  'x, z+1/2, y+1/2'
  189  'y, -z+1/2, -x+1/2'
  190  '-y, z+1/2, x+1/2'
  191  'x, -z+1/2, y+1/2'
  192  '-x, z+1/2, -y+1/2'
loop_
 _atom_type_symbol
 _atom_type_oxidation_number
  Cu0+  0.0
loop_
 _atom_site_type_symbol
 _atom_site_label
 _atom_site_symmetry_multiplicity
 _atom_site_fract_x
 _atom_site_fract_y
 _atom_site_fract_z
 _atom_site_occupancy
  Cu0+  Cu0  4  0.00000000  0.00000000  0.00000000  1

2. Performing an ML Relax

Here's a simple example that uploads a .cif file, performs an ML structural relaxation, then downloads the final geometry.

main.py
import time
from atomict.infra import SimulationAction
from atomict.project import create_project
from atomict.user.files import upload_single_file, download_file
from atomict.simulation.mlrelax import create_mlrelaxation, get_mlrelax_files
from atomict import list_clusters
from atomict.simulation.models import MODEL_ESEN_30M_OAM

project = create_project(
    name="My first project",
    description="Optimised geometry of 2x2x2 Cu supercell using ML relax"
)

upload = upload_single_file(
    "/path/to/Cu.cif",            # the path of the .cif file you have retrieved
    project_id=project['id']      # specify the project to upload to
)

# Retrieve a list of worker clusters to perform the compute on
clusters = list_clusters()

mlrelax = create_mlrelaxation(
    project_id = project["id"],
    source_geometry_id = upload["UserUpload"]["id"],
    action=SimulationAction.LAUNCH,  # choice between SAVE_DRAFT and LAUNCH
    f_max=0.05,                      # in eV/Atom, stopping point for the optimiser
    model=MODEL_ESEN_30M_OAM,        # model selection is available as keys
    extra_simulation_kwargs={
        "selected_cluster": clusters[0]["id"]
    }
)

time.sleep(60)

files = get_mlrelax_files(mlrelax["id"])
relax_output = files["results"][0]["user_upload"]["uuid"]

download_file(
    user_upload_uuid=relax_output,
    destination_path="relaxed_Cu.cif"
)
  • How do I choose an MLIP?
  • What are my options for finding a starting structure?