How to use molecule_directory method in molecule

Best Python code snippet using molecule_python

setupBatchResp.py

Source:setupBatchResp.py Github

copy

Full Screen

1#!/usr/bin/python2#=============================================================================================3# Program to test the Resp.py wrapper for the RESP charge derivation procedure.4#=============================================================================================5# TODO:6# - add command-line arguments7#=============================================================================================8# Version control information9__version__ = "$Revision: 1.1 $"10# $Source: /share_kubo/Storage/cvsroot/pymol-tools/setupBatchResp.py,v $11#=============================================================================================12# Imports13import sys14import os.path15from optparse import OptionParser # For parsing of command line arguments16from openeye.oechem import * # Use OpenEye OEChem toolkit17from openeye.oeomega import * # Use OpenEye Omega18import BatchResp # for RESP charge-fitting19import exceptions20#=============================================================================================21# Create command-line argument options.22usage_string = """\23usage: %prog --input INFILE.mol2 --outdir OUTPUT_DIRECTORY24example: %prog --input guthrie.mol2 --outdir molecules/25"""26version_string = "%prog %__version__"27parser = OptionParser(usage=usage_string, version=version_string)28parser.add_option("-i", "--input", metavar='INFILE',29 action="store", type="string", dest='infile', default='',30 help="Input mol2 file containing one or more molecules.")31parser.add_option("-o", "--outdir", metavar='OUTPUT_DIRECTORY',32 action="store", type="string", dest='output_directory', default='.',33 help="Directory to contain output mol2 files, whose names are extracted from input mol2 file (default '.').")34# Parse command-line arguments.35(options,args) = parser.parse_args()36# Perform minimal error checking.37if not options.infile:38 parser.print_help()39 parser.error("An input file must be specified.")40# Open input mol2 file.41input_molecule_stream = oemolistream()42input_molecule_stream.open(options.infile)43# Create a molecule.44molecule = OEMol()45# Create an instance of Resp, telling it where to find GAMESS and Antechamber.46#resp = Resp(gamess_path = '/Users/jchodera/local/src/gamess', antechamber_path = '/Users/jchodera/local/src/antechamber-1.27')47batch_resp = BatchResp.BatchResp()48# Keep track of number of conformers for each.49molecules = []50# Process all molecules in the input stream51while OEReadMolecule(input_molecule_stream, molecule):52 # Extract name of molecule.53 molecule_name = molecule.GetTitle().split()[0].replace('.xyz','')54 print "\nProcessing '%s'..." % molecule_name55 # Make a directory for this molecule.56 molecule_directory = os.path.join(options.output_directory, molecule_name)57 print "Creating directory '%s'..." % molecule_directory58 os.mkdir(molecule_directory)59 60 # Set up GAMESS directories.61 nconformers = batch_resp.setupJobs(molecule, molecule_name, molecule_directory, generate_conformers = True)62 # Keep track of number of conformers.63 molecules.append( (molecule_name, nconformers) )64# Generate master submission script in order of fewest conformers to most conformers.65outfile = open(os.path.join(options.output_directory,'submit_all.sh'),'w')66import operator67molecules.sort(key = operator.itemgetter(1))68for molecule in molecules:69 print molecule70 outfile.write("cd %s ; qsub run_batch.cmd ; cd .. \n" % molecule[0])71 print "%5d %s" % (molecule[1], molecule[0])72outfile.close()73 74 ...

Full Screen

Full Screen

test_default.py

Source:test_default.py Github

copy

Full Screen

1from ansible.parsing.dataloader import DataLoader2from ansible.template import Templar3import pytest4import os5import testinfra.utils.ansible_runner6import pprint7pp = pprint.PrettyPrinter()8testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(9 os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')10def base_directory():11 cwd = os.getcwd()12 if('group_vars' in os.listdir(cwd)):13 directory = "../.."14 molecule_directory = "."15 else:16 directory = "."17 molecule_directory = "molecule/{}".format(os.environ.get('MOLECULE_SCENARIO_NAME'))18 return directory, molecule_directory19@pytest.fixture()20def get_vars(host):21 """22 """23 base_dir, molecule_dir = base_directory()24 file_defaults = "file={}/defaults/main.yml name=role_defaults".format(base_dir)25 file_vars = "file={}/vars/main.yml name=role_vars".format(base_dir)26 file_molecule = "file={}/group_vars/all/vars.yml name=test_vars".format(molecule_dir)27 defaults_vars = host.ansible("include_vars", file_defaults).get("ansible_facts").get("role_defaults")28 vars_vars = host.ansible("include_vars", file_vars).get("ansible_facts").get("role_vars")29 molecule_vars = host.ansible("include_vars", file_molecule).get("ansible_facts").get("test_vars")30 ansible_vars = defaults_vars31 ansible_vars.update(vars_vars)32 ansible_vars.update(molecule_vars)33 templar = Templar(loader=DataLoader(), variables=ansible_vars)34 result = templar.template(ansible_vars, fail_on_undefined=False)35 return result36def test_packages(host):37 """38 """39 distribution = host.system_info.distribution40 release = host.system_info.release41 pp.pprint(distribution)42 pp.pprint(release)43 packages = []44 packages.append("screen")45 for package in packages:46 p = host.package(package)47 assert p.is_installed48@pytest.mark.parametrize("files", [49 "/etc/screenrc",50])51def test_filess(host, files):52 d = host.file(files)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run molecule automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful