import zgf_grompp import sys import re import os from subprocess import Popen, PIPE import numpy as np import shutil from tempfile import mktemp #=============================================================================== 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",
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("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),
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(
import copy # ZIBgridfree quasi-constant parameters EPSILON2 = 1E-3 #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
from ZIBMolPy.ui import Option, OptionsList from ZIBMolPy.pool import Pool 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()
from ZIBMolPy.io.trr import TrrFile from ZIBMolPy.node import Node from ZIBMolPy.pool import Pool import zgf_cleanup 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), ])
""" 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]
At the command line, type:: $ zgf_recover_state """ 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)
from ZIBMolPy.pool import Pool from ZIBMolPy.ui import OptionsList, Option 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
from ZIBMolPy.utils import check_call from ZIBMolPy.pool import Pool from ZIBMolPy import gromacs from ZIBMolPy.node import Node from ZIBMolPy.ui import userinput, Option, OptionsList from ZIBMolPy.io.trr import TrrFile from ZIBMolPy.internals import Converter, LinearCoordinate import os from os import path from pprint import pformat from math import sqrt import sys import re 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",
#!/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.node import Node from ZIBMolPy.phi import get_phi 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))
#! /usr/bin/env python # -*- coding: utf-8 -*- 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,
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]
EPSILON2 = 1E-3 #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
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")
from ZIBMolPy.io.trr import TrrFile import zgf_refine import zgf_grompp 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():
#!/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)
import zgf_cleanup from subprocess import Popen, PIPE, call, check_call from datetime import datetime from tempfile import mktemp from warnings import warn import numpy as np import sys import os from shutil import copy from os import path CRITICAL_FRAME_WEIGHT = 5.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",
""" 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():