Clarification on using "true" or "True" vs ".TRUE." or "T" in INCAR files.

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
hszhao.cn@gmail.com
Full Member
Full Member
Posts: 190
Joined: Tue Oct 13, 2020 11:32 pm

Clarification on using "true" or "True" vs ".TRUE." or "T" in INCAR files.

#1 Post by hszhao.cn@gmail.com » Sun Jul 28, 2024 12:25 am

Dear VASP community,

I'm seeking clarification on the proper way to specify boolean values in INCAR files, say for the LHFCALC tag. I've noticed that while .TRUE. and T are commonly used and documented, it seems that "true" or "True" also works, as shown in the following INCAR file generated by pymatgen:

Code: Select all

ALGO = All
EDIFF = 0.0004
ENCUT = 520
HFSCREEN = 0.2
IBRION = 2
ICHARG = 1
ISIF = 3
ISMEAR = 0
ISPIN = 2
IVDW = 11
LASPH = True
LHFCALC = True
LMAXMIX = 4
LORBIT = 11
LREAL = Auto
LWAVE = False
MAGMOM = 2*-0.009 3*0.41 1*0.414 2*0.412
NELM = 100
NSW = 99
PREC = Accurate
PRECFOCK = Fast
SIGMA = 0.05
VDW_S8 = 0.109
VDW_SR = 1.129
My questions are:

1. Is using "true" or "True" instead of ".TRUE." or "T" for boolean values in INCAR files officially supported?

2. Is this behavior consistent across all VASP versions and all boolean tags?

3. Are there any potential issues or inconsistencies that might arise from using "true" or "True" instead of the standard ".TRUE." or "T"?

4. What is the recommended best practice for specifying boolean values in INCAR files?

I've looked through the documentation and searched the forum, but couldn't find a definitive answer on this specific usage. Any insights or official stance on this matter would be greatly appreciated.

Thank you for your time and expertise.

Best regards,
Zhao

manuel_engel1
Global Moderator
Global Moderator
Posts: 126
Joined: Mon May 08, 2023 4:08 pm

Re: Clarification on using "true" or "True" vs ".TRUE." or "T" in INCAR files.

#2 Post by manuel_engel1 » Mon Jul 29, 2024 8:07 am

Dear Zhao,

Thank you for posting on the VASP forum. The way INCAR tags are parsed has changed over time. Therefore, the behavior will depend on the VASP version you are using. Everything I say here about the "true" values also applies to the "false" values.
1. Is using "true" or "True" instead of ".TRUE." or "T" for boolean values in INCAR files officially supported?
Using true, True, .TRUE. and T are all officially supported on recent VASP versions.
2. Is this behavior consistent across all VASP versions and all boolean tags?
No, the behavior is not consistent across all VASP versions. Lowercase t or true are a feature introduced in VASP 6. They will not work with older versions of VASP.
3. Are there any potential issues or inconsistencies that might arise from using "true" or "True" instead of the standard ".TRUE." or "T"?
Other than true not being supported by older version, no. All variants behave exactly the same.
4. What is the recommended best practice for specifying boolean values in INCAR files?
I would recommend to write True and False which is legible, unambiguous and easy to type. This way of writing also keeps backwards compatibility with older VASP versions, since it uses an uppercase "T" or "F".
Manuel
VASP developer

hszhao.cn@gmail.com
Full Member
Full Member
Posts: 190
Joined: Tue Oct 13, 2020 11:32 pm

Re: Clarification on using "true" or "True" vs ".TRUE." or "T" in INCAR files.

#3 Post by hszhao.cn@gmail.com » Mon Jul 29, 2024 12:35 pm

Dear manuel_engel1,

Thank you very much for your systematic and detailed explanation, but I still want to know if there is any specific documentation or how to search the source code to verify these facts.

Regards,
Zhao

manuel_engel1
Global Moderator
Global Moderator
Posts: 126
Joined: Mon May 08, 2023 4:08 pm

Re: Clarification on using "true" or "True" vs ".TRUE." or "T" in INCAR files.

#4 Post by manuel_engel1 » Mon Jul 29, 2024 1:09 pm

No worries! Reading of the Boolean values into Fortran logical types is done via the standard Fortran read statement. Therefore, the behavior is governed by the Fortran Standard. For example, here is the relevant section from the Fortran 95 standard:
The input field consists of optional blanks, optionally followed by a decimal point, followed by a T
for true or F for false. The T or F may be followed by additional characters in the field, which are
ignored.
If a processor is capable of representing letters in both upper and lower case, a lower-case letter is
equivalent to the corresponding upper-case letter in a logical input field.

The logical constants .TRUE. and .FALSE. are acceptable input forms.
We cannot guarantee that every compiler adheres to the standard.
Manuel
VASP developer

Post Reply