{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Setting up an OPLS force field calculation\n\n\nSuppose, we define the ethanal molecule as extended xyz file\n(``172_ext.xyz``):\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. literalinclude:: ../../../examples/howtos/howto_io/172_ext.xyz\n\nThen we can read and view the structure using:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from ase.io.opls import OPLSStructure\nfrom ase.visualize import view\n\ns = OPLSStructure('172_ext.xyz')\nview(s) # view with real elements\nelements = {'CT': 'Si', 'HC': 'H', 'H1': 'He'}\nview(s.colored(elements)) # view with fake elements" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Defining the force field\n\nThe definitions of the force field can be stored in an Amber like style\n(``172_defs.par``):\n\n.. literalinclude:: ../../../examples/howtos/howto_io/172_defs.par\n\nWe can write LAMMPS input using the information above:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from ase.io.opls import OPLSff, OPLSStructure\n\ns = OPLSStructure('172_ext.xyz')\nwith open('172_defs.par') as fd:\n opls = OPLSff(fd)\nopls.write_lammps(s, prefix='lmp')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "which writes the LAMMPS input files ``lmp_atoms`` defining atoms, bonds,\netc., and ``lmp_opls`` defining the corresponding OPLS force field. A\nrudimentary ``lmp_in`` is also written.\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.14.5" } }, "nbformat": 4, "nbformat_minor": 0 }