Open main menu

Changes

Tutorial for model free SBiNLab

2,169 bytes added, 21:46, 15 October 2017
# relax module imports.
from specific_analyses.model_free.model import determine_model_type
import lib.io
from pipe_control import pipes
# Read the state with the setup
# Load the state with setup data.
state.load(state='results.bz2', dir=results_dir, force=True)
 
# Show pipes
pipe.display()
pipe_name = pipes.cdp_name()
pipe_bundle = pipes.get_bundle(pipe_name)
# Define write out
# chi2 per iteration? But does not work?
grace.write(x_data_type='iter', y_data_type='chi2', file='iter_chi2.agr', dir=write_out, force=True)
 
#############
 
# This does not do what we want. So let us try manually.
var_ori = 'result_06'
results_dir_ori = os.getcwd() + os.sep + var_ori
 
dir_list = os.listdir(results_dir_ori)
 
all_models = ['local_tm', 'sphere', 'prolate', 'oblate', 'ellipsoid']
opt_models = []
for model in all_models:
if model in dir_list:
opt_models.append(model)
 
# Loop over models MII to MV.
out_results = []
for model in ['sphere', 'prolate', 'oblate', 'ellipsoid']:
# Skip missing models.
if model not in opt_models:
continue
# Make the model dir
mdir = results_dir_ori + os.sep + model
rdir = [ name for name in os.listdir(mdir) if os.path.isdir(os.path.join(mdir, name)) ]
rdirs = lib.io.sort_filenames(rdir)
 
# Loop over rounds
for rd in rdirs:
if "round_" in rd:
dir_model_round = mdir + os.sep + rd + os.sep + 'opt'
if os.path.isdir(dir_model_round):
# Create pipe to read data
pipe_name_rnd = "%s_%s" % (model, rd)
pipe.create(pipe_name_rnd, 'mf', bundle="temp")
results.read(file='results', dir=dir_model_round)
 
# Get info
round_i = rd.split("_")[-1]
cdp_iter = str(cdp.iter)
chi2 = str(cdp.chi2)
tm = str(cdp.diff_tensor.tm)
# Append to results
out_results.append([pipe_name_rnd, model, round_i, cdp_iter, chi2, tm])
 
# Change back to original pipe
pipe.switch(pipe_name)
cdp.out_results = out_results
 
#print result
for res in out_results:
print res
 
# Write file
file_name = "results_collected.txt"
file_path = lib.io.get_file_path(file_name, results_dir)
file = lib.io.open_write_file(file_path, force=True)
 
# Write the file.
headings = ["pipe_name", "model", "round_i", "cdp_iter", "chi2", "tm"]
lib.io.write_data(out=file, headings=headings, data=out_results)
file.close()
 
# Save the state
state.save(state='results_collected.bz2', dir=results_dir, force=True)
</source>
|}
Run with pymol.relax
<source lang="bash">
relax 06_check_intermediate_grace_extra.py
Trusted, Bureaucrats
1,382

edits