| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | file |
Name of the file |
File type from extension
elemental function get_filetype(file) result(ftype) !> Name of the file character(len=*), intent(in) :: file !> File type from extension integer :: ftype integer :: iext, isep ftype = filetype%unknown iext = index(file, ".", back=.true.) isep = scan(file, "\/", back=.true.) if (iext > isep .and. iext > 0) then select case(to_lower(file(iext+1:))) case("coord", "tmol") ftype = filetype%tmol case("xyz", "log") ftype = filetype%xyz case("mol") ftype = filetype%molfile case("sdf") ftype = filetype%sdf case("poscar", "contcar", "vasp") ftype = filetype%vasp case("pdb") ftype = filetype%pdb case("gen") ftype = filetype%gen case("ein") ftype = filetype%gaussian case("qcjson") ftype = filetype%qcschema case("cjson") ftype = filetype%cjson case("qchem") ftype = filetype%qchem case("pmgjson") ftype = filetype%pymatgen case("json") ftype = filetype%json case default continue end select if (ftype /= filetype%unknown) return else iext = len(file) + 1 end if if (iext > isep) then if (file(isep+1:) == "geometry.in") then ftype = filetype%aims end if select case(to_lower(file(isep+1:iext-1))) case("geometry.in") ftype = filetype%aims case("coord") ftype = filetype%tmol case("poscar", "contcar") ftype = filetype%vasp case default continue end select end if end function get_filetype