Esempio n. 1
0
def run_s22(reload=False):
    h = 0.4
    vacuum = 2.0
    #molecules = ['Ammonia_dimer']
    molecules = s22_molecules
    test_f = Fragmentation(molecules)
    
    sys = [Atoms(s22_sim_data[molecule]['symbols'],
                 s22_sim_data[molecule]['positions'])
           for molecule in molecules]
    
    test_f.molecules = [GPAWSystems(molecule,atoms=atoms,
                                    h=h, vacuum=vacuum,
                                    fragment_list=fragment_names(molecule))
                        for molecule,atoms in zip(molecules,sys)]

    atom_fragments_1 = [ system.system.copy()[fragment_n(system.name,1)] 
                         for system in test_f.molecules]
    atom_fragments_2 = [ system.system.copy()[fragment_n(system.name,2)]
                         for system in test_f.molecules]
    
    test_f.fragments = [ GPAWSystems(name+'_f1',atoms=a,h=h, vacuum=vacuum)
                         for name,a in zip(molecules,atom_fragments_1)]
    
    test_f.fragments += [ GPAWSystems(name+'_f2',atoms=a,h=h, vacuum=vacuum)
                          for name,a in zip(molecules,atom_fragments_2)]
    
    test_f.fill_data_reference(data_type='s22')
    if reload:
        test_f.load_data('data.pkl')
        test_f.calculate_error()
        test_f.calculate_mae()
        print test_f.mae
    else:
        test_f.run(write=True)
Esempio n. 2
0
def run_s22(reload=False):
    h = 0.4
    vacuum = 2.0
    #molecules = ['Ammonia_dimer']
    molecules = s22_molecules
    test_f = Fragmentation(molecules)

    sys = [
        Atoms(s22_sim_data[molecule]['symbols'],
              s22_sim_data[molecule]['positions']) for molecule in molecules
    ]

    test_f.molecules = [
        GPAWSystems(molecule,
                    atoms=atoms,
                    h=h,
                    vacuum=vacuum,
                    fragment_list=fragment_names(molecule))
        for molecule, atoms in zip(molecules, sys)
    ]

    atom_fragments_1 = [
        system.system.copy()[fragment_n(system.name, 1)]
        for system in test_f.molecules
    ]
    atom_fragments_2 = [
        system.system.copy()[fragment_n(system.name, 2)]
        for system in test_f.molecules
    ]

    test_f.fragments = [
        GPAWSystems(name + '_f1', atoms=a, h=h, vacuum=vacuum)
        for name, a in zip(molecules, atom_fragments_1)
    ]

    test_f.fragments += [
        GPAWSystems(name + '_f2', atoms=a, h=h, vacuum=vacuum)
        for name, a in zip(molecules, atom_fragments_2)
    ]

    test_f.fill_data_reference(data_type='s22')
    if reload:
        test_f.load_data('data.pkl')
        test_f.calculate_error()
        test_f.calculate_mae()
        print test_f.mae
    else:
        test_f.run(write=True)