Usage of PyGromosTools on HPC-cluster

Note that you need support for the new PyGromosTools submission system shipped with relase3.


Note: This notebook only works, if you have the LSF submission system on the machine you are unsing it on! ***

[1]:
# necessary imports are the Gromos_System and convenience functions emin and md
from pygromos.simulations.hpc_queuing.submission_systems import lsf
from pygromos.files.gromos_system.gromos_system import Gromos_System
from pygromos.simulations.modules.preset_simulation_modules import emin, md

submission_system = lsf.LSF(nmpi=3) # this is for IBMs job queue!

Initialization

Set up path to binaries and instantiate an initial Gromos_System object

[2]:
# binaries
gromosPP = None
gromosXX = None

# folders and title
system_name = "menthol-dmf-example"
work_folder = f"examples/example_files/{system_name}"

# files
in_cnf_path = f"example_files/submission-system-files/{system_name}-all-atom_54a7.cnf"
in_top_path = f"example_files/submission-system-files/{system_name}-all-atom_54a7.top"

# system
system = Gromos_System(
    work_folder,
    system_name,
    in_top_path=in_top_path,
    in_cnf_path=in_cnf_path,
    in_gromosPP_bin_dir=gromosPP,
    in_gromosXX_bin_dir=gromosXX,
    submission_system=submission_system,
    verbose=False
)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/3952356644.py in <module>
     12
     13 # system
---> 14 system = Gromos_System(
     15     work_folder,
     16     system_name,

TypeError: __init__() got an unexpected keyword argument 'submission_system'

Energy minimization

Take advantage of the new submission system: convenience functions such as emin take in a parametrized Gromos_System object, automatically set up the calculation and return a new Gromos_System object with updated file paths.

[3]:
# run energy minimization
minimized_system = emin(system)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/2866156413.py in <module>
      1 # run energy minimization
----> 2 minimized_system = emin(system)

NameError: name 'system' is not defined

Visualize the minimized system

[5]:
minimized_system.cnf.view
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/2322670463.py in <module>
----> 1 minimized_system.cnf.view

NameError: name 'minimized_system' is not defined

Note: The new Gromos_System object has an .imd file associated (from the energy minimization). Using the object for a subsequent calculation requires the .imd to be reset (as shown below) or a new Imd object to be passed to the function md. Otherwise md will be based on the previous (emin) input file.

[6]:
# Reset the old imd from emin
minimized_system.imd = None
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/4187209246.py in <module>
      1 # Reset the old imd from emin
----> 2 minimized_system.imd = None

NameError: name 'minimized_system' is not defined

Equilibration followed by subsequent production runs

[7]:
md_system = md(minimized_system, equilibration_runs=1, simulation_runs=2)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/1992461589.py in <module>
----> 1 md_system = md(minimized_system, equilibration_runs=1, simulation_runs=2)

NameError: name 'minimized_system' is not defined

Again, note how the new Gromos_System object has new file paths associated with it.

[8]:
print(md_system.imd.path)
print(md_system.top.path)
print(md_system.cnf.path)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/2659777302.py in <module>
----> 1 print(md_system.imd.path)
      2 print(md_system.top.path)
      3 print(md_system.cnf.path)

NameError: name 'md_system' is not defined

Visualize the last configuration

[9]:
md_system.cnf.view
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5434/2628836130.py in <module>
----> 1 md_system.cnf.view

NameError: name 'md_system' is not defined