Skip to content
Snippets Groups Projects
Commit f20a449c authored by cmaffeo2's avatar cmaffeo2
Browse files

Fix to productpotential

parent 4a48abc6
No related branches found
No related tags found
No related merge requests found
......@@ -157,9 +157,9 @@ class Parent():
# for b in (i,j): assert(b in beads)
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) """
if len(terms) < 2: raise ValueError("Too few potentials")
if len(potential_list) < 2: raise ValueError("Too few potentials")
for elem in potential_list:
beads = elem[:-1]
pot = elem[-1]
......@@ -1272,20 +1272,23 @@ component "data" value 3
def _writeArbdProductPotentialFile( self ):
if len(self.product_potentials) > 0:
with open(self._product_potential_filename,'w') as fh:
for ijk_tb in self.get_product_potentials():
ijk = ijk_b[:-1]
for pot in self.get_product_potentials():
line = "PRODUCTPOTENTIAL "
for ijk_tb in pot:
ijk = ijk_tb[:-1]
tb = ijk_tb[-1]
if not (type(tb) is tuple or type(tb) is list):
if type(tb) is tuple or type(tb) is list:
if len(tb) != 2: raise ValueError("Invalid product potential")
type_,b = tb
if type(type_) is not str: raise ValueError("Invalid product potential: unrecognized specification of potential type")
else:
type_ = ""
b = tb
if type(b) is not str and not isinstance(b, Path):
b.write_file()
fh.write("PRODUCTPOTENTIAL "+" ".join([str(x) for x in ijk+[type_,b] if x != ""]))
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 ):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment