Commit f20a449c authored by cmaffeo2's avatar cmaffeo2
Browse files

Fix to productpotential

parent 4a48abc6
...@@ -157,9 +157,9 @@ class Parent(): ...@@ -157,9 +157,9 @@ class Parent():
# for b in (i,j): assert(b in beads) # for b in (i,j): assert(b in beads)
self.bond_angles.append( (i,j,k,l, bond_angle) ) self.bond_angles.append( (i,j,k,l, bond_angle) )
def add_product_potential_angle(self, potential_list): def add_product_potential(self, potential_list):
""" potential_list: list of tuples of form (particle_i, particle_j,..., TabulatedPotential) """ """ potential_list: list of tuples of form (particle_i, particle_j,..., TabulatedPotential) """
if len(terms) < 2: raise ValueError("Too few potentials") if len(potential_list) < 2: raise ValueError("Too few potentials")
for elem in potential_list: for elem in potential_list:
beads = elem[:-1] beads = elem[:-1]
pot = elem[-1] pot = elem[-1]
...@@ -1272,20 +1272,23 @@ component "data" value 3 ...@@ -1272,20 +1272,23 @@ component "data" value 3
def _writeArbdProductPotentialFile( self ): def _writeArbdProductPotentialFile( self ):
if len(self.product_potentials) > 0: if len(self.product_potentials) > 0:
with open(self._product_potential_filename,'w') as fh: with open(self._product_potential_filename,'w') as fh:
for ijk_tb in self.get_product_potentials(): for pot in self.get_product_potentials():
ijk = ijk_b[:-1] line = "PRODUCTPOTENTIAL "
tb = ijk_tb[-1] for ijk_tb in pot:
if not (type(tb) is tuple or type(tb) is list): ijk = ijk_tb[:-1]
if len(tb) != 2: raise ValueError("Invalid product potential") tb = ijk_tb[-1]
type_,b = tb if type(tb) is tuple or type(tb) is list:
if type(type_) is not str: raise ValueError("Invalid product potential: unrecognized specification of potential type") if len(tb) != 2: raise ValueError("Invalid product potential")
else: type_,b = tb
type_ = "" if type(type_) is not str: raise ValueError("Invalid product potential: unrecognized specification of potential type")
b = tb else:
type_ = ""
if type(b) is not str and not isinstance(b, Path): b = tb
b.write_file() if type(b) is not str and not isinstance(b, Path):
fh.write("PRODUCTPOTENTIAL "+" ".join([str(x) for x in ijk+[type_,b] if x != ""])) b.write_file()
line = line+" ".join([str(x.idx) for x in ijk])+" "
line = line+" ".join([str(x) for x in [type_,b] if x != ""])+" "
fh.write(line)
def dimensions_from_structure( self, padding_factor=1.5, isotropic=False ): def dimensions_from_structure( self, padding_factor=1.5, isotropic=False ):
......
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