{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Implemented pyGromosPP programs\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ran_Box\n",
    "The program ran_box can generate liquid conformations from a single molecule topology and coordinate file. In the following notebook we show an example for the ussage of this program."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from pygromos.gromos.pyGromosPP.ran_box import ran_box\n",
    "from pygromos.files.coord.cnf import Cnf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# define the paths to the single molecule topology and the single molecule conformation file\n",
    "root_dir = os.path.abspath(\"../example_files/tool_examples\")\n",
    "in_cnf_path = root_dir +\"/ran_box.cnf\"\n",
    "in_top_path = root_dir +\"/ran_box.top\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#define some properties for the new liquid conformation\n",
    "nmols=150 #42 #The number of molecules in the liquid box\n",
    "dens=1000 #The density of the liquid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#execute ran_box\n",
    "out_cnf = ran_box(in_top_path= in_top_path,\n",
    "        in_cnf_path= in_cnf_path,\n",
    "        out_cnf_path= root_dir+\"/out_ran_\"+str(nmols)+\"mol.cnf\",\n",
    "        nmolecule = nmols,\n",
    "        dens = dens)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#write the conformation to a pdb file\n",
    "cnfF = Cnf(out_cnf)\n",
    "cnfF.write_pdb(out_cnf.replace(\".cnf\", \".pdb\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# printing the new liquid conformation. The pdb can visualized with software packages like pymol.\n",
    "cnfF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "cnfF.view"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}