Get started
To get started, we provide show how to use different capabilities of MLatom on an example of geometry optimization.
Using input file
Below is an example to use the command-line options or input file to run some calculations on the XACS cloud.
MLatom can be run in the command line format using the command-line options or input file.
To optimize geometry using the ANI-1ccx method, you can use the input file geomopt.inp
which you can download or copy-paste from:
ANI-1ccx # pre-trained model
geomopt # requests geometry optimization
xyzfile=init.xyz # initial geometry guess
optxyz=opt.xyz # file with optimized geometry
This input requires you to provide init.xyz
file (which you need to upload as auxiliary file on XACS cloud)
Note
This self-contained input file without the need to provide auxiliary file also works:
ANI-1ccx # pre-trained model
geomopt # requests geometry optimization
xyzfile='
8
C 0.0000000000000 0.0000000000000 0.7608350816719
H -0.0000000000000 1.0182031026887 1.1438748775511
H 0.8817897531403 -0.5091015513443 1.1438748775511
H -0.8817897531403 -0.5091015513443 1.1438748775511
C -0.0000000000000 -0.0000000000000 -0.7608350816719
H -0.8817897531403 0.5091015513443 -1.1438748775511
H 0.8817897531403 0.5091015513443 -1.1438748775511
H -0.0000000000000 -1.0182031026887 -1.1438748775511
'
Then run MLatom simulations using this input file as:
mlatom geomopt.inp &> geomopt.out
The program will print out the relevant calculation information to the output file geomopt.out
.
Using PyAPI
You can also use PyAPI on the XACS cloud. Below is an example of Python script using MLatom to optimize geometry at ANI-1ccx – the simulation task the same as in the above example with command-line execution:
import mlatom as ml # import MLatom module.
ani = ml.models.methods(method='ANI-1ccx') # denfine an ANI-1cxx model.
init_mol = ml.data.molecule.from_xyz_file('init.xyz') # load the molecular structure.
final_mol = ml.optimize_geometry(model=ani, initial_molecule=init_mol).optimized_molecule # the optimized structure can be obtained by command.
final_mol.xyz_coordinates # we can see the coordinates of the last molecule.
print(final_mol.get_xyz_string()) # print the coordinates in ".xyz" format.
final_mol.write_file_with_xyz_coordinates(filename='opt.xyz') # save it in "final.xyz".