<commit_before>from pypif.obj.common.property import Property

from .base import DFTParser, Value_if_true
import os
from ase.calculators.vasp import Vasp
from ase.io.vasp import read_vasp, read_vasp_out
from pypif.obj import Value, FileReference


class VaspParser(DFTParser):
    '''
    Parser for VASP calculations
    '''

    def get_name(self): return "VASP"
    
    def test_if_from(self, directory):
        # Check whether it has an INCAR file
        return os.path.isfile(os.path.join(directory, 'INCAR'))
        
    def get_output_structure(self):
        self.atoms = read_vasp_out(os.path.join(self._directory, 'OUTCAR'))
        return self.atoms

    def get_outcar(self):
        raw_path = os.path.join(self._directory, 'OUTCAR')
        if raw_path[0:2] == "./":
            raw_path = raw_path[2:]<commit_msg>Use OUTCAR, not INCAR, to detect VASP files<commit_after>from pypif.obj.common.property import Property

from .base import DFTParser, Value_if_true
import os
from ase.calculators.vasp import Vasp
from ase.io.vasp import read_vasp, read_vasp_out
from pypif.obj import Value, FileReference


class VaspParser(DFTParser):
    '''
    Parser for VASP calculations
    '''

    def get_name(self): return "VASP"
    
    def test_if_from(self, directory):
        # Check whether it has an INCAR file
        return os.path.isfile(os.path.join(directory, 'OUTCAR'))
        
    def get_output_structure(self):
        self.atoms = read_vasp_out(os.path.join(self._directory, 'OUTCAR'))
        return self.atoms

    def get_outcar(self):
        raw_path = os.path.join(self._directory, 'OUTCAR')
        if raw_path[0:2] == "./":
            raw_path = raw_path[2:]
{'fraction_non_alphanumeric': 0.10383480825958702, 'fraction_numerical': 0.0035398230088495575, 'mean_word_length': 3.1365853658536587, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1273690', 'n_tokens_mistral': 584, 'n_tokens_neox': 565, 'n_words': 134}