-------------------------------------------------------------------------------
--                                                                           --
--                          Experiment Source Code                           --
--              Delta NMR Experiment & Machine Control Interface             --
--                                                                           --
--                     Copyright (c) 2009 JEOL Ltd                           --
--                            All Rights Reserved                            --
--                                                                           --
-------------------------------------------------------------------------------
----By Rongchun Zhang, 2021/03/23
----Ref: Rongchun Zhang et al. J. Phys. Chem. C, 2022, 126, 13311
---Record a CP and a NOE spectrum separately in a single experiment
----Mobile signals come from pure 1H-13C NOE effect
-- HELP.eng: Cross Polarization
-- Category: solids, 1D standard, cpmas

header
    filename  		=> "cp-noe-2s";
    sample_id 		=> "";
    comment   		=> "Cross Polarization with transient NOE";
    process   		=  "1d_solid.list";
    include "header_solid";
end header;

instrument
    include "instrument_solid";
end instrument;

acquisition
	x_domain			=>	"Carbon13";
	x_offset			=>	100[ppm];
	x_sweep				=>	300[ppm];
	x_points_input      =>    512;
    x_points            =?    if x_points_input/x_sweep < 50 [ms] then x_points_input else 2;
	scans				=>	4;
	x_prescans			=>	0;
	mod_return			=>	1;
	include "acquisition_solid";
end acquisition;

pulse
	collect COMPLEX,OBS;
	include "pulse_solid";
	include "dec_solid";
	include "cp_solid";

    irr_noise			=>	"CW",("CW", "SPINAL64", "TPPM", "XiX"),	help "decoupling sequence";

	initial_wait		=	10.0[ms];

	irr_Setup			=? "#Setup Irradiation#";
	irr_domain			=>	"Proton",									help "decoupled nucleus";
	irr_offset			=>	5[ppm],										help "decoupler offset";
    tauNOE   => 0.5[s], help "transient NOE mixing time";
 
    obs_width_90   =>  3[us], help "90deg pulse width for X excitation pulse";
	obs_amp_pulse  => 100[%], 0[%]->100[%]:0.01[%], help "amplitude of X excitation pulse";
	irr_amp_cwdec  => 80[%], 0[%]->90[%]:0.01[%], help "amplitude of CW decoupling pulse";


    recycle_Setup		=? "#Setup Recycle Times#";
	relaxation_delay	=>	5.0[s],										help "relaxation delay";
	repetition_time		=?	relaxation_delay + x_acq_time,				help"relaxation_delay+x_acq_time";

    atn_Setup           =? "#Experiment Attenuator Settings#";
	obs_atn				=>	xatn,										help "attenuator for obs";
	irr_atn				=>	irratn,										help "attenuator for irr";

	irr_phs_prep	=	{ 90, 270};
	irr_phs_cp		=	{ 0,0};
	irr_phs_cwdec	=	{ 0,0 };
	irr_phs_dec	=	{ 0 };
	obs_phs_cp		=	if prep_pulse = "TRUE" then
						{ 0,0,180,180,90,90,270,270}
                         else
						{ 90, 270,  180, 0, 270, 90, 0, 180};
	irr_phs_flip =  {90, 270};
	obs_phs_read  = {0,180,90,270};
	obs_phs_acq1  = {0,180,180,0,90,270,270, 90}; ---phase for CP
	obs_phs_acq2  = {0, 180, 90, 270}; -----phase for NOE

obs_phs_flip1 =  {270};
obs_phs_flip2 =  {90};
irr_phs_flip3 =  {270, 90};

	module_config		= "solid_sample continuous_fid";

begin
    initial_wait;
	relaxation_delay;

when prep_pulse = "TRUE" do	
    irr_width_90, (irr.gate, irr.phs.irr_phs_prep, irr.amp.irr_amp_prep, irr.atn.irr_atn);
end when;

	contact_time, (irr.gate, irr.phs.irr_phs_cp, irr.shape.{irr_shape_cp,"irr"}, irr.atn.irr_atn,
				   obs.gate, obs.phs.obs_phs_cp, obs.shape.{obs_shape_cp,"obs"}, obs.atn.obs_atn);

   on (irr.gate, irr.phs.irr_phs_cwdec, irr.amp.irr_amp_cwdec, irr.atn.irr_atn);
   acq( dead_time, delay, obs_phs_acq1 );
   off (irr.gate);
   
  irr_width_90, (irr.gate, irr.phs.irr_phs_flip, irr.amp.irr_amp_prep, irr.atn.irr_atn);
  tauNOE;
  obs_width_90, (obs.gate, obs.phs.obs_phs_read, obs.amp.obs_amp_pulse, obs.atn.obs_atn);

    on (irr.gate, irr.phs.irr_phs_dec, irr.amp.irr_amp_dec, irr.atn.irr_atn, irr.noise.irr_noise);
	acq( dead_time, delay, obs_phs_acq2 );
	off (irr.gate);

end pulse;