Commit a7f370bb authored by cmaffeo2's avatar cmaffeo2
Browse files

Allow multiple grids in arbdmodel

parent 5b0a865a
......@@ -1180,15 +1180,18 @@ num {num}
{dynamics}
""".format(**particleParams))
if 'grid' in particleParams:
if not isinstance(pt.grid, list): pt.grid = [pt.grid]
grids = []
scales = []
for g,s in pt.grid:
## TODO, use Path.relative_to?
try:
fh.write("gridFile {}\n".format(g.relative_to(os.getcwd())))
grids.append(str( g.relative_to(os.getcwd()) ))
except:
fh.write("gridFile {}\n".format(g))
grids.append(str(g))
scales.append(str(s))
fh.write("gridFileScale {}\n".format(s))
fh.write("gridFile {}\n".format(" ".join(grids)))
fh.write("gridFileScale {}\n".format(" ".join(scales)))
else:
fh.write("gridFile {}/null.dx\n".format(self.potential_directory))
......
......@@ -3856,18 +3856,16 @@ proc calcforces {} {
self.grid_potentials.append((grid_file,scale,per_nucleotide, filter_fn))
def _apply_grid_potentials_to_beads(self, bead_type_dict ):
if len(self.grid_potentials) > 1:
raise NotImplementedError("Multiple grid potentials are not yet supported")
def add_grid_to_type(particle_type):
if particle_type.name[0] == "O": return
s = scale*particle_type.nts if per_nucleotide else scale
try:
particle_type.grid = particle_type.grid + (grid_file, s)
except:
particle_type.grid = tuple((grid_file, s))
for grid_file, scale, per_nucleotide, filter_fn in self.grid_potentials:
def add_grid_to_type(particle_type):
if particle_type.name[0] == "O": return
s = scale*particle_type.nts if per_nucleotide else scale
try:
particle_type.grid = list(particle_type.grid) + [(grid_file, s)]
except:
particle_type.grid = [(grid_file, s)]
particle_type.grid = tuple(particle_type.grid)
if filter_fn is None:
for key,particle_type in bead_type_dict.items():
add_grid_to_type(particle_type)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment