Skip to content

Commit

Permalink
Merge pull request #2 from fabothch/devel
Browse files Browse the repository at this point in the history
add line break for long element position lines
  • Loading branch information
fabothch authored Feb 26, 2021
2 parents 760cde4 + 82c1fb6 commit dbebd84
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tmprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,27 @@ def cml(internal_defaults, argv=None):
short_positions.append(str(first))
else:
short_positions.append("{}-{}".format(first, last))
positions = [str(i) for i in positions]


out.write('{} {} \ \n'.format(element, ','.join(short_positions)))
# break long lines
newpos = []
tmp = []
lenpos = 0
for item in short_positions:
lenitem = len(item)+1
if (lenpos + lenitem) > 70:
newpos.append(','.join(tmp))
lenpos = lenitem
tmp = [item,]
else:
tmp.append(item)
lenpos+=lenitem
if tmp:
newpos.append(','.join(tmp))
for count, item in enumerate(newpos,0):
if count == 0:
out.write('{} {} \ \n'.format(element, item))
else:
out.write('{} {} \ \n'.format(" ", item))
#out.write('{} {} \ \n'.format(element, ','.join(short_positions)))
out.write(' basis ={} {} \ \n'.format(element, args.basis))
if element in all_ecp:
if element in ecp28:
Expand Down

0 comments on commit dbebd84

Please sign in to comment.