nomad-coe / electronic-parsers

Apache License 2.0
18 stars 7 forks source link

CP2K fatal error getting atomic numbers #198

Closed ndaelman-hu closed 4 months ago

ndaelman-hu commented 4 months ago

When processing files like supercell.xyz in the following entry, the parser fails in get_atomic_number, not finding the correct atomic number.

ndaelman-hu commented 4 months ago

@ladinesa Naive question, but the function's logic looks contrived to me. In this error message, there are element labels, but no atomic numbers. The former should suffice to populate.

@aalbino2 Is a user allowed to freely switch between element labels and atomic numbers in CP2K?

aalbino2 commented 4 months ago

Hi @ndaelman-hu, there is the case in which you declare multiple kinds with same atomic number and different electronic structure, e.g., alpha and beta polarized carbon atoms. In that case the label is automatically set to C1 and C2

ndaelman-hu commented 4 months ago

Hi @ndaelman-hu, there is the case in which you declare multiple kinds with same atomic number and different electronic structure, e.g., alpha and beta polarized carbon atoms. In that case the label is automatically set to C1 and C2

Ow, that's superuseful to know, thx! However, is the user obliged to identify them as carbon C*? Please link any documentation that you know of.

aalbino2 commented 4 months ago

This is an example of the input file section where the kinds are defined, so you have an element attribute that is the C in thi scase and this one can't vary from the available set of atoms existing

     &KIND C1
       BASIS_SET DZVP-MOLOPT-SR-GTH
       ELEMENT C
       POTENTIAL GTH-PBE-q4
       &BS  T
         &ALPHA
           NEL  2
           L  1
           N  2
         &END ALPHA
         &BETA
           NEL  -2
           L  1
           N  2
         &END BETA
       &END BS
     &END KIND
     &KIND C2
       BASIS_SET DZVP-MOLOPT-SR-GTH
       ELEMENT C
       POTENTIAL GTH-PBE-q4
       &BS  T
         &ALPHA
           NEL  -2
           L  1
           N  2
         &END ALPHA
         &BETA
           NEL  2
           L  1
           N  2
         &END BETA
       &END BS
     &END KIND
ndaelman-hu commented 4 months ago

Okay, then based on your example and the docs, I'm going to derive elements from the name (when given).

ndaelman-hu commented 4 months ago

Okay, the extraction function wasn't the problem, but rather the modified header... Still, I think the former is better now too.