# Maximum number of characters in a .inp line

**URL:** <https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623>\
**Category:** Model setup\
**Created:** [April 27, 2023, 11:45am UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623 "2023-04-27T11:45:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [April 27, 2023, 11:45am UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/1 "2023-04-27T11:45:45Z")

</div>

HI,

Ccx do not respond properly when I request a TRANSFORM CARD written like:

\*TRANSFORM,NSET=NFace,TYPE=R  
-9.42849795070461E-05,0.707071235581443,-0.707142318719276,-0.707071235581443,-9.42849795070461E-05,0

After many attempts it works written like this:

\*TRANSFORM,NSET=NFace,TYPE=R  
-9.42849795E-05,0.707071235581443,-0.707142318719276,-0.707071235581443,-9.42849795E-05,0

They are essentially the same but one has 101 maximum characters length and the second 89 (I have removed some decimals).  
There is a maximum limit of 95 characters on the same line.

I haven’t found nothing said about this limitation on the ccx manual.

Regards

---

<div class="post-metadata">

**Author:** ![Awareness](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Awareness](https://calculix.discourse.group/u/Awareness)\
**Post date:** [April 27, 2023, 11:56am UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/2 "2023-04-27T11:56:36Z")

</div>

> [@Disla](#):
>
> I haven’t found nothing said about this limitation on the ccx manual.

Wrong manual. You would better try Fortran manual, the version ccx is written in. Especially integers and floating point numbers. Good luck.

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [April 27, 2023, 11:59am UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/3 "2023-04-27T11:59:20Z")

</div>

I thought Fortran was 72 COLUMNS

---

<div class="post-metadata">

**Author:** ![Awareness](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Awareness](https://calculix.discourse.group/u/Awareness)\
**Post date:** [April 27, 2023, 12:01pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/4 "2023-04-27T12:01:17Z")

</div>

I do not know Fortran. I cannot help on that.

---

<div class="post-metadata">

**Author:** ![Awareness](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Awareness](https://calculix.discourse.group/u/Awareness)\
**Post date:** [April 27, 2023, 12:04pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/5 "2023-04-27T12:04:34Z")

</div>

> [@Disla](#):
>
> -9.42849795E-05

May be to round such a number. Some numbers after period are not reliable at all so drop them off.

---

<div class="post-metadata">

**Author:** ![JuanP74](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@JuanP74](https://calculix.discourse.group/u/JuanP74)\
**Post date:** [April 27, 2023, 5:38pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/6 "2023-04-27T17:38:58Z")

</div>

this is Fortran 77 input file. It can handle input text files with different formats, I think CCX reads numbers with a maximum length of 20 chars, try fixing this (no issue about line length).

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [April 27, 2023, 6:50pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/7 "2023-04-27T18:50:14Z")

</div>

> [@JuanP74](#):
>
> maximum length of 20 chars

Exactly!!  
Writing a length of 21chars doesn’t fail or warns but gives an incorrect result.  
Not sure if the number is omitted or assumed to be zero.

---

<div class="post-metadata">

**Author:** ![JuanP74](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@JuanP74](https://calculix.discourse.group/u/JuanP74)\
**Post date:** [April 28, 2023, 6:30pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/8 "2023-04-28T18:30:16Z")

</div>

CalculiX (just as ABAQUS) reads reals with the f20.0 Fortran format.

I modified the program (`Finp.f`) [here](https://docs.oracle.com/cd/E19957-01/805-4939/z40007439c43/index.html) so you can see how it reads the first number in your TRANSFORM keyword above:

```auto
        PROGRAM MAIN
        REAL*8 R,S
        CHARACTER LINE1*24 / '-9.42849795070461E-05' / 
        CHARACTER LINE2*24 / '-9.4284979507046E-05' / 
        READ( LINE1, '( F20.0 )') R
        READ( LINE2, '( F20.0 )') S  
        PRINT *, R
        PRINT *, S
        END

```

compile `gfortran Finp.f -o Finp` the result is:

```auto
  -9.4284979507046103     
  -9.4284979507045996E-005

```

As you see the first number reads wrong.

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [April 29, 2023, 9:27pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/9 "2023-04-29T21:27:22Z")

</div>

F77 does have the 72 character line limit.  
F90 allows for 80 or so…  
In any case, why not try to stay with lower decimal places?

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [April 29, 2023, 9:42pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/10 "2023-04-29T21:42:58Z")

</div>

Hi jbr,

It’s being an accident. I copy pasted the values from an Excel file and found that error. I agree with you that’s not the right way to represent a number, but it may happen if the inp is build from an external automated input. In fact, the inp we are dealing with in the “composite buckling post” has numbers larger than 20 Chars, so it is not so uncommon. I have informed just in case there could be a warning or fix in some way as the number is read wrong and may pass unnoticed. Not sure if this could also happen internally and not only at inp level.

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [April 29, 2023, 9:45pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/11 "2023-04-29T21:45:15Z")

</div>

Thanks for looking at this Juan. I’m completely ignorant in anything related with programing.

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [April 29, 2023, 11:11pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/12 "2023-04-29T23:11:14Z")

</div>

I understand. I believe this issue of character lengths and so forth is presented in the documentation. So, I would stay away from anything that comes close to the full lenght of a given type (string, float, etc) since I don’t know how it may break things in the code.

Keep in mind that there can’t be a warning because for the interpreter (fortran input in this case), the number is as read. You should tailor your other tool to export in the “right” format. Well, at least that’s how I try to do it.  
The same is true for the number of items on a given line, it should be followed strictly to avoid issues down the road.

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [January 16, 2025, 3:56pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/13 "2025-01-16T15:56:40Z")

</div>

HI, Sorry if I’m repeating my self but re-reading the post I’m still not sure about the maximum number of columns allowed in the inp file.  
On this last day many posts have been published regarding compiling ccx and I can see they are using gfortran OPTIONS… f77.

¿Should I assume the 72 character line is the official limit.?

---

<div class="post-metadata">

**Author:** ![fgr](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@fgr](https://calculix.discourse.group/u/fgr)\
**Post date:** [January 16, 2025, 5:33pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/14 "2025-01-16T17:33:13Z")

</div>

@Disla , so far by my knowledge, then in ccx source code I have recognized fortran 66 fortran 77 and actual i also higher code than fortran 77.  
but using the 72 characters limit then you should avoid any problems no matter what fortran compiler you should choose.

[Fortran 77 Source Line Formats](https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn6l/index.html)

[Appendix C Fortran 90 Features and Differences](https://docs.oracle.com/cd/E19957-01/805-4941/6j4m2sobi/index.html#:~:text=The%20default%20maximum%20line%20length,and%20132%20for%20free%20form.)

Above are for fortran source, for the ccx \*.inp file it actual depend on the definition of the specific format specifier for the specific read statement at the specific location in the source code, so you will need to look into the ccx source to be 100% sure.

---

<div class="post-metadata">

**Author:** ![JuanP74](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@JuanP74](https://calculix.discourse.group/u/JuanP74)\
**Post date:** [January 16, 2025, 6:00pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/15 "2025-01-16T18:00:07Z")

</div>

the 72 characters is for source code file input. Input data files only have the limit the programmer set in the code and not sure if there is a limit set by the compiler but for sure larger that 72 characters at least since 90’s. The number of columns for certain types of inputs is explained in ccx manual. This is different to the length of a single data type that will be always 20 chars for numerical inputs (read as F20.0).

---

<div class="post-metadata">

**Author:** ![Disla](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/disla/32/3548_2.png) [@Disla](https://calculix.discourse.group/u/Disla)\
**Post date:** [January 16, 2025, 8:04pm UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/16 "2025-01-16T20:04:51Z")

</div>

Thank you both.

Regards

---

<div class="post-metadata">

**Author:** ![reox](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/reox/32/4312_2.png) [@reox](https://calculix.discourse.group/u/reox)\
**Post date:** [March 23, 2026, 8:22am UTC](https://calculix.discourse.group/t/maximum-number-of-characters-in-a-inp-line/1623/17 "2026-03-23T08:22:28Z")

</div>

I encountered a similar problem with the number format. I wrote some .inp using meshio, which uses by default `.16e` as number format. However, this lead to situations, where the total number of characters is longer than 20:

```auto
 *ERROR reading *NODE. Card image:
        1,3.0060383804014599E+01,-5.6471147636060401E+01,-1.8035294085219501E+01

```

Fortunately, you can change the float format for meshio easily, and I use `.6f` now - because typically, the meshes are in mm and higher resolution of the floats seems to be unnecessary.

However, I would like to ask what number format - coming from python - would be the safest but also most precise option, when reading the mesh with calculix? I think one problem is, that Fortran specifies the number only with the _total number of characters_, while in python I can specify the _number of decimal places_. I.e., the `.0` in the Fortran format is ignored, once a decimal place is found during reading but `20.0f` in python means 20 characters in total, but zero decimal places - furthermore, using the number before the dot implies padding with spaces, which I want to avoid (to reduce the size of the files). `20.Xf` could be an option with a given precision of decimal places `X`, as long as the number before the decimal point has less than `20-X-1` places…

Perhaps `.13e` would be the best option (as long as the exponent is not larger than 99 - then the safest option would be `.12e`), as it should always fit 20 characters?
