mirror of
https://github.com/Electrostatics/apbs.git
synced 2026-06-04 12:44:23 +08:00
Added setup processing to the APBS tester Python script to support adding the protein RNA tests. Closes issues #149.
This commit is contained in:
23
examples/protein-rna/apbs_unix_dx.py
Normal file
23
examples/protein-rna/apbs_unix_dx.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/python
|
||||
|
||||
my_list = ('0.025', '0.050', '0.075', '0.100', '0.125', '0.150', '0.175', '0.200', '0.225', '0.250', '0.275', '0.300', '0.325', '0.400', '0.500', '0.600', '0.700', '0.800')
|
||||
|
||||
with open("template.txt", "r") as temp:
|
||||
template_text = temp.read()
|
||||
|
||||
for item in my_list:
|
||||
input_txt = template_text.replace("IONSTR", item)
|
||||
file_name = "apbs-" + item + ".in"
|
||||
print "Creating file now:", file_name
|
||||
with open(file_name, "w") as temp:
|
||||
temp.write(input_txt)
|
||||
|
||||
with open("dxmath.txt", "r") as temp:
|
||||
template_2_text = temp.read()
|
||||
|
||||
for item in my_list:
|
||||
input_2_txt = template_2_text.replace("IONSTR", item)
|
||||
file_2_name = "dxmath-" + item + ".in"
|
||||
print "Creating file_2 now:", file_2_name
|
||||
with open(file_2_name, "w") as temp:
|
||||
temp.write(input_2_txt)
|
||||
@@ -1,25 +1,25 @@
|
||||
from subprocess import call
|
||||
|
||||
my_list = (0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.225, 0.275,
|
||||
0.325, 0.4, 0.5, 0.6, 0.7, 0.8)
|
||||
my_list = ('0.025', '0.050', '0.075', '0.100', '0.125', '0.150', '0.175', '0.200', '0.225', '0.250', '0.275', '0.300', '0.325', '0.400', '0.500', '0.600', '0.700', '0.800')
|
||||
|
||||
with open("template.txt", "r") as temp:
|
||||
template_text = temp.read()
|
||||
|
||||
for item in my_list:
|
||||
input_txt = template_text.replace("IONSTR",str(item))
|
||||
file_name = "apbs-" + str(item) + ".in"
|
||||
input_txt = template_text.replace("IONSTR", item)
|
||||
file_name = "apbs-" + item + ".in"
|
||||
print "Creating file now:", file_name
|
||||
with open(file_name, "w") as temp:
|
||||
temp.write(input_txt)
|
||||
call(["apbs", "apbs-" + str(item) + ".in"])
|
||||
call(["apbs", "apbs-" + item + ".in"])
|
||||
|
||||
with open("dxmath.txt", "r") as temp:
|
||||
template_2_text = temp.read()
|
||||
|
||||
for item in my_list:
|
||||
input_2_txt = template_2_text.replace("IONSTR",str(item))
|
||||
file_2_name = "dxmath-" + str(item) + ".in"
|
||||
input_2_txt = template_2_text.replace("IONSTR", item)
|
||||
file_2_name = "dxmath-" + item + ".in"
|
||||
print "Creating file_2 now:", file_2_name
|
||||
with open(file_2_name, "w") as temp:
|
||||
temp.write(input_2_txt)
|
||||
call(["dxmath", "dxmath-" + str(item) + ".in"])
|
||||
call(["dxmath", "dxmath-" + item + ".in"])
|
||||
|
||||
2
externals/fetk
vendored
2
externals/fetk
vendored
Submodule externals/fetk updated: f8c8ee08bc...0c6fdeabe8
@@ -6,7 +6,7 @@ Provides utility for testing apbs against examples and known results
|
||||
|
||||
import sys, os, re, datetime, subprocess, operator
|
||||
from optparse import OptionParser
|
||||
from ConfigParser import ConfigParser
|
||||
from ConfigParser import ConfigParser, NoOptionError
|
||||
|
||||
# The inputgen utility needs to be accessible, so we add its path
|
||||
sys.path.insert( 0, "../tools/manip" )
|
||||
@@ -115,7 +115,7 @@ def process_parallel( binary, input_file, procs, logger ):
|
||||
|
||||
|
||||
|
||||
def run_test( binary, test_files, test_name, test_directory, logger, ocd ):
|
||||
def run_test( binary, test_files, test_name, test_directory, setup, logger, ocd ):
|
||||
"""
|
||||
Runs a given test from the test cases file
|
||||
"""
|
||||
@@ -131,6 +131,10 @@ def run_test( binary, test_files, test_name, test_directory, logger, ocd ):
|
||||
# Change the current working directory to the test directory
|
||||
os.chdir( test_directory )
|
||||
|
||||
# Run the setup, if any
|
||||
if setup:
|
||||
subprocess.call(setup.split())
|
||||
|
||||
for ( base_name, expected_results ) in test_files:
|
||||
|
||||
# Get the name of the input file from the base name
|
||||
@@ -281,13 +285,21 @@ def main():
|
||||
print " " + test_name + " section not found in " + options.test_config
|
||||
print " skipping..."
|
||||
continue
|
||||
|
||||
# As each test runs, remove the value so it can't be run twice
|
||||
|
||||
# Grab the test directory
|
||||
test_directory = config.get( test_name, 'input_dir' )
|
||||
config.remove_option( test_name, 'input_dir' )
|
||||
|
||||
# Check if there is a setup step.
|
||||
test_setup = None
|
||||
try:
|
||||
test_setup = config.get(test_name, 'setup')
|
||||
config.remove_option(test_name, 'setup')
|
||||
except NoOptionError:
|
||||
pass
|
||||
|
||||
# Run the test!
|
||||
run_test( binary, config.items( test_name ), test_name, test_directory, logger, options.ocd )
|
||||
run_test( binary, config.items( test_name ), test_name, test_directory, test_setup, logger, options.ocd )
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,4 +73,26 @@ apbs-smol : -3.757593797629E+01 -3.912388198513E+02 -3.536628818750E+02
|
||||
|
||||
[geoflow]
|
||||
input_dir : ../examples/geoflow
|
||||
geoflow : -1.04893133E+01 5.417419E-01
|
||||
imidazole : -1.030222099963E+01 5.417419E-01
|
||||
|
||||
[protein-rna]
|
||||
input_dir : ../examples/protein-rna
|
||||
setup : python apbs_unix_dx.py
|
||||
apbs-0.025 : 8.674116429353E+01
|
||||
apbs-0.050 : 9.606836713866E+01
|
||||
apbs-0.075 : 1.011537214883E+02
|
||||
apbs-0.100 : 1.046142116108E+02
|
||||
apbs-0.125 : 1.072226817610E+02
|
||||
apbs-0.150 : 1.093084123761E+02
|
||||
apbs-0.175 : 1.110412443877E+02
|
||||
apbs-0.200 : 1.125199716537E+02
|
||||
apbs-0.225 : 1.138070465620E+02
|
||||
apbs-0.250 : 1.149444369078E+02
|
||||
apbs-0.275 : 1.159616972338E+02
|
||||
apbs-0.300 : 1.168804254687E+02
|
||||
apbs-0.325 : 1.177168854906E+02
|
||||
apbs-0.400 : 1.198456038803E+02
|
||||
apbs-0.500 : 1.220607673699E+02
|
||||
apbs-0.600 : 1.238080564885E+02
|
||||
apbs-0.700 : 1.252364090878E+02
|
||||
apbs-0.800 : 1.264340604647E+02
|
||||
|
||||
Reference in New Issue
Block a user