Skip to content

Molecular mass error #88

@giolajide

Description

@giolajide

If molecular mass is not written in the Gaussian output file (as I've noticed can happen when doing just a frequency calculation rather than optimization + frequency), then we'll get the following error:

Traceback (most recent call last):
File "path_to_goodvibes", line 11, in
sys.exit(main())
File "path_to_GoodVibes.py", line 1038, in main
bbe = calc_bbe(file, options.QS, options.QH, options.S_freq_cutoff, options.H_freq_cutoff, options.temperature,
File "path_to_thermo.py", line 664, in init
s_trans = calc_translational_entropy(molecular_mass, conc, temperature, solv)
UnboundLocalError: local variable 'molecular_mass' referenced before assignment

This can be solved by adding the following lines just after "self.inverted_freqs = inverted_freqs" in thermo.py:

    _try:
        print(f"Molar mass:\t{molecular_mass}")
    except UnboundLocalError:
        print("""Molecular mass not gotten from Gaussian output file
                So we will get the molar mass by ASE, which may differ marginally
                (<0.1 % in my experience with ONE system)
                 which still gave the same energetics""")
        try:
            import ase
        except ImportError:
            print("ASE not installed. Exiting")
            sys.exit(1)
        molecular_mass = sum(ase.io.read(file,-1).get_masses())_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions