def test_names(testdir): """Test different gs vs excited name. Tests also default names.""" # do a Vibrations calculation first atoms = H2Morse() vib = Vibrations(atoms) vib.run() assert '0x-' in vib.cache # do a Resonant Raman calculation rmc = ResonantRamanCalculator(atoms, H2MorseExcitedStatesCalculator, verbose=True) rmc.run() # excitation files should reside in the same directory as cache files assert (Path(rmc.name) / ('ex.eq' + rmc.exext)).is_file() # XXX does this still make sense? # remove the corresponding pickle file, # then Placzek can not anymore use it for vibrational properties key = '0x-' assert key in rmc.cache del rmc.cache[key] # make sure this is not used om = 1 gam = 0.1 pz = Placzek(atoms, H2MorseExcitedStates, name='vib', exname='raman') pzi = pz.get_absolute_intensities(omega=om, gamma=gam)[-1] parprint(pzi, 'Placzek') # check that work was distributed correctly assert len(pz.myindices) <= -(-6 // world.size)
def test_names(): """Test different gs vs excited name. Tests also default names.""" # do a Vibrations calculation first atoms = H2Morse() Vibrations(atoms).run() assert os.path.isfile('vib.0x-.pckl') # do a Resonant Raman calculation rmc = ResonantRamanCalculator(atoms, H2MorseExcitedStatesCalculator, verbose=True) rmc.run() # remove the corresponding pickle file, # then Placzek can not anymore use it for vibrational properties assert os.path.isfile('raman.0x-.pckl') os.remove('raman.0x-.pckl') # make sure this is not used om = 1 gam = 0.1 pz = Placzek(atoms, H2MorseExcitedStates, name='vib', exname='raman') pzi = pz.get_absolute_intensities(omega=om, gamma=gam)[-1] parprint(pzi, 'Placzek') # check that work was distributed correctly assert len(pz.myindices) <= -(-6 // world.size)
def __init__(self, atoms, *args, **kwargs): super().__init__(atoms, *args, **kwargs) for key in ['txt', 'exext', 'exname']: kwargs.pop(key, None) kwargs['name'] = kwargs.get('name', self.name) self.vibrations = Vibrations(atoms, *args, **kwargs) self.delta = self.vibrations.delta self.indices = self.vibrations.indices