Beispiel #1
0
options_desc = OptionsList([
    Option("C",
           "commandhlrn",
           "choice",
           "parallel PBS executable HLRN3",
           choices=("aprun", "mpiexec", "none")),
    Option("Q",
           "queue",
           "choice",
           "queue for scheduling",
           choices=[
               "auto",
           ] + sorted(load_queues())),
    Option("N",
           "nodes",
           "int",
           "number of computing cluster nodes",
           default=2,
           min_value=1),
    Option("P",
           "ppn",
           "int",
           "number of processors per node",
           default=24,
           min_value=1),
    Option("W",
           "walltime",
           "float",
           "job-walltime in hours",
           default=1.0,
           min_value=0.1),
    Option("M", "email", "str", "email-address for notifications"),
    Option("D",
           "dryrun",
           "bool",
           "Only generates job-file, but does not submit it",
           default=False),
    Option("S",
           "subdivide",
           "int",
           "number of parallel zgf_mdrun processes started within the job",
           min_value=1,
           default=1),
    Option("A", "account", "str", "account to be debited"),
])
"""

from ZIBMolPy.utils import check_call
from ZIBMolPy.pool import Pool
from ZIBMolPy.ui import Option, OptionsList
from ZIBMolPy.io.trr import TrrFile

import sys
import os
import re
import numpy as np

from subprocess import Popen, PIPE

options_desc = OptionsList([
    Option("t", "trr", "bool", "concatenate trr files", default=False),
    Option("e", "edr", "bool", "concatenate edr files", default=False),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(pool.where("state == 'merge-able'")) > 0)


#===============================================================================
def main():

    options = options_desc.parse_args(sys.argv)[0]
    pool = Pool()
Beispiel #3
0
from subprocess import Popen, PIPE
import zgf_grompp

import sys
import re
from os import path
from os import remove
from os import symlink

options_desc = OptionsList([
    Option("c",
           "ignore-convergence",
           "bool",
           "rerun despite not-converged",
           default=False),
    Option("p",
           "pbc-removal",
           "choice",
           "method of pbc removal for desolvation",
           choices=("whole", "mol", "nojump", "none")),
    Option("g", "grompp", "file", extension="mdp", default="rerun.mdp"),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(pool) > 1 and len(
        pool.where(
            "isa_partition and state in ('converged','not-converged','mdrun-failed')"
def load_queues():
	try:
		p = subprocess.Popen(['qstat','-q'], stdout=subprocess.PIPE)
		stdout = p.communicate()[0]
		assert(p.returncode == 0)
		foo = re.match(".*\nQueue\s[^\n]*\n[- ]*(\n.*)", stdout, re.DOTALL).group(1)
		return( re.findall("\n(\w+)\s", foo) )
	except:
		return([])


options_desc = OptionsList([
	Option("Q", "queue", "choice", "queue for scheduling", choices=["auto",]+sorted(load_queues())),
	Option("N", "nodes", "int", "number of computing cluster nodes", default=2, min_value=1),
	Option("P", "ppn", "int", "number of processors per node", default=8, min_value=1),
	Option("W", "walltime", "float", "job-walltime in hours", default=1.0, min_value=0.1),
	Option("M", "email", "str", "email-address for notifications"),
	Option("D", "dryrun", "bool", "Only generates job-file, but does not submit it", default=False),
	Option("S", "subdivide", "int", "number of parallel zgf_mdrun processes started within the job", min_value=1, default=1),
])

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc


# reuse some options from zgf_mdrun
FORWARDED_ZGF_MDRUN_OPTIONS = ("seq", "npme", "reprod", "pd", "convtest", "auto-refines")
for x in FORWARDED_ZGF_MDRUN_OPTIONS:
	options_desc.append(zgf_mdrun.options_desc[x]) 

	
def is_applicable():
Beispiel #5
0
from ZIBMolPy.pool import Pool
import ZIBMolPy.topology as topology
from ZIBMolPy.ui import OptionsList
from ZIBMolPy.io.trr import TrrFile
from ZIBMolPy.gromacs import read_mdp_file

import sys
import os
import re
from tempfile import mktemp
from subprocess import Popen, PIPE
from math import degrees
import numpy as np
import shutil

options_desc = OptionsList()

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc

def is_applicable():
	pool = Pool()
	return(len(pool.where("state == 'created'")) > 0)

	
#===============================================================================
def main():
	
	pool = Pool()
	needy_nodes = pool.where("state == 'created'")
	assert(len(needy_nodes) == len(needy_nodes.multilock())) # make sure we lock ALL nodes 
	
Beispiel #6
0
import sys
import re
from subprocess import Popen, PIPE
import numpy as np
import shutil

import zgf_solvate_nodes
import zgf_grompp


#===============================================================================
options_desc = OptionsList([
	Option("p", "np", "int", "Number of positive ions", default=0, min_value=0),
	Option("P", "pname", "str", "Name of the positive ion", default="NA"),
	Option("n", "nn", "int", "Number of negative ions", default=0, min_value=0),
	Option("N", "nname", "str", "Name of the negative ion", default="CL"),
	Option("s", "random-seed", "str", "Seed for random number generator", default="1993"),
])

# reuse option from zgf_solvate_nodes
options_desc.append(zgf_solvate_nodes.options_desc["grompp"]) 

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc

def is_applicable():
	pool = Pool()
	return(len(pool.where("state == 'em-mdrun-able'")) > 0)

	
#===============================================================================
Beispiel #7
0
#PLATEAU_THRESHOLD = 0.001
PLATEAU_THRESHOLD = 0.02  # for phifit 'switch': smaller value = smaller plateaus
PLATEAU_BREAK = (
    np.pi /
    180) * 2  # for phifit 'switch': change in dihedral that breaks plateau

# fun parameters
THE_BIG_NUMBER = 99999.0  # is measured in [Chuck]

#===============================================================================
options_desc = OptionsList([
    Option("K",
           "numnodes",
           "int",
           "number of nodes to create",
           default=4,
           min_value=1),
    Option("p", "parent-node", "node", "parent-node"),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(pool) > 0)


#===============================================================================
# This method is also called from zgf_refine
Beispiel #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-


from ZIBMolPy.ui import Option, OptionsList
from ZIBMolPy.pool import Pool
import zgf_cleanup

import numpy as np
from scipy.io import savemat
from pprint import pformat
import sys


options_desc = OptionsList([
	Option("K", "numnodes", "int", "number of nodes to create", default=10, min_value=2),
	Option("m", "export-matlab", "bool", "export matrices as mat-files", default=False)
])

def is_applicable():
	pool = Pool()
	return( len(pool.where("'weight_direct' in obs")) > 0 and len(pool.where("isa_partition and 'weight_direct' not in obs")) == 0 )

	
#===============================================================================
#Equidistand nodes and free energy computation
def main():
	options = options_desc.parse_args(sys.argv)[0]
	zgf_cleanup.main()
	
	print("Options:\n%s\n"%pformat(eval(str(options))))
	
"""

from ZIBMolPy.pool import Pool
from ZIBMolPy.ui import Option, OptionsList

import zgf_cleanup

import sys

options_desc = OptionsList([
    Option("c",
           "current-state",
           "choice",
           "current state of nodes to recover",
           choices=("mdrun-failed", "ready", "converged", "not-converged",
                    "rerun-able-converged", "merge-able")),
    Option("r",
           "recover-state",
           "choice",
           "state that is to be recovered",
           choices=("mdrun-able", "em-mdrun-able", "converged",
                    "not-converged", "ready", "merge-able")),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    return (True)


#===============================================================================
Beispiel #10
0
options_desc = OptionsList([
    Option("c", "common-filename", "str",
           "Sets new, common default filenames for ALL options"),
    Option("s", "molecule", "file", extension="pdb", default="molecule.pdb"),
    Option("f",
           "presampling",
           "file",
           extension="trr",
           default="presampling.trr"),
    Option("g", "grompp", "file", extension="mdp", default="run.mdp"),
    Option("p", "topology", "file", extension="top", default="topol.top"),
    Option("n", "index", "file", extension="ndx", default="index.ndx"),

    # ZIBgridfree related options
    Option("I", "internals", "file", extension="int", default="internals.int"),
    Option("G", "gr-threshold", "float", "Gelman-Rubin threshold",
           default=1.1),
    Option("C",
           "gr-chains",
           "int",
           "Gelman-Rubin chains",
           default=5,
           min_value=1),
    Option("L",
           "balance-linears",
           "bool",
           "balance linear weights",
           default=False),
])
Beispiel #11
0
from ZIBMolPy.pool import Pool
import ZIBMolPy.topology as topology
from ZIBMolPy.ui import OptionsList
from ZIBMolPy.io.trr import TrrFile
from ZIBMolPy.gromacs import read_mdp_file

import sys
import os
import re
from tempfile import mktemp
from subprocess import Popen, PIPE
from math import degrees
import numpy as np
import shutil

options_desc = OptionsList()

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(pool.where("state == 'created'")) > 0)


#===============================================================================
def main():

    pool = Pool()
    needy_nodes = pool.where("state == 'created'")
    assert (len(needy_nodes) == len(needy_nodes.multilock())
from ZIBMolPy.ui import userinput, Option, OptionsList

import zgf_setup_nodes
import zgf_grompp

import sys

import os

import numpy as np

options_desc = OptionsList([
	Option("t", "transition-level", "choice", "transition level", choices=("clusters","nodes") ),
	Option("n", "num-tnodes", "int", "number of tnodes per node", default=1, min_value=1),
	Option("r", "num-runs", "int", "number of runs", default=5, min_value=0),
	Option("l", "sampling-length", "int", "length of sampling per run in ps", default=100, min_value=0),
	Option("s", "save-mode", "choice", "files to store", choices=("pdb","complete") ),
	Option("c", "coreset-power", "float", "ignore nodes with chi value higher than coreset-power ('clusters' only)", default=0.9, min_value=0.5),	
	Option("m", "min-nodes", "int", "min number of nodes to consider ('clusters' only)", default=3, min_value=1),
	])

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc

def is_applicable():
	pool = Pool()
	return(os.path.exists(pool.chi_mat_fn))
	

#===============================================================================
def main():
	options = options_desc.parse_args(sys.argv)[0]
import tempfile
import subprocess
from subprocess import check_call
import os
from os import path
import sys
import shutil
from ZIBMolPy.ui import userchoice, userinput, Option, OptionsList
from ZIBMolPy.io.topology import Topology, preprocess

options_desc = OptionsList([
    Option("p", "input_topology", "file", extension="top",
           default="topol.top"),
    Option("o",
           "output_topology",
           "file",
           extension="top",
           default="merged_topol.top"),
])


#===============================================================================
def main():
    (options, args) = options_desc.parse_args(sys.argv)
    assert (path.exists(options.input_topology))
    print("Preprocessing (only local includes): %s ..." %
          options.input_topology)
    rawdata = preprocess(options.input_topology,
                         includedirs=[])  #only local includes
Beispiel #14
0
from ZIBMolPy.pool import Pool
from ZIBMolPy.node import Node
from ZIBMolPy.ui import Option, OptionsList

import sys
import os
import re

import numpy as np
from scipy.io import savemat

options_desc = OptionsList([
    Option("m",
           "export-matlab",
           "bool",
           "export matrices as mat-files",
           default=False),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(pool.where("state == 'ready'")) > 0)


#===============================================================================
def main():
    options = options_desc.parse_args(sys.argv)[0]
Beispiel #15
0
from ZIBMolPy.algorithms import kmeans
from ZIBMolPy.pool import Pool
import zgf_create_nodes
import zgf_setup_nodes
import zgf_grompp
import zgf_cleanup

from copy import copy
import sys

options_desc = OptionsList([
    Option("r",
           "refine-all",
           "bool",
           "refine all not-converged nodes",
           default=False),
    Option("e",
           "extend-all",
           "bool",
           "extend all not-converged nodes",
           default=False),
])

# reuse some options from zgf_create_nodes
FORWARDED_ZGF_CREATE_NODES_OPTIONS = ("numnodes", "methodnodes",
                                      "methodalphas", "methodphifit",
                                      "random-seed")
for x in FORWARDED_ZGF_CREATE_NODES_OPTIONS:
    options_desc.append(copy(
        zgf_create_nodes.options_desc[x]))  # need copy to safely ...
options_desc["numnodes"].default = 2  # ... change default values
Beispiel #16
0
import re
from subprocess import Popen, PIPE
import numpy as np
import shutil

import zgf_solvate_nodes
import zgf_grompp

#===============================================================================
options_desc = OptionsList([
    Option("p", "np", "int", "Number of positive ions", default=0,
           min_value=0),
    Option("P", "pname", "str", "Name of the positive ion", default="NA"),
    Option("n", "nn", "int", "Number of negative ions", default=0,
           min_value=0),
    Option("N", "nname", "str", "Name of the negative ion", default="CL"),
    Option("s",
           "random-seed",
           "str",
           "Seed for random number generator",
           default="1993"),
])

# reuse option from zgf_solvate_nodes
options_desc.append(zgf_solvate_nodes.options_desc["grompp"])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
options_desc = OptionsList([
    Option("b",
           "bt",
           "choice",
           "Box type",
           choices=("dodecahedron", "octahedron", "triclinic", "cubic")),
    Option("x",
           "box-x",
           "float",
           "Box vector length (x)",
           default=3.0,
           min_value=0.0),
    Option("y",
           "box-y",
           "float",
           "Box vector length (y)",
           default=3.0,
           min_value=0.0),
    Option("z",
           "box-z",
           "float",
           "Box vector length (z)",
           default=3.0,
           min_value=0.0),
    Option("s",
           "solv-model",
           "choice",
           "Solvent model",
           choices=("tip3p", "tip4p", "tip4pew", "tip5p", "spc", "spce",
                    "acetonitrile")),
    Option("g", "grompp", "file", extension="mdp", default="em.mdp"),
])
Beispiel #18
0
How it works
============
	At the command line, type::
		$ zgf_export_nodes

"""

from ZIBMolPy.pool import Pool
from ZIBMolPy.ui import OptionsList, Option

import sys

#===============================================================================
options_desc = OptionsList([
    Option("o", "outfile", "file", default="pool.out"),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (pool.where("isa_partition and state != 'mdrun-failed'") > 0)


#===============================================================================
def main():
    options = options_desc.parse_args(sys.argv)[0]

    outfile = open(options.outfile, "w")
Beispiel #19
0
"""

from ZIBMolPy.utils import pformat
from ZIBMolPy.ui import OptionsList

#needed to eval pool-desc.txt
import datetime  #pylint: disable=W0611

import os
import sys
from os import path
from glob import glob
import re

options_desc = OptionsList([])


def is_applicable():
    return (False)  # run from command-line only


#===============================================================================
def main():
    #(options, args) = options_desc.parse_args(sys.argv)

    if (not path.isfile("pool-desc.txt")):
        sys.exit("Error: could not find pool-desc.txt")

    if (not path.isdir("nodes")):
        sys.exit("Error: could not find pool-desc.txt")
Beispiel #20
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ZIBMolPy.pool import Pool, NodeList
from ZIBMolPy.ui import userinput, Option, OptionsList
import shutil
import sys
from datetime import datetime

import zgf_create_nodes
import zgf_cleanup

options_desc = OptionsList([
	Option("n", "doomed_nodes", "node-list", "Nodes to remove", default=""),
	Option("A", "methodalphas", "choice", "method to determine alphas", choices=("theta", "user") ),
])

def is_applicable():
	pool = Pool()
	return( len(pool)>1 )
	
#===============================================================================
def main():
	options = options_desc.parse_args(sys.argv)[0]
	
	#TODO put somehow into Options, e.g. min_value=1 or required=True
	if(not options.doomed_nodes):
		sys.exit("Option --doomed_nodes is required.")
		
	pool = Pool()
	old_pool_size = len(pool)
Beispiel #21
0
from subprocess import call, Popen, PIPE
from warnings import warn
import traceback
import sys

import os
import re
import numpy as np

options_desc = OptionsList([ 
	Option("s", "seq", "bool", "Suppress MPI", default=False),
	Option("n", "np", "int", "Number of processors to be used for MPI (should be set instead 'nt'if mdrun_mpi is available)", default=1, min_value=1),
	Option("t", "nt", "int", "Number of threads to start, 0 is guess", default=0, min_value=0),
	Option("p", "npme", "int", "Number of separate processors to be used for PME, -1 is guess", default=-1, min_value=-1),
	Option("r", "reprod", "bool", "Avoid mdrun optimizations that affect binary reproducibility", default=False),
	Option("d", "pd", "bool", "Use particle decomposition", default=False),
	Option("c", "convtest", "bool", "Test if nodes are converged - does not simulate", default=False),
	Option("a", "auto-refines", "int", "Number of automatic refinements", default=0, min_value=0),
	Option("m", "multistart", "bool", "Sampling is restarted instead of extended", default=False),
	Option("x", "pbs", "choice", "change only if parallel PBS execution on HLRN3", choices=("none", "aprun","mpiexec"))
	])

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc


def is_applicable():
	pool = Pool()
	return(len(pool.where("state in ('em-mdrun-able', 'mdrun-able', 'converged', 'not-converged', 'rerun-able-converged', 'rerun-able-not-converged')")) > 0)
	

#===============================================================================
Beispiel #22
0
#PLATEAU_THRESHOLD = 0.001
PLATEAU_THRESHOLD = 0.02   # for phifit 'switch': smaller value = smaller plateaus
PLATEAU_BREAK = (np.pi/180)*2 # for phifit 'switch': change in dihedral that breaks plateau

# fun parameters
THE_BIG_NUMBER = 99999.0 # is measured in [Chuck]

#===============================================================================
options_desc = OptionsList([
	Option("N", "methodnodes", "choice", "method to determine nodes", choices=("kmeans", "equidist", "maxdist", "all")),
	Option("A", "methodalphas", "choice", "method to determine alphas", choices=("theta", "user") ),
	Option("K", "numnodes", "int", "number of nodes to create", default=10, min_value=0),
	Option("E", "ext-max", "int", "max. number of extensions if not converged", default=5, min_value=0),
	Option("L", "ext-length", "int", "length per extension in ps", default=100, min_value=1),
	Option("P", "methodphifit", "choice", "method to determine phi fit", choices=("switch", "harmonic", "leastsq") ),
	Option("p", "parent-node", "node", "parent-node", default="root"),
	Option("w", "write-preview", "bool", "write frames of new nodes as pdb-trajectory", default=False),
	Option("l", "sampling-length", "int", "length of the normal sampling in ps", default=100, min_value=0),
	Option("s", "random-seed", "str", "seed for random number generator"),
	
])

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc


def is_applicable():
	pool = Pool()
	return( len(pool)>0 )

#===============================================================================
from subprocess import Popen, PIPE
from tempfile import mktemp
from os import path
import numpy as np
import sys
import os

options_desc = OptionsList([
    Option("c",
           "node-threshold",
           "float",
           "threshold for node conformation membership, based on chi value",
           default=0.5),
    Option(
        "f",
        "frame-threshold",
        "float",
        "threshold for frame conformation membership, based on frame weight",
        default=0.5),
    Option("s",
           "write-sol",
           "bool",
           "write output trajectories with SOL",
           default=False),
])


def is_applicable():
    pool = Pool()
    return (path.exists(pool.chi_mat_fn))

Beispiel #24
0
"""

from ZIBMolPy.ui import userinput, userchoice, Option, OptionsList
from ZIBMolPy.algorithms import kmeans
from ZIBMolPy.pool import Pool
import zgf_create_nodes
import zgf_setup_nodes
import zgf_grompp
import zgf_cleanup

from copy import copy
import sys

options_desc = OptionsList([
	Option("r", "refine-all", "bool", "refine all not-converged nodes", default=False), 
	Option("e", "extend-all", "bool", "extend all not-converged nodes", default=False),
	])

# reuse some options from zgf_create_nodes
FORWARDED_ZGF_CREATE_NODES_OPTIONS = ("numnodes", "methodnodes", "methodalphas", "methodphifit", "random-seed")
for x in FORWARDED_ZGF_CREATE_NODES_OPTIONS:
	options_desc.append(copy(zgf_create_nodes.options_desc[x])) # need copy to safely ...
options_desc["numnodes"].default = 2 # ... change default values

sys.modules[__name__].__doc__ += options_desc.epytext() # for epydoc

def is_applicable():
	pool = Pool()
	return(len(pool.where("isa_partition and is_sampled")) > 0)

	
Beispiel #25
0
options_desc = OptionsList([
    Option("s", "seq", "bool", "Suppress MPI", default=False),
    Option("p",
           "np",
           "int",
           "Number of processors to be used for MPI",
           default=4,
           min_value=1),
    Option("c",
           "ignore-convergence",
           "bool",
           "reweight despite not-converged",
           default=False),
    Option("f",
           "ignore-failed",
           "bool",
           "reweight and ignore mdrun-failed nodes",
           default=False),
    Option("m",
           "method",
           "choice",
           "reweighting method",
           choices=("entropy", "direct", "presampling")),
    Option("z",
           "reminimize",
           "bool",
           "reminimize presampling frames",
           default=False),
    Option("b",
           "e-bonded",
           "choice",
           "bonded energy type",
           choices=("run_standard_potential", "run_standard_bondedterms",
                    "rerun_standard_potential", "rerun_standard_bondedterms",
                    "none")),
    Option("n",
           "e-nonbonded",
           "choice",
           "nonbonded energy type",
           choices=("none", "run_standard_nonbondedterms", "run_moi",
                    "run_moi_sol_sr", "run_moi_sol_lr", "run_custom",
                    "rerun_standard_nonbondedterms", "run_moi_sol_interact",
                    "rerun_moi_sol_interact", "run_moi_sol_interact_withLR",
                    "rerun_moi_sol_interact_withLR", "rerun_moi",
                    "rerun_moi_sol_sr", "rerun_moi_sol_lr", "rerun_custom")),
    Option("e",
           "custom-energy",
           "file",
           extension="txt",
           default="custom_energy.txt"),
    Option(
        "t", "presamp-temp", "float", "presampling temp", default=1000
    ),  #TODO maybe drop this and ask user instead... method has to be reworked anyway
    Option("r",
           "save-refpoints",
           "bool",
           "save refpoints in observables",
           default=False),
    Option("R",
           "check-restraint",
           "bool",
           "check if ZIBMolPy calculates the same restraint energy as Gromacs",
           default=False),
])
Beispiel #26
0
"""

from ZIBMolPy.ui import userinput, Option, OptionsList
from ZIBMolPy.pool import Pool, NodeList

from subprocess import Popen, PIPE
from tempfile import mktemp
from os import path
import traceback
import sys
import os

options_desc = OptionsList([
    Option("c",
           "ignore-convergence",
           "bool",
           "discard solvent despite not-converged",
           default=False),
])

sys.modules[__name__].__doc__ += options_desc.epytext()  # for epydoc


def is_applicable():
    pool = Pool()
    return (len(
        pool.where("state in ('converged', 'not-converged', 'refined')")) > 1)


#===============================================================================
def main():