idaholab/MontePy

Extra blank lines are sometimes added on write_problem

MicahGale opened this issue · 1 comments

Describe the bug

This came from #520 testing, and specifically tests/inputs/..: test_universe.imcnp, test_interp_edge.imcnp, testReadEdgeCase.imcnp.

To Reproduce

A short code snippet of what you have ran. Please change or remove any specific values or anything that can't be public. For example:

montepy.read_input("foo.imcnp").write_problem('bar.imcnp')

MCNP input file snippet

If applicable, please include a small section of the input file you were working on. If it includes any specific values please change or remove them. For example:

MCNP Test Model for MOAA
C cells
c
1 1 20
         -1000  $ dollar comment
     imp:n,p=1 trcl=5
     u=1
2 2 8
      -1005
     imp:n=1
     imp:p=0.5
     lat 1 
     fill= 0:1 0:1 0:0 1 0 0 1 (5)
3 3 -1
      1000 1005 -1010
     imp:n,p=1
99 0
      1010
     imp:n,p=0
     fill=1
5 0 
      #99
      imp:n,p=3 fill=1 (1 0.0 0.0)
c foo end comment

C surfaces
1000 SO 1
1005 RCC 0 1.5 -0.5 0 0 1 0.25
1010 SO 3

C data
C materials
C UO2 5 atpt enriched
m1        92235.80c           5 &
92238.80c          95
c testing comments
sc1 This is a high quality source comment
Fc5 Such a good tally comment.
C Iron
m2        26054.80c        5.85
          26056.80c       91.75
          26057.80c        2.12
          26058.80c        0.28
C water
m3        1001.80c           2
           8016.80c           1
MT3 lwtr.23t
TR5 0.0 0.0 1.0
C execution
ksrc 0 0 0
kcode 100000 1.000 50 1050
phys:p j 1 2j 1
mode n p
vol NO 2J 1 1.5 J

This writes out as:

MCNP Test Model for MOAA
C cells
c
1 1 20
         -1000  $ dollar comment
     IMP:n=0.0
2 2 8
      -1005
     imp:n=1
     imp:p=0.5 $ graveyard
3 3 -1
      1000 1005 -1010
c
c foo end comment
c
     IMP:n=0.0
99 0 1000:-1005 1010 $graveyard
     IMP:n=0.0
5 0
      #99 IMP:n=0.0

C surfaces
1000 SO 1
1005 RCC 0 1.5 -0.5 0 0 1 0.25
1010 SO 3

C data
C materials
C UO2 5 atpt enriched
u 350 2J -1
FILL 2J 350
m1        92235.80c           5 &
92238.80c          95
C Iron

m2        26054.80c        5.85
          26056.80c       91.75
          26057.80c        2.12
          26058.80c        0.28
C water
m3        1001.80c           2
           8016.80c           1
MT3 lwtr.23t
C execution
ksrc 0 0 0
kcode 100000 1.000 50 1050
phys:p j 1 2j 1
mode n p
vol NO 2J 1 1.5 J

Version

  • Version 0.4.0

Additional context

Add any other context about the problem here.

This is likely related to #352.