rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.__init__(atype=inventory.element, xyz=inventory.xyz, label=inventory.label, occupancy=inventory.occupancy) | atom = self.__class__( atype=inventory.element, xyz=inventory.xyz, label=inventory.label, occupancy=inventory.occupancy) self.__init__(atom) return | def __restoreFromInventory__(self, inventory): self.__init__(atype=inventory.element, xyz=inventory.xyz, label=inventory.label, occupancy=inventory.occupancy) |
self.recbase = numalg.inv(self.base) | self.recbase = numalg.inv(self.base) self.recbase2pi = 2*numpy.pi*self.recbase | def setLatPar(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=None): """set lattice parameters and all related tensors |
self.recbase = numalg.inv(self.base) | self.recbase = numalg.inv(self.base) self.recbase2pi = 2*numpy.pi*self.recbase | def setLatBase(self, base): """Set matrix of unit cell base vectors and calculate corresponding lattice parameters and stdbase, baserot and metrics tensors. |
recipvectors = 2 * numpy.pi * numalg.inv(numpy.transpose(self.base)) | recipvectors = self.recbase2pi | def getMonkhorstPackGrid(self, size, shift=(0,0,0)): """Returns a Monkhorst-Pack grid of order size[0]*size[1]*size[2], scaled by the reciprocal space unit cell. The shift is an optional vector shift to all points in the grid. """ |
t = self._primitive_unitcell = self._lattice.getPrimitiveLattice(self.sg) | t = self._primitive_unitcell = self._create_primitive_unitcell() | def _get_primitive_unitcell(self): t = self._primitive_unitcell if t is None: t = self._primitive_unitcell = self._lattice.getPrimitiveLattice(self.sg) #t = self._primitive_unitcell = self._create_primitive_unitcell() return t |
base = self._lattice.getPrimitiveLattice(self.sg) base = numpy.array(base) puc = UnitCell(base=base) for atom in self: if puc.hasAtom(atom): continue puc.addAtom(atom) continue return puc | def _create_primitive_unitcell(self): # the ctor from UnitCell import UnitCell | |
puc = UnitCell(base=base) for atom in self: if puc.hasAtom(atom): continue puc.addAtom(atom) continue return puc | def _create_primitive_unitcell(self): # the ctor from UnitCell import UnitCell | |
return | base = self.lattice | def _create_primitive_unitcell(self): # the ctor from UnitCell import UnitCell |
return (cartpos * la.inv(self._lattice)).sum(0) | return (cartpos * numpy.linalg.inv(self._lattice)).sum(0) | def cartesianToFractional(self, cartpos): """Converts a coordinate from cartesian to fractional.""" return (cartpos * la.inv(self._lattice)).sum(0) # should be double-checked |
max = -999999999 min = 999999999 | unset = True | def printusage(): print 'Usage: maxmin.py -f file -n column' sys.exit() |
y = x words = mdoutlines[y].split() step.append(int(words[2])) temp.append(float(words[8])) pres.append(float(words[11])) y += 1 words = mdoutlines[y].split() etot.append(float(words[2])) ektot.append(float(words[5])) eptot.append(float(words[8])) y += 4 words = mdoutlines[y].split() restr.append(float(words[8])) eambe... | try: y = x | def printusage(): import sys print "analyzeConvergence.py <mdout> <mdcrd> <prmtop> {<gnuplot_script_prefix>}" sys.exit() |
density.append(float(words[2])) | step.append(int(words[2])) temp.append(float(words[8])) pres.append(float(words[11])) y += 1 words = mdoutlines[y].split() etot.append(float(words[2])) ektot.append(float(words[5])) eptot.append(float(words[8])) y += 3 words = mdoutlines[y].split() restr.append(float(words[8])) eamber.append(eptot[len(eptot)-1]-restr[l... | def printusage(): import sys print "analyzeConvergence.py <mdout> <mdcrd> <prmtop> {<gnuplot_script_prefix>}" sys.exit() |
rms first mass out __rms.dat | rms first mass out __RMS.dat | def printusage(): import sys print "analyzeConvergence.py <mdout> <mdcrd> <prmtop> {<gnuplot_script_prefix>}" sys.exit() |
os.system("{0} {1} __ptraj.in 2>>__ptraj.out 1>>__ptraj.out") | os.system("{0} {1} __ptraj.in 2>>__ptraj.out 1>>__ptraj.out".format(ptraj,prmtop)) | def printusage(): import sys print "analyzeConvergence.py <mdout> <mdcrd> <prmtop> {<gnuplot_script_prefix>}" sys.exit() |
0.3390, | 0.3339, | def getData(residue, igb): import sys, math |
formats = {} parm_data = {} flag_list = [] version = '' prm_name = '' overwrite = False exists = False pointers = {} def __init__(self, prm_name): | formats = {} parm_data = {} flag_list = [] version = '' prm_name = '' overwrite = False exists = False valid = False pointers = {} LJ_types = {} LJ_radius = [] LJ_depth = [] def __init__(self, prm_name='prmtop'): | def parseFormat(format_string): # parse a format statement and send back details if 'a' in format_string: # this is a string format_parts = format_string.split('a') return int(format_parts[0]), int(format_parts[1]), 'str' elif 'I' in format_string: # this is an integer format_parts = format_string.split('I') return ... |
self.valid = False if self.valid: try: self.fill_LJ() except: print >> stderr, 'Warning: Problem parsing L-J 6-12 parameters.' | def __init__(self, prm_name): # set up necessary variables | |
line += '{0:{1}.{2}e}'.format(self.parm_data[flag][j],size_item,decnum) | line += '{0:{1}.{2}E}'.format(self.parm_data[flag][j],size_item,decnum) | def writeParm(self, name): # write a new prmtop with the current prmtop data # global variable(s) global AMBER_ELECTROSTATIC |
new_prm.write(line + '\n') | if len(line.strip()) > 0: new_prm.write(line + '\n') | def writeParm(self, name): # write a new prmtop with the current prmtop data # global variable(s) global AMBER_ELECTROSTATIC |
def Frcmod(self, frcmod="frcmod"): | def frcmod(self, frcmod="frcmod"): | def Frcmod(self, frcmod="frcmod"): """Prints an Frcmod file that contains every parameter found in prmtop""" from math import pi, pow |
lj_dist = [] lj_well = [] | def getMatches(entry, array): counter = 0 for i in range(len(array)): if array[i][0:11] == entry: counter += 1 return counter | |
one_sixth = 1.0/6.0 for i in range(self.pointers["NTYPES"]): lj_index = (i + 1) * (i + 2) / 2 - 1 if self.parm_data["LENNARD_JONES_BCOEF"][lj_index] == 0: lj_dist.append(0.0) lj_well.append(0.0) continue factor = 2 * self.parm_data["LENNARD_JONES_ACOEF"][lj_index] / self.parm_data["LENNARD_JONES_BCOEF"][lj_index] lj_... | def getMatches(entry, array): counter = 0 for i in range(len(array)): if array[i][0:11] == entry: counter += 1 return counter | |
file.write("%s %8.4f %8.4f \n" % (found_atomtypes[i].ljust(2), lj_dist[atom_type_nums[i]-1], lj_well[atom_type_nums[i]-1])) del lj_dist, lj_well, found_atomtypes, atom_type_nums | file.write("%s %8.4f %8.4f \n" % (found_atomtypes[i].ljust(2), self.LJ_radius[self.LJ_types[found_atomtypes[i]]-1], self.LJ_depth[self.LJ_types[found_atomtypes[i]]-1])) del found_atomtypes | def getMatches(entry, array): counter = 0 for i in range(len(array)): if array[i][0:11] == entry: counter += 1 return counter |
self.valid_namelists = ['cntrl','ewald','qmmm'] | self.pb_nml = self.pb_obj.sander self.valid_namelists = ['cntrl','ewald','qmmm','pb'] elif self.program == "sander.APBS": self.cntrl_nml = self.cntrl_obj.sander self.pb_nml = self.pb_obj.sanderAPBS self.valid_namelists = ['cntrl','apbs'] | def __init__(self, program = 'sander', verbosity = 1): # define instance data self.program = program # which program we're creating the input file for self.cntrl_obj = cntrl() # object with cntrl namelist vars in a dictionary self.ewald_obj = ewald() # object with ewald namelist vars in a dictionary se... |
if not inblock and not lines[i].strip().startswith('&'): | if not inblock and not lines[i].strip().startswith('&') and lead_comment: | def read(self, filename = 'mdin'): try: file = open(filename, 'r') except IOError: print >> stderr, 'File (%s) can\'t be opened for reading...' % filename return -1 |
elif not inblock and lines[i].startswith('&'): | elif not inblock and not lines[i].strip().startswith('&') and not lead_comment: final_ended = True for j in range(i,len(lines)): if lines[j].strip().startswith('&'): final_ended = False if final_ended: self.cards.append(lines[i]) elif not inblock and lines[i].strip().startswith('&'): lead_comment = False | def read(self, filename = 'mdin'): try: file = open(filename, 'r') except IOError: print >> stderr, 'File (%s) can\'t be opened for reading...' % filename return -1 |
for j in range(len(items)): | j = 0 while j < len(items): items[j] = items[j].strip() | def read(self, filename = 'mdin'): try: file = open(filename, 'r') except IOError: print >> stderr, 'File (%s) can\'t be opened for reading...' % filename return -1 |
relene = -15.26298 + KB * TEMP * LN_TO_LOG * pKa | relene = -15.26298 - KB * TEMP * LN_TO_LOG * pKa | def getData(residue, igb): import sys, math |
relene = -14.52805 + KB * TEMP * LN_TO_LOG * pKa | relene = -14.52805 - KB * TEMP * LN_TO_LOG * pKa | def getData(residue, igb): import sys, math |
if final_ended: | if final_ended and len(lines[i].strip()) != 0: | def read(self, filename = 'mdin'): try: file = open(filename, 'r') except IOError: print >> stderr, 'File (%s) can\'t be opened for reading...' % filename return -1 |
if self.cards[len(self.cards)].strip().upper() == 'END': | if len(self.cards) != 0 and self.cards[len(self.cards)-1].strip().upper() == 'END': | def read(self, filename = 'mdin'): try: file = open(filename, 'r') except IOError: print >> stderr, 'File (%s) can\'t be opened for reading...' % filename return -1 |
if resname == "HIP": | if residue == "HIP": | def getData(residue, igb): import sys, math |
if resname == "LYS": | if residue == "LYS": | def getData(residue, igb): import sys, math |
system('cat << EOF\n%s\nEOF | qsub' % submit_string) | system('qsub << EOF\n%s\nEOF' % submit_string) | def submit(self): from os import system submit_string = self.preview() if self.valid: system('cat << EOF\n%s\nEOF | qsub' % submit_string) |
print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' | print 'FindSaltbridge.py -p prmtop -y mdcrd1 mdcrd2 ... -o output_list' | def printusage(): # usage statement print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' clean() sys.exit() |
if len(line.strip()) != 0: file.write(line + '\n') if has_been_printed: file.write('/\n') line = ' ' has_been_printed = False for var in self.pb_nml.keys(): if self.pb_nml[var] != self.pb_nml_defaults[var]: if (not has_been_printed): if self.program == 'sander.APBS': file.write('&apbs\n') else: file.write('&pb\n') ... | def write(self, filename = 'mdin'): if not self.check(): # check the validity of the parameters print >> stderr, 'mdin file not written!' return -1 | |
icnstph=1, solvph=7.5, ntcnstph=10000, | def printusage(): print >> sys.stderr, 'Usage: ConstpH_TI.py -igb <igb_value> -resname <resname> \\' print >> sys.stderr, ' -states <state1> <state2> {-na || -aa}' sys.exit() | |
os.system('%s -i min.mdin -o _rm.mdout -inf _rm.mdinfo -r min.restrt' % sandermin) | os.system('%s -i min.mdin -o _rm.mdout -inf _rm.mdinfo -r min.restrt -p %s0.prmtop -c %s0.inpcrd' % (sandermin, resname.lower(), resname.lower())) | def printusage(): print >> sys.stderr, 'Usage: ConstpH_TI.py -igb <igb_value> -resname <resname> \\' print >> sys.stderr, ' -states <state1> <state2> {-na || -aa}' sys.exit() |
os.system('{0} sander.MPI -ng 2 -groupfile groupfile'.format(mpi_cmd)) | os.system('{0} {1} -ng 2 -groupfile groupfile'.format(mpi_cmd, sander)) | def printusage(): print >> sys.stderr, 'Usage: ConstpH_TI.py -igb <igb_value> -resname <resname> \\' print >> sys.stderr, ' -states <state1> <state2> {-na || -aa}' sys.exit() |
toadd = 'STARTWATER=%s, CNSTPH_IGB=%s, RELAX_TIME=%s' % (prmtop_object.parm_data['RESIDUE_POINTER'][i],igb,100) | toadd = 'CPHFIRST_SOL=%s, CPH_IGB=%s, ' % (prmtop_object.parm_data['RESIDUE_POINTER'][i],igb) | def addOn(line, toadd): import sys if len(line) + len(toadd) > 80: print >> sys.stdout, line return ' ' + toadd else: return line + toadd |
pairs.append([acceptor_inds[x],donor_inds[y],0]) | if acceptor_inds[x] != donor_inds[y]: pairs.append([acceptor_inds[x],donor_inds[y],0]) | def printusage(): # usage statement print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' clean() sys.exit() |
file = open('_FSB_{0}_{1}.dat','r') | file = open('_FSB_{0}_{1}.dat'.format(pairs[x][0],pairs[x][1]),'r') | def printusage(): # usage statement print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' clean() sys.exit() |
if float(words[1]) < cutoff: | if float(words[1]) < tolerance: | def printusage(): # usage statement print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' clean() sys.exit() |
outputfile.write('{0} {1} - {2} {3} : Fraction {4:.3f}\n'.format(residues[pairs[x][0]-1], pairs[x][0], residues[pairs[x][1]-1], pairs[x][1], within / total)) | outputfile.write('{0} {1} - {2} {3} : Fraction {4:.3f}\n'.format(residues[pairs[x][0]-1].ljust(3), str(pairs[x][0]).rjust(3), residues[pairs[x][1]-1].ljust(3), str(pairs[x][1]).rjust(3), within / total)) | def printusage(): # usage statement print 'FindSaltbridge.py -p prmtop -y mdcrd1,mdcrd2,... -o output_list' clean() sys.exit() |
rotation = Rotation.from_properties(rotation_angle, rotation_axis, False) | rotation = Rotation.from_properties(-rotation_angle, rotation_axis, False) | def do_rotation(self, drawing_area, rotation_angle, rotation_axis): camera = context.application.camera rotation = Rotation.from_properties(rotation_angle, rotation_axis, False) camera.rotation = camera.rotation * rotation drawing_area.queue_draw() |
self.parameters.rotation = Rotation.from_properties(angle, axis, False, b1) | self.parameters.rotation = Rotation.from_properties(angle, axis, False) | def ask_parameters(self): cache = context.application.cache nodes = cache.nodes last = cache.last next_to_last = cache.next_to_last |
self.parameters.rotation = Rotation.from_properties(numpy.pi*0.25, e - b, False, b) | self.parameters.rotation = Rotation.from_properties(numpy.pi*0.25, e - b, False) | def ask_parameters(self): cache = context.application.cache nodes = cache.nodes last = cache.last next_to_last = cache.next_to_last |
camera.eye.t[:2] -= vector[:2] | new_eye_t = camera.eye.t.copy() new_eye_t[:2] -= vector[:2] | def do_translation(self, vector, drawing_area): camera = context.application.camera tmp = vector.copy() tmp[2] = 0 transformed_vector = numpy.dot(self.eye_rotation, tmp) camera.eye.t[:2] -= vector[:2] camera.rotation_center = Translation(camera.rotation_center.t + transformed_vector) if (camera.opening_angle > 0): came... |
camera.eye.t[2] -= vector[2] | new_eye_t[2] -= vector[2] | def do_translation(self, vector, drawing_area): camera = context.application.camera tmp = vector.copy() tmp[2] = 0 transformed_vector = numpy.dot(self.eye_rotation, tmp) camera.eye.t[:2] -= vector[:2] camera.rotation_center = Translation(camera.rotation_center.t + transformed_vector) if (camera.opening_angle > 0): came... |
t = node.transformation.t + numpy.dot(universe.cell, cell_index - 0.5*(repetitions - 1)) | t = node.transformation.t + numpy.dot(universe.cell.matrix, cell_index - 0.5*(repetitions - 1)) | def do(self): # create the repetitions vector repetitions = [] |
other_cell_index = universe.cell.to_fractional(translation - numpy.dot(universe.cell, -0.5*(repetitions - 1))) | other_target_pos = translation - numpy.dot(universe.cell.matrix, -0.5*(repetitions - 1)) other_cell_index = universe.cell.to_fractional(other_target_pos).astype(int) | def do(self): # create the repetitions vector repetitions = [] |
serialized.close() del serialized | def do(self): # create the repetitions vector repetitions = [] | |
if self.parameters_dialog.run(self.parameters.translation) != gtk.RESPONSE_OK: | if self.parameters_dialog.run(self.parameters) != gtk.RESPONSE_OK: | def ask_parameters(self): cache = context.application.cache last = cache.last parent = cache.parent_of_translated_nodes if isinstance(last, Vector): b = last.children[0].translation_relative_to(parent) e = last.children[1].translation_relative_to(parent) if (b is not None) and (e is not None): self.parameters.translati... |
primitive.SetProperty(node, "transformation", node.Transformation()) | primitive.SetProperty(node, "transformation", node.Transformation.identity()) | def do(self): for node in context.application.cache.transformed_nodes: primitive.SetProperty(node, "transformation", node.Transformation()) |
AddPoint = context.application.plugins.get_action("AddPoint") self.assert_(AddPoint.analyze_selection()) AddPoint() context.application.model.universe.children[-1].transformation.t = numpy.random.uniform(-5, 5, 3) | Point = context.application.plugins.get_node("Point") point = Point(transformation=Translation(numpy.random.uniform(-5, 5, 3))) context.application.model.universe.add(point) | def fn(): FileNew = context.application.plugins.get_action("FileNew") FileNew() |
atom = graph.molecule.atoms[atomindex] | atom = atoms[atomindex] | def coords_to_zeobuilder(org_coords, opt_coords, atoms, parent, graph=None): if graph == None: groups = [numpy.arange(len(atoms))] else: # if the molecular graph has disconnected islands, then each independent # part is treated seperately in the loop below groups = graph.independent_vertices for group in groups: group... |
retcode = os.system('cd %s; run_mopac7 mopac > mopac.out' % work) | retcode = os.system('cd %s; run_mopac7 mopac > mopac.stdout' % work) | def do(self): parent = context.application.cache.node org_mol = create_molecule([parent], parent) org_coords = org_mol.coordinates |
opt_coords = self.read_mopac_output(os.path.join(work, 'mopac.out'), org_mol.size) | opt_coords = self.read_mopac_output(os.path.join(work, 'mopac.OUT'), org_mol.size) | def do(self): parent = context.application.cache.node org_mol = create_molecule([parent], parent) org_coords = org_mol.coordinates |
safe_remove("mopac.out") | safe_remove("mopac.stdout") safe_remove("mopac.OUT") | def safe_remove(filename): filename = os.path.join(work, filename) if os.path.isfile(filename): os.remove(filename) |
main.drawing_area.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.BUTTON_MOTION_MASK) | main.drawing_area.add_events( gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.BUTTON_MOTION_MASK | gtk.gdk.POINTER_MOTION_MASK ) | def __init__(self): assert context.application.action_manager is not None self.start_button = 0 # Interactive buttons (gui stuff) self.buttons = {} self.clicked_button = None gtk.Table.__init__(self, 2, 4) self.set_row_spacings(0) self.set_col_spacings(5) for index, (modifier, label) in enumerate(self.modifier_labels):... |
camera.rotation = rotation * camera.rotation | camera.rotation = camera.rotation * rotation | def do_rotation(self, drawing_area, rotation_angle, rotation_axis): camera = context.application.camera rotation = Rotation.from_properties(rotation_angle, rotation_axis, False) camera.rotation = rotation * camera.rotation drawing_area.queue_draw() |
def run_dialog(dialog, line_wrap=True): | def run_dialog(dialog, line_wrap, message): | def run_dialog(dialog, line_wrap=True): dialog.set_title(context.title) dialog.label.set_property("use-markup", True) dialog.label.set_line_wrap(line_wrap) result = dialog.run() dialog.destroy() return result |
dialog.label.set_property("use-markup", True) dialog.label.set_line_wrap(line_wrap) | dialog.set_markup(message) | def run_dialog(dialog, line_wrap=True): dialog.set_title(context.title) dialog.label.set_property("use-markup", True) dialog.label.set_line_wrap(line_wrap) result = dialog.run() dialog.destroy() return result |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, full) return run_dialog(dialog, line_wrap) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK) return run_dialog(dialog, line_wrap, full) | def ok_error(message, details="", line_wrap=True, markup=False): full = apply_template(template, (message, details), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, full) return run_dialog(dialog, line_wrap) |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, full) return run_dialog(dialog, line_wrap) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK) return run_dialog(dialog, line_wrap, full) | def ok_information(message, details="", line_wrap=True, markup=False): full = apply_template(template, (message, details), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, full) return run_dialog(dialog, line_wrap) |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, full) return run_dialog(dialog, line_wrap) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) return run_dialog(dialog, line_wrap, full) | def yes_no_question(message, details="", line_wrap=True, markup=False): full = apply_template(template, (message, details), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, full) return run_dialog(dialog, line_wrap) |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, full) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE) | def nosave_cancel_save_question(message, details="", line_wrap=True, markup=False): full = apply_template(template, (message, details), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, full) dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) dialog.add_button(gtk.ST... |
return run_dialog(dialog, line_wrap) | return run_dialog(dialog, line_wrap, full) | def nosave_cancel_save_question(message, details="", line_wrap=True, markup=False): full = apply_template(template, (message, details), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, full) dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) dialog.add_button(gtk.ST... |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_NONE, full) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_NONE) | def field_error(location, problem, line_wrap=True, markup=False): full = apply_template(field_template, (location, problem), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_NONE, full) button = dialog.add_button(gtk.STOCK_JUMP_TO, gtk.RESPONSE_OK) return run_dialog(dialog... |
return run_dialog(dialog, line_wrap) | return run_dialog(dialog, line_wrap, full) | def field_error(location, problem, line_wrap=True, markup=False): full = apply_template(field_template, (location, problem), not markup) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_NONE, full) button = dialog.add_button(gtk.STOCK_JUMP_TO, gtk.RESPONSE_OK) return run_dialog(dialog... |
AddPoint = context.application.plugins.get_action("AddPoint") self.assert_(AddPoint.analyze_selection()) AddPoint() context.application.model.universe.children[-1].transformation.t = numpy.random.uniform(-1, 1, 3) | Point = context.application.plugins.get_node("Point") point = Point(transformation=Translation(numpy.random.uniform(-1, 1, 3))) context.application.model.universe.add(point) | def fn(): FileNew = context.application.plugins.get_action("FileNew") FileNew() |
self.frame2.transformation.clear() | def apply_normal(self): model, iter = self.tree_selection.get_selected() old_transformation = self.frame2.transformation self.frame2.transformation.clear() transformation = self.frame1.get_frame_relative_to(self.frame2) if self.cb_inverse.get_active() and len(model.get_value(iter, 3)[3]) > 0: transformation = model.get... | |
self.frame2.set_transformation(transformation) primitive.SetProperty(self.frame2, "transformation", old_transformation, done=True) | primitive.SetProperty(self.frame2, "transformation", transformation) | def apply_normal(self): model, iter = self.tree_selection.get_selected() old_transformation = self.frame2.transformation self.frame2.transformation.clear() transformation = self.frame1.get_frame_relative_to(self.frame2) if self.cb_inverse.get_active() and len(model.get_value(iter, 3)[3]) > 0: transformation = model.get... |
return self.get_frame_up_to(common).inv * other.get_frame_up_to(common) | return other.get_frame_up_to(common).inv * self.get_frame_up_to(common) | def get_frame_relative_to(self, other): common = common_parent([self, other]) return self.get_frame_up_to(common).inv * other.get_frame_up_to(common) |
rotation_axis = numpy.array([-roty, -rotx, 0.0], float) | rotation_axis = numpy.array([roty, rotx, 0.0], float) | def button_motion(self, drawing_area, event, start_button): if start_button == 2: return elif start_button == 1: # XY rotation rotx = (event.x - self.former_x) / float(drawing_area.allocation.width) * 360 roty = (event.y - self.former_y) / float(drawing_area.allocation.width) * 360 rotation_axis = numpy.array([-roty, -... |
rotation_axis = numpy.array([0.0, 0.0, -1.0], float) | rotation_axis = numpy.array([0.0, 0.0, 1.0], float) | def button_motion(self, drawing_area, event, start_button): if start_button == 2: return elif start_button == 1: # XY rotation rotx = (event.x - self.former_x) / float(drawing_area.allocation.width) * 360 roty = (event.y - self.former_y) / float(drawing_area.allocation.width) * 360 rotation_axis = numpy.array([-roty, -... |
rotation_axis[1] = -1 | rotation_axis[1] = +1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
rotation_axis[1] = +1 | rotation_axis[1] = -1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
rotation_axis[0] = +1 | rotation_axis[0] = -1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
rotation_axis[0] = -1 | rotation_axis[0] = +1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
rotation_axis[2] = +1 | rotation_axis[2] = -1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
rotation_axis[2] = -1 | rotation_axis[2] = +1 | def key_press(self, drawing_area, event): rotation_angle = numpy.pi/36.0 rotation_axis = numpy.zeros(3, float) if event.keyval == 65363: #print "right" rotation_axis[1] = -1 elif event.keyval == 65361: #print "left" rotation_axis[1] = +1 elif event.keyval == 65362: #print "up" rotation_axis[0] = +1 elif event.keyval ==... |
menu_info = MenuInfo("default/_Object:tools/_Molecular:add", "S_aturate with hydrogens (fixed number)", False, order=(0, 4, 1, 5, 1, 3)) | menu_info = MenuInfo("default/_Object:tools/_Molecular:add", "S_aturate with hydrogens (fixed number)", order=(0, 4, 1, 5, 1, 3)) | def hydrogenate_unsaturated_atoms(nodes): for node in nodes: if isinstance(node, Atom): add_hydrogens(node) elif isinstance(node, ContainerMixin): hydrogenate_unsaturated_atoms(node.children) |
rotation2 = Rotation() rotation2.set_rotation_properties(1*math.pi, [0, 1, 0], False) | rotation2 = Rotation.from_properties(1*math.pi, [0, 1, 0], False) | def fn(): context.application.model.file_open("input/precursor.zml") context.application.main.select_nodes(context.application.model.universe.children) |
if context.application.model.universe.cell_active.sum() != 2: return False | if context.application.model.universe.cell.active.sum() != 2: return False | def analyze_selection(parameters=None): if not ImmediateWithMemory.analyze_selection(parameters): return False if context.application.model.universe.cell_active.sum() != 2: return False return True |
active, inactive = universe.get_active_inactive() lengths, angles = universe.get_parameters() | active, inactive = universe.cell.active_inactive lengths, angles = universe.cell.parameters | def define_flat(): "Reads and converts the unit cell vectors from the current model." # some parts of the algorithm have been arranged sub functions like # these, to reduce the number of local variables in self.do. This # should also clarify the code. active, inactive = universe.get_active_inactive() lengths, angles = ... |
active, inactive = universe.get_active_inactive() a = universe.cell[:,active[0]] b = universe.cell[:,active[1]] | active, inactive = universe.cell.active_inactive a = universe.cell.matrix[:,active[0]] b = universe.cell.matrix[:,active[1]] | def create_pattern(): "Read the atom positions and transform them to the flat coordinates" active, inactive = universe.get_active_inactive() a = universe.cell[:,active[0]] b = universe.cell[:,active[1]] c = numpy.cross(a,b) tmp_cell = UnitCell(numpy.array([a,b,c]).transpose()) r = tmp_cell.calc_align_rotation_matrix() |
r = tmp_cell.calc_align_rotation_matrix() | rotation = tmp_cell.alignment_a | def create_pattern(): "Read the atom positions and transform them to the flat coordinates" active, inactive = universe.get_active_inactive() a = universe.cell[:,active[0]] b = universe.cell[:,active[1]] c = numpy.cross(a,b) tmp_cell = UnitCell(numpy.array([a,b,c]).transpose()) r = tmp_cell.calc_align_rotation_matrix() |
(atom.number, numpy.dot(r, atom.get_absolute_frame().t)) | (atom.number, rotation*atom.get_absolute_frame().t) | def create_pattern(): "Read the atom positions and transform them to the flat coordinates" active, inactive = universe.get_active_inactive() a = universe.cell[:,active[0]] b = universe.cell[:,active[1]] c = numpy.cross(a,b) tmp_cell = UnitCell(numpy.array([a,b,c]).transpose()) r = tmp_cell.calc_align_rotation_matrix() |
big_cell = UnitCell(big_cell, numpy.array([False, False, periodic_tube], bool)) | big_cell = UnitCell(big_matrix, numpy.array([False, False, periodic_tube], bool)) | def yield_pattern(): for number, coordinate in pattern: yield number, coordinate.copy() |
class CellMatrixPopup(popups.Measure): | class CellPopup(popups.Default): | def convert_to_value(self, representation): properties = ( ComposedInTable.convert_to_value(self.fields[0], representation[0]) + (ComposedArray.convert_to_value(self.fields[1], representation[1]),) ) return MathComplete.from_properties(*properties) |
popups.Measure.fill_menu(self) | popups.Default.fill_menu(self) | def fill_menu(self): popups.Measure.fill_menu(self) self.add_separator() try: cell = self.field.convert_to_value(self.field.read_from_widget()) self.add_item("Set parameters ...", None, self.on_set_parameters, cell) except ValueError: self.add_item("Set parameters ... (invalid fields)", None, None) |
Popup = CellMatrixPopup reset_representation = (('10.0 A', '0.0 A', '0.0 A', '0.0 A', '10.0 A', '0.0 A', '0.0 A', '0.0 A', '10.0 A')) | def on_set_parameters(self, menu, cell): from zeobuilder.gui.fields_dialogs import FieldsDialogSimple | |
return ( isinstance(self.attribute, numpy.ndarray) and self.attribute.shape == (3,3) ) def convert_to_representation(self, value): unit_cell = UnitCell(value) self.saved_value = value lengths, angles = unit_cell.get_parameters() | return isinstance(self.attribute, UnitCell) def convert_to_representation(self, value): lengths, angles = value.parameters | def applicable_attribute(self): return ( isinstance(self.attribute, numpy.ndarray) and self.attribute.shape == (3,3) ) |
unit_cell = UnitCell(self.saved_value) unit_cell.set_parameters(lengths, angles) return unit_cell.cell | return UnitCell.from_parameters3(lengths, angles) | def convert_to_value(self, representation): lengths, angles = ComposedInTable.convert_to_value(self, representation) unit_cell = UnitCell(self.saved_value) unit_cell.set_parameters(lengths, angles) return unit_cell.cell |
transformation.invert() primitive.Transform(node, transformation) | primitive.Transform(node, transformation.inv) | def do(self): node = context.application.cache.node destination = context.application.cache.drag_destination if isinstance(node, GLTransformationMixin): transformation = destination.get_frame_relative_to(node.parent) transformation.invert() primitive.Transform(node, transformation) primitive.Move(node, destination, new... |
if node.cell_active.sum() == 0: return False | if node.cell.active.sum() == 0: return False | def analyze_selection(): # A) calling ancestors if not Immediate.analyze_selection(): return False # B) validating node = context.application.cache.node Universe = context.application.plugins.get_node("Universe") if not isinstance(node, Universe): return False if node.cell_active.sum() == 0: return False # C) passed al... |
rotation = Rotation(universe.calc_align_rotation_matrix()) | rotation = universe.cell.alignment_a | def do(self): universe = context.application.cache.node # first make sure the cell is right handed if numpy.linalg.det(universe.cell.matrix) < 0 and universe.cell_active.sum() == 3: new_matrix = universe.cell.matrix.copy() temp = new_matrix[:,0].copy() new_matrix[:,0] = new_matrix[:,1] new_matrix[:,1] = temp new_cell =... |
primitive.SetProperty(vector, "targets", reversed(vector.get_targets())) | primitive.SetProperty(vector, "targets", vector.get_targets()[::-1]) | def do(self): for vector in context.application.cache.nodes: primitive.SetProperty(vector, "targets", reversed(vector.get_targets())) |
active, inactive = self.get_active_inactive() | active, inactive = self.cell.active_inactive | def set_clip_planes(self): if not self.clipping: return clip_planes = context.application.scene.clip_planes assert len(clip_planes) == 0 active, inactive = self.get_active_inactive() for index in active: axis = self.cell.matrix[:,index] ortho = self.cell.reciprocal[index] / numpy.linalg.norm(self.cell.reciprocal[index]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.