-------------------------------------------------------------------------------
--                                                                           --
--                          Experiment Source Code                           --
--              Delta NMR Experiment & Machine Control Interface             --
--                                                                           --
--                     Copyright (c) 2009 JEOL Ltd                           --
--                            All Rights Reserved                            --
--                                                                           --
-------------------------------------------------------------------------------
-- HELP.eng: Cross Polarization
-- Category: solids, 1D standard, cpmas
-- By Rongchun Zhang, 2022/02/21
--Ref: Hybridizing cross-polarization with NOE or refocused-INEPT enhances the sensitivity of MAS NMR spectroscopy
--- Zhang RC et al. J. Magn. Reson. 2016, 266, 59-66
---- Nishiyama et al. J. Magn. Reson. 2010, 202, 135-139
header
    filename  		=> "T1rho-cpmas-rinept";
    sample_id 		=> "";
    comment   		=> "Cross Polarization with RINEPT";
    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			=>	400[ppm];
----	x_points			=>	2048;
     x_points_input       =>    1024;
     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";
	initial_wait		=	10.0[ms];

	irr_Setup			=? "#Setup Irradiation#";
	irr_domain			=>	"Proton",									help "decoupled nucleus";
	irr_offset			=>	5[ppm],										help "decoupler offset";

     	irr_width_lock		=>	0.1[ms], 0[ns]->300[ms]:20[ns],			help "spin lock width";
     	irr_amp_lock		=>	50[%], 0[%]->100[%]:0.01[%],				help "spin lock ampliper";


	include "cp_solid";

	include "dec_solid";
     irr_amp_cwdec  => 80[%],0[%]->100[%]:0.05[%];


Pulse_Setup	=? "-----------Setup hard pulses-----------";

        obs_width_90	=> x90;
        obs_width_180	=> x90*2;
        obs_amp_pulse	=> 100[%];

--	irr_width_90	=> irr90;
	irr_width_180	=> irr_width_90*2;
	irr_amp_pulse	=> 100[%];

RINEPT_setup		=? "#Setup RINEPT Times#";
    tau1 => 1[ms];
    tau2 => 1[ms];
    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_lock    ={8(90),8(270)};

	irr_phs_prep	=	{ 8(0), 8(180)};
	irr_phs_cp		=	{ 8(90)};
	irr_phs_dec	=	{ 270};
	obs_phs_cp		=	{ 16(270),16(0),16(90),16(180)};
	obs_phs_acq1	=	{ 8(0), 8(180), 8(90), 8(270),8(180), 8(0), 8(270), 8(90)};

     irr_phs_cwdec       = {8(90),8(270)};
     irr_phs_180_1     ={0,180,0,180};
     irr_phs_180_2     ={0,180,0,180};
     irr_phs_90        ={90,90,270,270};
     obs_phs_180_1     ={0,180,0,180};
     obs_phs_180_2     ={0,180,0,180,90,270,90,270};
     obs_phs_90        ={4(0),4(90),4(180),4(270)};
   
     obs_phs_acq2 =  {0,0,180,180,90,90,270,270};

	module_config		= "solid_sample continuous_fid";

begin
    initial_wait;
	relaxation_delay;


	irr_width_90,	(irr.gate,	irr.phs.irr_phs_prep,	irr.amp.irr_amp_prep,	irr.atn.irr_atn);
     irr_width_lock,	(irr.gate,	irr.phs.irr_phs_lock,	irr.amp.irr_amp_lock,	irr.atn.irr_atn);
	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);
tau1;

parallel
justify center
	obs_width_180,	(obs.gate,	obs.phs.obs_phs_180_1,	obs.amp.obs_amp_pulse,	obs.atn.obs_atn);
justify center
	irr_width_180,	(irr.gate,	irr.phs.irr_phs_180_1,	irr.amp.irr_amp_pulse,	irr.atn.irr_atn);
end parallel;

tau1;

parallel
justify center
	obs_width_90,	(obs.gate,	obs.phs.obs_phs_90,	obs.amp.obs_amp_pulse,	obs.atn.obs_atn);
justify center
	irr_width_90,	(irr.gate,	irr.phs.irr_phs_90,	irr.amp.irr_amp_pulse,	irr.atn.irr_atn);
end parallel;

tau2;

parallel
justify center
	obs_width_180,	(obs.gate,	obs.phs.obs_phs_180_2,	obs.amp.obs_amp_pulse,	obs.atn.obs_atn);
justify center
	irr_width_180,	(irr.gate,	irr.phs.irr_phs_180_2,	irr.amp.irr_amp_pulse,	irr.atn.irr_atn);
end parallel;

	tau2;

	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, irr.PHS.irr_phs_dec, irr.AMP.irr_amp_dec, irr.ATN.irr_atn, irr.NOISE.irr_noise);


end pulse;