const cnumber pump_amplitude( 5.0, 0.0 ); const double pump_frequency = 0.2; // this is actually the detuning const double gamma_fundamental = 1.0; const double gamma_second_harmonic = 4.0; const double kappa = 0.5; // nonlinear coupling constant const double eta = 0.25; // a very weak local oscillator (for homodyne detection) const double movie_length = 100.0; // define a classical (cnumber-valued) pump laser field: // cnumber pump( double t ) { cnumber p = pump_amplitude * exp( i * pump_frequency * t ); // to get a nice movie which can be played as an endless loop, // we must return to the initial state, so we turn of the pump // when we are near the end of the movie: if( t >= (movie_length - 5.0 ) ) p *= (movie_length - t) / 5.0; return p; } void the_experiment( void ) { // define two modes, with 24 and 16 levels, resp.: // Mode fundamental( BOSONIC, 24, "fundamental" ); Mode second_harmonic( BOSONIC, 16, "second_harmonic" ); // define the Hilbert space we live in: // HilbertSpace hs( fundamental * second_harmonic ); // the hamiltonian: nonlinear interaction and pump: // Expression hamiltonian( ( i * kappa * Creator( fundamental ) * Creator( fundamental ) * Annihilator( second_harmonic ) + hc ) + ( i * CFunc( pump ) * Creator( second_harmonic ) + hc ) , "hamiltonian" ); System the_system( hs , hamiltonian , "cavity" ); // define environmental coupling: // - photon counting for the second harmonic mode // - homodyning for the fundamental mode // the_system.add_environment_operator( sqrt(gamma_fundamental / 2.0) * ( Annihilator( fundamental ) + eta ) ); the_system.add_environment_operator( sqrt(gamma_fundamental / 2.0) * ( Annihilator( fundamental ) - eta ) ); the_system.add_environment_operator( sqrt(gamma_second_harmonic) * Annihilator( second_harmonic ) ); // preparation: empty product: leave system initially in ground state: // Expression preparator = Expression( PRODUCT ); // left offset: empty product: compute single-time expectation values only: // Expression leftOffset = Expression( PRODUCT ); Experiment experiment( the_system, preparator, leftOffset ); // define a phase space function to be measured: // PhaseSpaceFunction wigner_fundamental( "W_f" // name tag , fundamental // the mode , 0.0 // index s of phase space function (0: wigner) , 9.0 // radius in x-space , 64 // number of points in x-space ); // the following will call the `camera' script once per time unit to take a frame of the // wigner function of the fundamental mode: // experiment << IndividualMeasurement( wigner_fundamental // measure fundamental mode wigner function , 1.0 // do it after every 1.0 timesteps , NULL // no special name tag, use the one from the wigner function , NO // don't output to stdout (which would be the default) , NULL // don't output to an open stream , "./camera" // spawn a child and execute `camera' for every measurement ); // define the simulation: specify experiment and numerical algorithm: // SymmetricSimulation simulation( experiment, SYMMETRIC ); // press on "START": // TRY{ simulation.simulate( 1 // number of trajectories , movie_length // length of a trajectory ); }CATCHALL; // catch and report all exceptions }