add folder frescoTools
This commit is contained in:
parent
195a916ee6
commit
5d8a8fac12
12
frecsoTools/.gitignore
vendored
Normal file
12
frecsoTools/.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
.DS_Store
|
||||
Doc
|
||||
|
||||
fort.*
|
||||
|
||||
*.in
|
||||
*.out
|
||||
|
||||
test
|
||||
|
||||
!mass20.txt
|
||||
!nubase_4.mas20.txt
|
591
frecsoTools/ClassIsotope.h
Normal file
591
frecsoTools/ClassIsotope.h
Normal file
|
@ -0,0 +1,591 @@
|
|||
/***********************************************************************
|
||||
*
|
||||
* This is ClassIsotope.h, To extract the isotope mass from nubase_4.mas20.txt
|
||||
*
|
||||
*-------------------------------------------------------
|
||||
* created by Ryan (Tsz Leung) Tang, Sept-6, 2024
|
||||
* email: goluckyryan@gmail.com
|
||||
* ********************************************************************/
|
||||
|
||||
|
||||
#ifndef ISOTOPE_H
|
||||
#define ISOTOPE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "constant.h" // amu
|
||||
#include <stdlib.h> //atoi
|
||||
#include <algorithm>
|
||||
|
||||
std::string massData="nubase_4.mas20.txt";
|
||||
|
||||
class Isotope {
|
||||
public:
|
||||
int A, Z;
|
||||
double Mass, MassError, BEA; // BEA in keV
|
||||
short twoSpin; // 2*J
|
||||
short parity;
|
||||
std::string Name, Symbol; // Name = 6Li, Symbol = Li
|
||||
std::string dataSource;
|
||||
|
||||
Isotope(){dataSource = massData;};
|
||||
Isotope(int a, int z){ dataSource = massData; SetIso(a,z); };
|
||||
Isotope(std::string name){ dataSource = massData; SetIsoByName(name); };
|
||||
|
||||
void SetMassTablePath(std::string path){ dataSource = path;}
|
||||
|
||||
void SetIso(int a, int z);
|
||||
void SetIsoByName(std::string name);
|
||||
|
||||
double CalSp(int Np, int Nn); // this for the Np-proton, Nn-neutron removal
|
||||
double CalSp2(int a, int z); // this is for (a,z) nucleus removal
|
||||
|
||||
double CalBeta(double T){
|
||||
double Etot = Mass + T;
|
||||
double gamma = 1 + T/Mass;
|
||||
double beta = sqrt(1 - 1 / gamma / gamma ) ;
|
||||
return beta;
|
||||
}
|
||||
|
||||
void Print();
|
||||
void ListShell();
|
||||
|
||||
private:
|
||||
|
||||
void InvalidIso();
|
||||
void BreakName(std::string nameStr);
|
||||
void BreakJpi(std::string jPiStr);
|
||||
void DigestLine(std::string line, int A, int Z);
|
||||
|
||||
void FindMassByAZ(int a, int z); // give mass, massError, BEA, Name, Symbol;
|
||||
void FindMassByName(std::string name); // give Z, mass, massError, BEA;
|
||||
|
||||
int TwoJ(int nShell);
|
||||
std::string Orbital(int nShell);
|
||||
int magic(int i){
|
||||
switch (i){
|
||||
case 0: return 2; break;
|
||||
case 1: return 8; break;
|
||||
case 2: return 20; break;
|
||||
case 3: return 28; break;
|
||||
case 4: return 40; break;
|
||||
case 5: return 50; break;
|
||||
case 6: return 82; break;
|
||||
case 7: return 128; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int magicShellID(int i){
|
||||
switch (i){
|
||||
case 0: return 0; break;
|
||||
case 1: return 2; break;
|
||||
case 2: return 5; break;
|
||||
case 3: return 6; break;
|
||||
case 4: return 9; break;
|
||||
case 5: return 10; break;
|
||||
case 6: return 15; break;
|
||||
case 7: return 21; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fileStartLine;
|
||||
int fileEndLine;
|
||||
int lineMass050_099;
|
||||
int lineMass100_149;
|
||||
int lineMass150_199;
|
||||
int lineMass200_249;
|
||||
int lineMass250;
|
||||
|
||||
int colA[2];
|
||||
int colZ[2];
|
||||
int colName[2];
|
||||
int colMassExcess[2];
|
||||
int colMassError[2];
|
||||
int colSpin[2];
|
||||
|
||||
void setFileLinesAndCol(){
|
||||
fileStartLine = 26;
|
||||
fileEndLine = 5869;
|
||||
|
||||
lineMass050_099 = 638;
|
||||
lineMass100_149 = 1718;
|
||||
lineMass150_199 = 3123;
|
||||
lineMass200_249 = 4591;
|
||||
lineMass250 = 5495;
|
||||
|
||||
colA[0] = 0;
|
||||
colA[1] = 3;
|
||||
|
||||
colZ[0] = 4;
|
||||
colZ[1] = 8;
|
||||
|
||||
colName[0] = 11;
|
||||
colName[1] = 16;
|
||||
|
||||
colMassExcess[0] = 18;
|
||||
colMassExcess[1] = 31;
|
||||
|
||||
colMassError[0] = 31;
|
||||
colMassError[1] = 42;
|
||||
|
||||
colSpin[0] = 88;
|
||||
colSpin[1] = 97;
|
||||
}
|
||||
|
||||
bool isFindOnce;
|
||||
|
||||
};
|
||||
|
||||
void Isotope::SetIso(int a, int z){
|
||||
FindMassByAZ(a,z);
|
||||
}
|
||||
|
||||
void Isotope::SetIsoByName(std::string name){
|
||||
FindMassByName(name);
|
||||
}
|
||||
|
||||
void Isotope::InvalidIso(){
|
||||
this->BEA = std::nan("");
|
||||
this->Mass = std::nan("");
|
||||
this->MassError = std::nan("");
|
||||
this->Symbol = "non";
|
||||
this->Name = "non";
|
||||
this->twoSpin = 0;
|
||||
this->parity = 0;
|
||||
}
|
||||
|
||||
void Isotope::BreakName(std::string nameStr){
|
||||
std::string::size_type lastDigit = nameStr.find_last_of("0123456789");
|
||||
|
||||
this->Symbol = nameStr.substr(lastDigit + 1);
|
||||
if (this->Symbol.length() == 1) {
|
||||
this->Symbol += " ";
|
||||
}
|
||||
|
||||
this->A = std::stoi(nameStr.substr(0, lastDigit + 1));
|
||||
|
||||
}
|
||||
|
||||
void Isotope::BreakJpi(std::string jPiStr){
|
||||
|
||||
jPiStr.erase(std::remove(jPiStr.begin(), jPiStr.end(), '('), jPiStr.end());
|
||||
jPiStr.erase(std::remove(jPiStr.begin(), jPiStr.end(), ')'), jPiStr.end());
|
||||
|
||||
std::string::size_type lastDigit = jPiStr.find_last_of("0123456789");
|
||||
|
||||
std::string spinStr = jPiStr.substr(0, lastDigit + 1);
|
||||
|
||||
std::string::size_type lastSlash = spinStr.find_last_of('/');
|
||||
|
||||
if (lastSlash != std::string::npos) {
|
||||
twoSpin = std::stoi(spinStr.substr(0, lastSlash + 1));
|
||||
} else {
|
||||
twoSpin = 2 * std::stoi(spinStr);
|
||||
}
|
||||
|
||||
this->parity = (jPiStr.substr(lastDigit + 1) == "+") ? 1 : -1;
|
||||
|
||||
}
|
||||
|
||||
void Isotope::DigestLine(std::string line, int A, int Z){
|
||||
|
||||
double massExcess = atof((line.substr(colMassExcess[0],colMassExcess[1]-colMassExcess[0])).c_str());
|
||||
|
||||
Mass = massExcess/1000. + A * amu - Z * me;
|
||||
MassError = atof((line.substr(colMassError[0],colMassError[1]-colMassError[0])).c_str()) / 1000.;
|
||||
|
||||
BEA = (Z * mp + (A-Z) * mn - Mass)/A *1000;
|
||||
|
||||
std::string str = line.substr(colName[0],colName[1]-colName[0]);
|
||||
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||
Name = str;
|
||||
|
||||
BreakName(Name);
|
||||
|
||||
if( this->Name == "1H" ) this->Name = "p";
|
||||
if( this->Name == "2H" ) this->Name = "d";
|
||||
if( this->Name == "3H" ) this->Name = "t";
|
||||
if( this->Name == "4He" ) this->Name = "a";
|
||||
|
||||
str = line.substr(colSpin[0], colSpin[1]-colSpin[0]);
|
||||
str.erase(remove(str.begin(), str.end(), ' '), str.end());
|
||||
str.erase(std::remove(str.begin(), str.end(), '*'), str.end());
|
||||
str.erase(std::remove(str.begin(), str.end(), '#'), str.end());
|
||||
std::string Jpi = str;
|
||||
|
||||
BreakJpi(Jpi);
|
||||
|
||||
// printf("A %d Z: %d | %s | %f | %f |%s|\n", A, Z, Name.c_str(), massExcess, Mass, Jpi.c_str());
|
||||
}
|
||||
|
||||
|
||||
void Isotope::FindMassByAZ(int A, int Z){
|
||||
std::string line;
|
||||
int lineNum=0;
|
||||
|
||||
std::ifstream myfile;
|
||||
int flag=0;
|
||||
|
||||
setFileLinesAndCol();
|
||||
|
||||
int numLineStart = fileStartLine;
|
||||
int numLineEnd = fileEndLine;
|
||||
|
||||
this->A = A;
|
||||
this->Z = Z;
|
||||
|
||||
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||
if ( A >=200 && A < 250) numLineStart = lineMass200_249;
|
||||
if ( A >=250 ) numLineStart = lineMass250;
|
||||
|
||||
myfile.open(dataSource.c_str());
|
||||
|
||||
if (myfile.is_open()) {
|
||||
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||
lineNum ++ ;
|
||||
// printf("%3d ",lineNum);
|
||||
getline (myfile,line);
|
||||
|
||||
if (lineNum >= numLineStart ){
|
||||
int list_Z = std::stoi((line.substr(colZ[0],colZ[1]-colZ[0])));
|
||||
int list_A = std::stoi((line.substr(colA[0],colA[1]-colA[0])));
|
||||
|
||||
if ( A == list_A && Z * 10 == list_Z) {
|
||||
|
||||
DigestLine(line, A, Z);
|
||||
|
||||
flag = 1;
|
||||
}else if ( list_A > A) {
|
||||
InvalidIso();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
myfile.close();
|
||||
}else {
|
||||
printf("Unable to open %s\n", dataSource.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Isotope::FindMassByName(std::string name){
|
||||
|
||||
// done seperate the Mass number and the name
|
||||
if( name == "n" ) {
|
||||
this->Name = "1n";
|
||||
this->BEA = 0;
|
||||
this->Mass = mn;
|
||||
this->MassError = 0;
|
||||
this->Name = "n";
|
||||
this->A = 1;
|
||||
this->Z = 0;
|
||||
this->twoSpin = 1;
|
||||
this->parity = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if( name == "p" ) name = "1H";
|
||||
if( name == "d" ) name = "2H";
|
||||
if( name == "t" ) name = "3H";
|
||||
if( name == "a" ) name = "4He";
|
||||
|
||||
this->Name = name;
|
||||
BreakName(name);
|
||||
|
||||
// find the nucleus in the data
|
||||
std::string line;
|
||||
int lineNum=0;
|
||||
|
||||
std::ifstream myfile;
|
||||
int flag=0;
|
||||
|
||||
setFileLinesAndCol();
|
||||
|
||||
int numLineStart = fileStartLine;
|
||||
int numLineEnd = fileEndLine;
|
||||
|
||||
if ( A >= 50 && A < 100) numLineStart = lineMass050_099;
|
||||
if ( A >=100 && A < 150) numLineStart = lineMass100_149;
|
||||
if ( A >=150 && A < 200) numLineStart = lineMass150_199;
|
||||
if ( A >=200 && A < 250) numLineStart = lineMass200_249;
|
||||
if ( A >=250 ) numLineStart = lineMass250;
|
||||
|
||||
myfile.open(dataSource.c_str());
|
||||
|
||||
if (myfile.is_open()) {
|
||||
while (/*! myfile.eof() &&*/ flag == 0 && lineNum <numLineEnd){
|
||||
lineNum ++ ;
|
||||
//printf("%3d ",lineNum);
|
||||
getline (myfile,line);
|
||||
|
||||
if (lineNum >= numLineStart ){
|
||||
|
||||
std::string nameStr = line.substr(colName[0],colName[1]-colName[0]);
|
||||
nameStr.erase(remove(nameStr.begin(), nameStr.end(), ' '), nameStr.end());
|
||||
|
||||
int list_A = std::stoi((line.substr(colA[0],colA[1]-colA[0])));
|
||||
int list_Z = std::stoi((line.substr(colZ[0],colZ[1]-colZ[0])));
|
||||
|
||||
// printf("A %d Z %d | %s \n", list_A, list_Z, nameStr.c_str());
|
||||
|
||||
if ( list_A == A && list_Z % 10 == 0 && Name == nameStr) {
|
||||
|
||||
Z = list_Z/10;
|
||||
|
||||
DigestLine(line, list_A, Z);
|
||||
|
||||
flag = 1;
|
||||
}else if ( list_A > this->A) {
|
||||
InvalidIso();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
myfile.close();
|
||||
}else {
|
||||
printf("Unable to open %s\n", dataSource.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
double Isotope::CalSp(int Np, int Nn){
|
||||
Isotope nucleusD(A - Np - Nn, Z - Np);
|
||||
|
||||
if( !std::isnan(nucleusD.Mass) ){
|
||||
return nucleusD.Mass + Nn*mn + Np*mp - this->Mass;
|
||||
}else{
|
||||
return std::nan("");
|
||||
}
|
||||
}
|
||||
|
||||
double Isotope::CalSp2(int a, int z){
|
||||
Isotope nucleusD(A - a , Z - z);
|
||||
Isotope nucleusS(a,z);
|
||||
|
||||
if( !std::isnan(nucleusD.Mass) && !std::isnan(nucleusS.Mass) ){
|
||||
return nucleusD.Mass + nucleusS.Mass - this->Mass;
|
||||
}else{
|
||||
return std::nan("");
|
||||
}
|
||||
}
|
||||
|
||||
int Isotope::TwoJ(int nShell){
|
||||
|
||||
switch(nShell){
|
||||
case 0: return 1; break; // 0s1/2
|
||||
case 1: return 3; break; // 0p3/2
|
||||
case 2: return 1; break; // 0p1/2 -- 8
|
||||
case 3: return 5; break; // 0d5/2
|
||||
case 4: return 1; break; // 1s1/2
|
||||
case 5: return 3; break; // 0d3/2 -- 20
|
||||
case 6: return 7; break; // 0f7/2 -- 28
|
||||
case 7: return 3; break; // 1p3/2
|
||||
case 8: return 1; break; // 1p1/2
|
||||
case 9: return 5; break; // 0f5/2 -- 40
|
||||
case 10: return 9; break; // 0g9/2 -- 50
|
||||
case 11: return 7; break; // 0g7/2
|
||||
case 12: return 5; break; // 1d5/2
|
||||
case 13: return 11; break; // 0h11/2
|
||||
case 14: return 3; break; // 1d3/2
|
||||
case 15: return 1; break; // 2s1/2 -- 82
|
||||
case 16: return 9; break; // 0h9/2
|
||||
case 17: return 7; break; // 1f7/2
|
||||
case 18: return 13; break; // 0i13/2
|
||||
case 19: return 3; break; // 2p3/2
|
||||
case 20: return 5; break; // 1f5/2
|
||||
case 21: return 1; break; // 1p1/2 -- 126
|
||||
case 22: return 9; break; // 1g9/2
|
||||
case 23: return 11; break; // 0i11/2
|
||||
case 24: return 15; break; // 0j15/2
|
||||
case 25: return 5; break; // 2d5/2
|
||||
case 26: return 1; break; // 3s1/2
|
||||
case 27: return 3; break; // 2d3/2
|
||||
case 28: return 7; break; // 1g7/2
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string Isotope::Orbital(int nShell){
|
||||
|
||||
switch(nShell){
|
||||
case 0: return "0s1 "; break; //
|
||||
case 1: return "0p3 "; break; //
|
||||
case 2: return "0p1 "; break; //-- 8
|
||||
case 3: return "0d5 "; break; //
|
||||
case 4: return "1s1 "; break; //
|
||||
case 5: return "0d3 "; break; //-- 20
|
||||
case 6: return "0f7 "; break; //-- 28
|
||||
case 7: return "1p3 "; break; //
|
||||
case 8: return "1p1 "; break; //
|
||||
case 9: return "0f5 "; break; //-- 40
|
||||
case 10: return "0g9 "; break; //-- 50
|
||||
case 11: return "0g7 "; break; //
|
||||
case 12: return "1d5 "; break; //
|
||||
case 13: return "0h11"; break; //
|
||||
case 14: return "1d3 "; break; //
|
||||
case 15: return "2s1 "; break; //-- 82
|
||||
case 16: return "0h9 "; break; //
|
||||
case 17: return "1f7 "; break; //
|
||||
case 18: return "0i13"; break; //
|
||||
case 19: return "2p3 "; break; //
|
||||
case 20: return "1f5 "; break; //
|
||||
case 21: return "1p1 "; break; //-- 126
|
||||
case 22: return "1g9 "; break; //
|
||||
case 23: return "0i11"; break; //
|
||||
case 24: return "0j15"; break; //
|
||||
case 25: return "2d5 "; break; //
|
||||
case 26: return "3s1 "; break; //
|
||||
case 27: return "2d3 "; break; //
|
||||
case 28: return "1g7 "; break; //
|
||||
}
|
||||
|
||||
return "nan";
|
||||
}
|
||||
|
||||
void Isotope::ListShell(){
|
||||
|
||||
if( Mass < 0 ) return;
|
||||
|
||||
int n = A-Z;
|
||||
int p = Z;
|
||||
|
||||
int k = std::min(n,p);
|
||||
int nMagic = 0;
|
||||
for( int i = 0; i < 7; i++){
|
||||
if( magic(i) < k && k <= magic(i+1) ){
|
||||
nMagic = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int coreShell = magicShellID(nMagic-1);
|
||||
int coreZ1 = magic(nMagic-1);
|
||||
int coreZ2 = magic(nMagic);
|
||||
|
||||
Isotope core1( 2*coreZ1, coreZ1);
|
||||
Isotope core2( 2*coreZ2, coreZ2);
|
||||
|
||||
printf("------------------ Core:%3s, inner Core:%3s \n", (core2.Name).c_str(), (core1.Name).c_str());
|
||||
printf(" || ");
|
||||
int t = std::max(n,p);
|
||||
int nShell = 0;
|
||||
do{
|
||||
int occ = TwoJ(nShell)+1;
|
||||
if( nShell > coreShell) {
|
||||
printf("%4s", Orbital(nShell).c_str());
|
||||
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||
printf("|");
|
||||
}else{
|
||||
printf(",");
|
||||
}
|
||||
}
|
||||
t = t - occ;
|
||||
nShell++;
|
||||
}while( t > 0 && nShell < 29);
|
||||
for( int i = 1; i <= 6; i++){
|
||||
if (nShell < 28) {
|
||||
printf("%4s,", Orbital(nShell).c_str());
|
||||
}else if( nShell == 28 ) {
|
||||
printf("%4s", Orbital(nShell).c_str());
|
||||
}
|
||||
nShell ++;
|
||||
}
|
||||
if (nShell < 29) printf("%4s", Orbital(nShell).c_str());
|
||||
printf("\n");
|
||||
|
||||
|
||||
printf(" Z = %3d || ", p);
|
||||
nShell = 0;
|
||||
do{
|
||||
int occ = TwoJ(nShell)+1;
|
||||
if( nShell > coreShell ){
|
||||
if( p > occ ) {
|
||||
printf("%-4d", occ);
|
||||
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||
printf("|");
|
||||
}else{
|
||||
printf(",");
|
||||
}
|
||||
}else{
|
||||
printf("%-4d", p);
|
||||
}
|
||||
}
|
||||
p = p - occ;
|
||||
nShell++;
|
||||
}while( p > 0 && nShell < 29);
|
||||
printf("\n");
|
||||
|
||||
printf(" N = %3d || ", n);
|
||||
nShell = 0;
|
||||
do{
|
||||
int occ = TwoJ(nShell)+1;
|
||||
if ( nShell > coreShell ){
|
||||
if( n > occ ) {
|
||||
printf("%-4d", occ);
|
||||
if( nShell == 0 || nShell == 2 || nShell == 5 || nShell ==6 || nShell == 9 || nShell == 10 || nShell == 15 || nShell == 21){
|
||||
printf("|");
|
||||
}else{
|
||||
printf(",");
|
||||
}
|
||||
}else{
|
||||
printf("%-4d", n);
|
||||
}
|
||||
}
|
||||
n = n - occ;
|
||||
nShell++;
|
||||
}while( n > 0 && nShell < 29);
|
||||
printf("\n");
|
||||
|
||||
printf("------------------ \n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Isotope::Print(){
|
||||
|
||||
if (Mass > 0){
|
||||
|
||||
printf(" using mass data : %s \n", dataSource.c_str());
|
||||
|
||||
std::string jPiStr = "";
|
||||
if( twoSpin % 2 == 0) {
|
||||
jPiStr = std::to_string(twoSpin/2).c_str();
|
||||
}else{
|
||||
jPiStr = std::to_string(twoSpin) + "/2";
|
||||
}
|
||||
|
||||
printf(" mass of \e[47m\e[31m%s\e[m nucleus (Z,A)=(%3d,%3d) is \e[47m\e[31m%12.5f\e[m MeV, J-pi \e[31m%s%s\e[m\n",
|
||||
Name.c_str(),
|
||||
Z,
|
||||
A,
|
||||
Mass,
|
||||
jPiStr.c_str(),
|
||||
parity == 1 ? "+" : "-");
|
||||
|
||||
printf(" total BE : %12.5f MeV\n",BEA*A/1000.);
|
||||
printf(" total BE/A : %12.5f MeV\n",BEA/1000.);
|
||||
printf(" mass in amu : %12.5f u\n",Mass/amu);
|
||||
printf(" mass excess : %12.5f MeV +- %12.5f\n", Mass + Z*0.510998950 - A*amu, MassError);
|
||||
printf("-------------- Seperation energy \n");
|
||||
printf(" S1p: %8.4f| S1n: %8.4f| S(2H ): %8.4f| S1p1n : %8.4f\n", CalSp(1, 0), CalSp(0, 1), CalSp2(2, 1), CalSp(1, 1));
|
||||
printf(" S2p: %8.4f| S2n: %8.4f| S(3He): %8.4f| S(3H) : %8.4f\n", CalSp(2, 0), CalSp(0, 2), CalSp2(3, 2), CalSp2(3, 1));
|
||||
printf(" S3p: %8.4f| S3n: %8.4f| S(4He): %8.4f|\n", CalSp(3, 0), CalSp(0, 3), CalSp2(4, 2));
|
||||
printf(" S4p: %8.4f| S4n: %8.4f| \n", CalSp(4, 0), CalSp(0, 4));
|
||||
|
||||
}else{
|
||||
printf("Error %6.0f, no nucleus with (Z,A) = (%3d,%3d). \n", Mass, Z, A);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
5
frecsoTools/FRESCO
Normal file
5
frecsoTools/FRESCO
Normal file
|
@ -0,0 +1,5 @@
|
|||
#reaction gs-spin orbital spin-pi(Ex) Ex ELab Potentials extra
|
||||
#16O(d,d)16O 0 none none 0.000 8MeV/u AA #elastic
|
||||
#16O(d,d)16O 0 none 2+ 6.000 8MeV/u AA 1.3 #inelastic, delta_2
|
||||
|
||||
60Ni(p,p)60Ni 0 none none 0.000 30MeV/u KK #elastic
|
31
frecsoTools/README.md
Normal file
31
frecsoTools/README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# To run Fresco,
|
||||
|
||||
./fresco < infile > outfile
|
||||
|
||||
I have fresco in other folder, I set the PATH to include the execute of fresco
|
||||
|
||||
# haha.in
|
||||
|
||||
## Elastic scattering
|
||||
|
||||
60Ni(p,p)60Ni@30.00 MeV/u Elastic
|
||||
NAMELIST
|
||||
&FRESCO hcm=0.1 rmatch=60
|
||||
jtmin=0.0 jtmax=50 absend=0.001
|
||||
thmin=0.0 thmax=180.0 thinc=1.0
|
||||
chans=1 smats=2 xstabl=1
|
||||
elab=30.0 /
|
||||
&PARTITION namep='p' massp=1.00 zp=1 namet='60Ni' masst=60 zt=28 qval=0.000 nex=1 /
|
||||
&STATES jp=0.5 ptyp=1 ep=0.000 jt=0.0 ptyt=1 et=0.000 cpot=1/
|
||||
&partition /
|
||||
&POT kp=1 ap=0 at=60 rc=1.258 /
|
||||
&POT kp=1 type=1 p1=47.937 p2=1.20 p3=0.669 p4=2.853 p5=1.20 p6=0.669 /
|
||||
&POT kp=1 type=2 p1=0.0 p2=1.20 p3=0.669 p4=6.878 p5=1.28 p6=0.550 /
|
||||
&POT kp=1 type=3 p1=5.250 p2=1.02 p3=0.590 p4=-0.162 p5=1.02 p6=0.590 /
|
||||
&pot /
|
||||
&overlap /
|
||||
&coupling /
|
||||
|
||||
In the first line of &POT, ap and at are used to calculate the radius. use ap = 0 to match Ptolemy r0target for zero-range approximation, all potential inputs are same as Ptolemy
|
||||
|
||||
in &POT, type=1 WS, type=2 surface, type=3 SO.
|
74
frecsoTools/constant.h
Normal file
74
frecsoTools/constant.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/***********************************************************************
|
||||
*
|
||||
* This is constant.h, to provide various physical constants.
|
||||
*
|
||||
*-------------------------------------------------------
|
||||
* created by Ryan (Tsz Leung) Tang, Nov-18, 2018
|
||||
* email: goluckyryan@gmail.com
|
||||
* ********************************************************************/
|
||||
|
||||
|
||||
#ifndef constant
|
||||
#define constant
|
||||
#include <cmath>
|
||||
|
||||
const double pi = acos(-1.0);
|
||||
const double E = 2.718281828459 ;
|
||||
const double hbar_SI = 1.054571628e-34; //Js
|
||||
const double kB = 1.3806504e-23; //JK^-1
|
||||
const double e = 1.602176487e-19; //C
|
||||
const double c_SI = 299792458; //ms^-1
|
||||
const double me_SI = 9.10938215e-31 ; //kg
|
||||
const double mp_SI = 1.672621637e-27 ; //kg
|
||||
const double mn_SI = 1.67492729e-27 ; //kg
|
||||
const double NA = 6.022141e+23 ; //mol^-1
|
||||
|
||||
const double deg2rad = pi/180 ;
|
||||
const double rad2deg = 180/pi ;
|
||||
|
||||
|
||||
//======================================================================
|
||||
const double amu = 931.49410372; // MeV/c^2
|
||||
const double hbarc = 197.326979; // MeV fm;
|
||||
const double c = 299.792458; // mm/ns;
|
||||
const double ee = 1.439964454; // MeV.fm
|
||||
|
||||
//======================================================================
|
||||
double kg2MeV(double m){
|
||||
return m*c_SI*c_SI/e/1e6;
|
||||
}
|
||||
|
||||
double T2Brho(double mass, int Z, int A, double T){
|
||||
//mass in MeV
|
||||
// Z in e
|
||||
// T in MeV/A
|
||||
double gamma = (T*A + mass)/mass;
|
||||
double beta = sqrt(1-1/gamma/gamma);
|
||||
return mass*beta*gamma/Z/c;
|
||||
}
|
||||
|
||||
double Brho2T(double mass, int Z, int A, double Brho){
|
||||
//mass in MeV
|
||||
// Z in e
|
||||
return (sqrt(pow(Brho*Z*c,2)+mass*mass)-mass)/A;
|
||||
}
|
||||
|
||||
double T2beta(double mass, int A, double T){
|
||||
double gamma = 1.0 + T*A/mass;
|
||||
return sqrt(1-1/gamma/gamma);
|
||||
}
|
||||
|
||||
double ev2nm(double eV){
|
||||
// photon energy to nm
|
||||
return hbarc/2/pi/eV;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
const double mp = kg2MeV(mp_SI);
|
||||
const double mn = kg2MeV(mn_SI);
|
||||
const double me = kg2MeV(me_SI);
|
||||
const double hbar = 197.326979;
|
||||
|
||||
//======================================================================
|
||||
|
||||
#endif
|
246
frecsoTools/extractData.py
Executable file
246
frecsoTools/extractData.py
Executable file
|
@ -0,0 +1,246 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
s = float(sys.argv[1])
|
||||
filename = sys.argv[2]
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print("Error: Not enough arguments provided.")
|
||||
print("Usage: ./{sys.argv[0]} spin filename")
|
||||
sys.exit(1)
|
||||
|
||||
#####################################################
|
||||
import numpy as np
|
||||
|
||||
|
||||
import re
|
||||
import numpy as np
|
||||
|
||||
def extract_s_matrix_data(filename):
|
||||
pattern = r"S-matrix\s+\d+\s*=\s*([\-\d\.]+)\s+([\-\d\.]+)\s+for\s+L=\s*(\d+),\s+J=\s*([\d\.]+)"
|
||||
|
||||
# List to store results
|
||||
results = []
|
||||
|
||||
# Variables to track the first and last "S-matrix" line
|
||||
start_line = None
|
||||
end_line = None
|
||||
|
||||
# Read the file and process line by line
|
||||
with open(filename, 'r') as file:
|
||||
lines = file.readlines()
|
||||
for i, line in enumerate(lines):
|
||||
if "S-matrix" in line:
|
||||
# Track the first and last occurrence of "S-matrix"
|
||||
if start_line is None:
|
||||
start_line = i
|
||||
end_line = i # Keep updating to the latest occurrence
|
||||
|
||||
# Extract S-matrix data if the line matches the pattern
|
||||
match = re.search(pattern, line)
|
||||
if match:
|
||||
real_part = float(match.group(1))
|
||||
imag_part = float(match.group(2))
|
||||
l_value = int(match.group(3))
|
||||
j_value = float(match.group(4))
|
||||
# Form a tuple and append to results
|
||||
results.append([real_part, imag_part, l_value, j_value])
|
||||
|
||||
print(f"First 'S-matrix' at line: {start_line + 1}")
|
||||
print(f"Last 'S-matrix' at line: {end_line + 1}")
|
||||
|
||||
return results
|
||||
|
||||
def remove_duplicates(data):
|
||||
# Sort data by L-value, then J-value
|
||||
data.sort(key=lambda x: (x[2], x[3])) # Sort by L (index 2), then J (index 3)
|
||||
|
||||
# Create a new list to store unique elements
|
||||
unique_data = []
|
||||
|
||||
# Iterate over the data to remove duplicates
|
||||
for i, item in enumerate(data):
|
||||
# Add the first item or if the current item is not equal to the last added
|
||||
if i == 0 or item != data[i - 1]:
|
||||
unique_data.append(item)
|
||||
|
||||
return unique_data
|
||||
|
||||
def group_data_by_s(data, s):
|
||||
# Initialize a dictionary for each group corresponding to J = L - s, ..., L + s
|
||||
groups = {J: [] for J in np.arange(-s, s+1, 1.0)} # Group indices from -s to s
|
||||
|
||||
|
||||
# Iterate over the data and assign to the appropriate groups
|
||||
for entry in data:
|
||||
real_part, imaginary_part, L, J = entry
|
||||
|
||||
# Check if J matches any value in the range L-s to L+s
|
||||
for offset in np.arange(-s, s+1, 1.0): # offset from -s to s, step 1
|
||||
if round(J, 1) == round(L + offset, 1):
|
||||
groups[offset].append(entry)
|
||||
|
||||
for key in groups:
|
||||
groups[key].sort(key=lambda x: x[2])
|
||||
|
||||
# Find the maximum L in each group
|
||||
max_L_in_groups = {key: max(entry[2] for entry in value) for key, value in groups.items()}
|
||||
|
||||
# Find the smallest maximum L across all groups
|
||||
smallest_max_L = min(max_L_in_groups.values())
|
||||
|
||||
return groups, smallest_max_L
|
||||
|
||||
|
||||
SMdata = extract_s_matrix_data(filename)
|
||||
SMdata = remove_duplicates(SMdata)
|
||||
|
||||
grouped_SMdata, smallest_max_L = group_data_by_s(SMdata, s)
|
||||
|
||||
#Mathematica input
|
||||
for i in range(smallest_max_L + 1):
|
||||
print("{", end='')
|
||||
|
||||
# Create a list to collect the formatted entries for each line
|
||||
line_entries = []
|
||||
|
||||
for j_value, entries in grouped_SMdata.items():
|
||||
for entry in entries:
|
||||
real_part, imaginary_part, L, J = entry
|
||||
if i == int(L):
|
||||
# Format each entry and append it to the list
|
||||
line_entries.append(f"{{{L:2d}, {J:4.1f}, {real_part:9.6f}+{imaginary_part:9.6f} I}}")
|
||||
|
||||
# Print the joined line without the trailing comma
|
||||
print(", ".join(line_entries), end='')
|
||||
|
||||
print("},")
|
||||
|
||||
# Define the function to extract Ruth ratio from the file
|
||||
def extract_angle_and_ratio(filename):
|
||||
angles = []
|
||||
ratios = []
|
||||
|
||||
with open(filename, 'r') as file:
|
||||
# Read all lines from the file
|
||||
lines = file.readlines()
|
||||
|
||||
# Find the start and end line numbers
|
||||
start_line = None
|
||||
end_line = None
|
||||
for i, line in enumerate(lines):
|
||||
if "CROSS SECTIONS FOR OUTGOING" in line:
|
||||
start_line = i + 1 # Start reading after this line
|
||||
elif "Finished all xsecs" in line:
|
||||
end_line = i
|
||||
break # Stop once the end line is found
|
||||
|
||||
# If start or end line not found, return empty lists
|
||||
if start_line is None or end_line is None:
|
||||
print("Start or end marker not found in the file.")
|
||||
return angles, ratios
|
||||
|
||||
# Iterate over the identified range
|
||||
for line in lines[start_line:end_line]:
|
||||
line = line.strip()
|
||||
|
||||
# Look for the lines containing "deg."
|
||||
if "deg.:" in line:
|
||||
# Extract the angle
|
||||
angle = float(line.split("deg.:")[0].strip())
|
||||
angles.append(angle)
|
||||
|
||||
# Look for the lines containing "/R ="
|
||||
elif "/R =" in line:
|
||||
# Extract the /R value
|
||||
ratio = float(line.split("/R =")[1].strip())
|
||||
ratios.append(ratio)
|
||||
|
||||
return angles, ratios
|
||||
|
||||
# Example usage
|
||||
angles, ratios = extract_angle_and_ratio(filename)
|
||||
|
||||
# Print or save the results
|
||||
print("### Differential cross section :")
|
||||
for angle, ratio in zip(angles, ratios):
|
||||
if angle % 5 == 0 :
|
||||
print(f"{angle:8.1f}, {ratio:8.4f}")
|
||||
print(f"{angles[-1]:8.1f}, {ratios[-1]:8.4f}")
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def plot_SM(groups):
|
||||
# Determine the number of groups
|
||||
num_groups = len(groups)
|
||||
|
||||
# Create subplots (rows, columns) based on number of groups
|
||||
fig, axes = plt.subplots(1, num_groups, figsize=(6 * num_groups,4))
|
||||
|
||||
# If there's only one group, axes will not be a list, so make it iterable
|
||||
if num_groups == 1:
|
||||
axes = [axes]
|
||||
|
||||
# Create a plot for each group
|
||||
for i, (offset, entries) in enumerate(groups.items()):
|
||||
|
||||
# Extract real and imaginary parts, and L values
|
||||
real_parts = [entry[0] for entry in entries]
|
||||
imaginary_parts = [entry[1] for entry in entries]
|
||||
L_values = [entry[2] for entry in entries]
|
||||
|
||||
# Plot real part vs L
|
||||
axes[i].plot(L_values, real_parts, label=f'Re', marker='o')
|
||||
|
||||
# Plot imaginary part vs L
|
||||
axes[i].plot(L_values, imaginary_parts, label=f'Im', marker='x')
|
||||
|
||||
# Adding labels and title
|
||||
axes[i].set_xlabel('L')
|
||||
axes[i].set_ylabel('Value')
|
||||
axes[i].set_title(f'Real and Imaginary Parts vs L for Group {offset:+.1f}')
|
||||
|
||||
# Add grid lines
|
||||
axes[i].set_xlim(-1, max(L_values)+1)
|
||||
axes[i].set_ylim(-1.1, 1.1)
|
||||
axes[i].set_xticks(np.arange(0, max(L_values)+3, 5)) # Set x-ticks from 0 to 20 with step 5
|
||||
axes[i].grid(True)
|
||||
|
||||
# Show the legend
|
||||
axes[i].legend()
|
||||
|
||||
# Adjust layout to prevent overlapping subplots
|
||||
plt.tight_layout()
|
||||
|
||||
return fig
|
||||
|
||||
def plot_Ruth(angles, ratios):
|
||||
# Plot the data
|
||||
fig = plt.figure(figsize=(8, 6))
|
||||
plt.plot(angles, ratios, linestyle='-', color='b', label='/R values')
|
||||
plt.xscale('linear') # Linear scale for angles
|
||||
plt.yscale('log') # Logarithmic scale for /R values
|
||||
|
||||
# Add labels, title, and legend
|
||||
plt.xlabel('CM Angle (degrees)', fontsize=12)
|
||||
plt.ylabel('d.c.s/Ruth', fontsize=12)
|
||||
plt.legend(fontsize=10)
|
||||
plt.grid(which='both', linestyle='--', linewidth=0.5)
|
||||
|
||||
plt.xlim(-5, 185)
|
||||
plt.xticks(np.arange(0, 181, 20))
|
||||
|
||||
# Show the plot
|
||||
plt.tight_layout()
|
||||
|
||||
return fig
|
||||
|
||||
|
||||
fig1 = plot_SM(grouped_SMdata)
|
||||
|
||||
fig2 = plot_Ruth(angles, ratios)
|
||||
|
||||
plt.show(block=False)
|
||||
|
||||
input("Press Enter to exit.")
|
298
frecsoTools/inFileCreator.cpp
Normal file
298
frecsoTools/inFileCreator.cpp
Normal file
|
@ -0,0 +1,298 @@
|
|||
#include <fstream>
|
||||
#include <stdlib.h> /* atof */
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdlib.h> /* atof */
|
||||
#include "ClassIsotope.h" // for geting Z
|
||||
#include "potentials.h"
|
||||
|
||||
#define RED "\033[31m"
|
||||
#define GREEN "\033[32m"
|
||||
#define BLUE "\033[34m"
|
||||
#define RESET "\033[0m"
|
||||
|
||||
int GetLValue(std::string spdf){
|
||||
|
||||
if( spdf == "s" ) return 0;
|
||||
if( spdf == "p" ) return 1;
|
||||
if( spdf == "d" ) return 2;
|
||||
if( spdf == "f" ) return 3;
|
||||
if( spdf == "g" ) return 4;
|
||||
if( spdf == "h" ) return 5;
|
||||
if( spdf == "i" ) return 6;
|
||||
if( spdf == "j" ) return 7;
|
||||
return -1;
|
||||
}
|
||||
|
||||
FILE * file_out = nullptr;
|
||||
|
||||
std::vector<std::string> SplitStr(std::string tempLine, std::string splitter, int shift = 0){
|
||||
|
||||
std::vector<std::string> output;
|
||||
|
||||
size_t pos;
|
||||
do{
|
||||
pos = tempLine.find(splitter); /// fine splitter
|
||||
if( pos == 0 ){ ///check if it is splitter again
|
||||
tempLine = tempLine.substr(pos+1);
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string secStr;
|
||||
if( pos == std::string::npos ){
|
||||
secStr = tempLine;
|
||||
}else{
|
||||
secStr = tempLine.substr(0, pos+shift);
|
||||
tempLine = tempLine.substr(pos+shift);
|
||||
}
|
||||
|
||||
///check if secStr is begin with space
|
||||
while( secStr.substr(0, 1) == " ") secStr = secStr.substr(1);
|
||||
|
||||
///check if secStr is end with space
|
||||
while( secStr.back() == ' ') secStr = secStr.substr(0, secStr.size()-1);
|
||||
|
||||
output.push_back(secStr);
|
||||
///printf(" |%s---\n", secStr.c_str());
|
||||
|
||||
}while(pos != std::string::npos );
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
std::vector<std::string> Breakdown_AabB( std::string reactStr ){
|
||||
|
||||
std::vector<std::string> str1 = SplitStr(reactStr, "(", 0);
|
||||
std::vector<std::string> str2 = SplitStr(str1[1], ")", 1);
|
||||
std::vector<std::string> str3 = SplitStr(str2[0], ",", 0);
|
||||
|
||||
std::vector<std::string> output;
|
||||
output.push_back ( str1[0] );
|
||||
output.push_back ( str3[0] );
|
||||
str3[1].pop_back();
|
||||
output.push_back ( str3[1] );
|
||||
output.push_back ( str2[1] );
|
||||
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
float GetTotalEnergy( std::string ELabStr, float beamA ){
|
||||
//get Beam energy, distingusih MeV or MeV/u
|
||||
int pos = ELabStr.length() - 1;
|
||||
for( int i = pos; i >= 0 ; i--){
|
||||
if( isdigit(ELabStr[i]) ) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::string unit = ELabStr.substr(pos+1);
|
||||
int factor = 1;
|
||||
if( unit == "MeV/u") factor = beamA;
|
||||
return atof(ELabStr.substr(0, pos+1).c_str()) * factor;
|
||||
}
|
||||
|
||||
int InFileCreator(std::string readFile, std::string infile, double angMin, double angMax, double angStep) {
|
||||
|
||||
//================= read infile. extract the reactions, write pptolemy infile for each reaction
|
||||
std::ifstream file_in;
|
||||
file_in.open(readFile.c_str(), std::ios::in);
|
||||
|
||||
if( !file_in ){
|
||||
printf(" cannot read file. \n");
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
printf("Save to infile : %s \n", infile.c_str());
|
||||
file_out = fopen (infile.c_str(), "w+");
|
||||
|
||||
printf("Angle setting (%5.2f, %5.2f) deg | Step : %5.2f deg\n", angMin, angMax, angStep);
|
||||
printf("---------------------------\n");
|
||||
|
||||
//^============================== extract reaction line by line
|
||||
int numOfReaction = 0;
|
||||
while( file_in.good() ) {
|
||||
std::string tempLine;
|
||||
std::getline(file_in, tempLine );
|
||||
|
||||
if( tempLine.substr(0, 1) == "#" ) continue;
|
||||
if( tempLine.size() < 5 ) continue;
|
||||
|
||||
//split line using space
|
||||
std::vector<std::string> strList = SplitStr(tempLine, " ");
|
||||
if ( strList.size() == 0 ) continue;
|
||||
|
||||
printf(" %s\n", tempLine.c_str());
|
||||
|
||||
std::vector<std::string> AabB = Breakdown_AabB( strList[0] );
|
||||
|
||||
if( AabB.size() != 4 ) {
|
||||
printf(" %sUnable to do 3-body reactions.%s\n", RED, RESET);
|
||||
continue;
|
||||
}
|
||||
|
||||
Isotope iso_A(AabB[0]);
|
||||
Isotope iso_a(AabB[1]);
|
||||
Isotope iso_b(AabB[2]);
|
||||
Isotope iso_B(AabB[3]);
|
||||
|
||||
float spin_A = atof(strList[1].c_str());
|
||||
|
||||
short twoSpin = 0, parity = 0;
|
||||
if( strList[3] != "none"){ /// extrac spin and parity
|
||||
std::string Jpi = strList[3];
|
||||
std::string::size_type lastDigit = Jpi.find_last_of("0123456789");
|
||||
std::string spinStr = Jpi.substr(0, lastDigit + 1);
|
||||
std::string::size_type lastSlash = spinStr.find_last_of('/');
|
||||
if (lastSlash != std::string::npos) {
|
||||
twoSpin = std::stoi(spinStr.substr(0, lastSlash + 1));
|
||||
} else {
|
||||
twoSpin = 2 * std::stoi(spinStr);
|
||||
}
|
||||
parity = (Jpi.substr(lastDigit + 1) == "+") ? 1 : -1;
|
||||
}
|
||||
|
||||
|
||||
float Ex = atof(strList[4].c_str());
|
||||
float totalEnergy = GetTotalEnergy(strList[5], iso_a.A );
|
||||
|
||||
float extra = 0;
|
||||
if( strList.size() == 8 ){
|
||||
extra = atof( strList[7].c_str() );
|
||||
}
|
||||
|
||||
// printf(" Ex : %.2f, totalEnergy : %.2f \n", Ex, totalEnergy);
|
||||
|
||||
fprintf(file_out, "##############################################\n");
|
||||
|
||||
//^===================================== elastics + inelastics
|
||||
if( iso_a.Mass == iso_b.Mass ) {
|
||||
|
||||
if( Ex == 0.0 ){
|
||||
|
||||
printf("=========== elatsic \n");
|
||||
|
||||
fprintf(file_out, "%s@%.2f MeV/u Elastic\n" , strList[0].c_str(), totalEnergy/iso_a.A );
|
||||
fprintf(file_out, "NAMELIST\n");
|
||||
|
||||
fprintf(file_out, "&FRESCO hcm=0.1 rmatch=60 \n");
|
||||
fprintf(file_out, " jtmin=0.0 jtmax=50 absend=0.001 \n");
|
||||
fprintf(file_out, " thmin=%.1f thmax=%.1f thinc=%.1f \n", angMin, angMax, angStep);
|
||||
fprintf(file_out, " chans=1 smats=2 xstabl=1 \n");
|
||||
fprintf(file_out, " elab=%.1f /\n", totalEnergy);
|
||||
|
||||
fprintf(file_out, "&PARTITION namep='%s' massp=%.2f zp=%d namet='%s' masst=%.2f zt=%d qval=0.000 nex=1 /\n", iso_a.Name.c_str(), iso_a.Mass/amu, iso_a.Z, iso_A.Name.c_str(), iso_A.Mass/amu, iso_A.Z);
|
||||
|
||||
fprintf(file_out, "&STATES jp=%.1f ptyp=%d ep=0.000 jt=%.1f ptyt=%d et=0.000 cpot=1 /\n", iso_a.twoSpin/2., iso_a.parity, spin_A, iso_A.parity);
|
||||
|
||||
fprintf(file_out, "&partition /\n");
|
||||
|
||||
fprintf(file_out, "&POT kp=1 ap=%d at=%d rc=1.2 /\n", iso_a.A, iso_A.A); // Coulomb
|
||||
fprintf(file_out, "&POT kp=1 type=1 p1=40.00 p2=1.2 p3=0.65 p4=10.0 p5=1.2 p6=0.500 /\n"); // Woods-Saxon (V0, r0, a0, Wi, ri, ai)
|
||||
|
||||
fprintf(file_out, "&pot /\n");
|
||||
|
||||
fprintf(file_out, "&overlap /\n");
|
||||
fprintf(file_out, "&coupling /\n");
|
||||
|
||||
}else{
|
||||
|
||||
printf("=========== inelatsic \n");
|
||||
|
||||
fprintf(file_out, "%s@%.2f MeV/u Inelastic\n" , strList[0].c_str(), totalEnergy/iso_a.A );
|
||||
fprintf(file_out, "NAMELIST\n");
|
||||
|
||||
fprintf(file_out, "&FRESCO hcm=0.1 rmatch=60 \n");
|
||||
fprintf(file_out, " jtmin=0.0 jtmax=50 absend=0.001 \n");
|
||||
fprintf(file_out, " thmin=%.1f thmax=%.1f thinc=%.1f \n", angMin, angMax, angStep);
|
||||
fprintf(file_out, " chans=1 smats=2 xstabl=1 \n");
|
||||
fprintf(file_out, " elab=%.1f /\n", totalEnergy);
|
||||
|
||||
fprintf(file_out, "&PARTITION namep='%s' massp=%.2f zp=%d namet='%s' masst=%.2f zt=%d qval=0.000 nex=2 /\n", iso_a.Name.c_str(), iso_a.Mass/amu, iso_a.Z, iso_A.Name.c_str(), iso_A.Mass/amu, iso_A.Z);
|
||||
|
||||
fprintf(file_out, "&STATES jp=%.1f ptyp=%d ep=0.000 jt=%.1f ptyt=%d et=0.000 cpot=1 /\n", iso_a.twoSpin/2., iso_a.parity, spin_A, iso_A.parity);
|
||||
fprintf(file_out, "&STATES jp=%.1f ptyp=%d ep=0.000 jt=%.1f ptyt=%d et=%.3f cpot=1 /\n", iso_a.twoSpin/2., iso_a.parity, twoSpin/2., parity, Ex);
|
||||
|
||||
fprintf(file_out, "&partition /\n");
|
||||
|
||||
fprintf(file_out, "&POT kp=1 ap=%d at=%d rc=1.2 /\n", iso_a.A, iso_A.A); // Coulomb
|
||||
fprintf(file_out, "&POT kp=1 type=1 p1=40.00 p2=1.2 p3=0.65 p4=10.0 p5=1.2 p6=0.500 /\n"); // volume, Woods-Saxon (V0, r0, a0, Wi, ri, ai)
|
||||
fprintf(file_out, "&POT kp=1 type=11 p1= 0.00 p2=%.2f/\n", extra); // target deformation add to the volume, deformation length delta_2 = 1.3 fm
|
||||
fprintf(file_out, "&POT kp=1 type=2 p1= 0.00 p2=1.2 p3=0.65 p4=6.0 p5=1.2 p6=0.500 /\n"); // surface, d(Woods-Saxon)/dr (V0, r0, a0, Wi, ri, ai)
|
||||
fprintf(file_out, "&POT kp=1 type=11 p1= 0.00 p2=%.2f/\n", extra); // target deformation add to the suface
|
||||
|
||||
fprintf(file_out, "&pot /\n");
|
||||
|
||||
fprintf(file_out, "&overlap /\n");
|
||||
fprintf(file_out, "&coupling /\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//^====================================== single neutron transfer
|
||||
if( abs( iso_a.A - iso_b.A ) == 1 ){
|
||||
|
||||
printf("=========== single nucleon transfer \n");
|
||||
|
||||
fprintf(file_out, "%s@%.2f MeV/u Inelastic\n" , strList[0].c_str(), totalEnergy/iso_a.A );
|
||||
fprintf(file_out, "NAMELIST\n");
|
||||
|
||||
fprintf(file_out, "&FRESCO hcm=0.1 rmatch=60 \n");
|
||||
fprintf(file_out, " rintp=0.2 hnl=0.1 rnl=5.00 centre=0.0 \n");
|
||||
fprintf(file_out, " iter=1 nnu=36 \n");
|
||||
fprintf(file_out, " jtmin=0.0 jtmax=50 absend=0.001 \n");
|
||||
fprintf(file_out, " thmin=%.1f thmax=%.1f thinc=%.1f \n", angMin, angMax, angStep);
|
||||
fprintf(file_out, " chans=1 smats=2 xstabl=1 \n");
|
||||
fprintf(file_out, " elab=%.1f /\n", totalEnergy);
|
||||
|
||||
fprintf(file_out, "&PARTITION namep='%s' massp=%.2f zp=%d namet='%s' masst=%.2f zt=%d qval=0.000 nex=1 /\n", iso_a.Name.c_str(), iso_a.Mass/amu, iso_a.Z, iso_A.Name.c_str(), iso_A.Mass/amu, iso_A.Z);
|
||||
fprintf(file_out, "&STATES jp=%.1f ptyp=%d ep=0.000 jt=%.1f ptyt=%d et=0.000 cpot=1 /\n", iso_a.twoSpin/2., iso_a.parity, spin_A, iso_A.parity);
|
||||
|
||||
float QValue = iso_a.Mass + iso_A.Mass - iso_b.Mass - iso_B.Mass - Ex;
|
||||
fprintf(file_out, "&PARTITION namep='%s' massp=%.2f zp=%d namet='%s' masst=%.2f zt=%d qval=%.3f nex=1 /\n", iso_b.Name.c_str(), iso_b.Mass/amu, iso_b.Z, iso_B.Name.c_str(), iso_B.Mass/amu, iso_B.Z, QValue);
|
||||
fprintf(file_out, "&STATES jp=%.1f ptyp=%d ep=0.000 jt=%.1f ptyt=%d et=%.2f cpot=1 /\n", iso_b.twoSpin/2., iso_b.parity, twoSpin/2., parity, Ex);
|
||||
|
||||
fprintf(file_out, "&partition /\n");
|
||||
|
||||
//*================ a + A
|
||||
fprintf(file_out, "&POT kp=1 ap=%d at=%d rc=1.2 /\n", iso_a.A, iso_A.A); // Coulomb
|
||||
fprintf(file_out, "&POT kp=1 type=1 p1=40.00 p2=1.2 p3=0.65 p4=10.0 p5=1.2 p6=0.500 /\n"); // volume, Woods-Saxon (V0, r0, a0, Wi, ri, ai)
|
||||
|
||||
//*================ b + B
|
||||
fprintf(file_out, "&POT kp=2 ap=%d at=%d rc=1.2 /\n", iso_b.A, iso_B.A); // Coulomb
|
||||
fprintf(file_out, "&POT kp=2 type=1 p1=40.00 p2=1.2 p3=0.65 p4=10.0 p5=1.2 p6=0.500 /\n"); // volume, Woods-Saxon (V0, r0, a0, Wi, ri, ai)
|
||||
|
||||
//*================ a
|
||||
fprintf(file_out, "&POT kp=3 at=%d rc=1.2 /\n", iso_a.A); // Coulomb
|
||||
fprintf(file_out, "&POT kp=3 type=1 p1=50.00 p2=1.2 p3=0.65 /\n"); // volume, Woods-Saxon (V0, r0, a0)
|
||||
fprintf(file_out, "&POT kp=3 type=3 p1= 6.00 p2=1.2 p3=0.65 /\n"); // S-O, projectile (V0, r0, a0)
|
||||
|
||||
//*================ a - N
|
||||
|
||||
//*================ A + (a-N)
|
||||
|
||||
|
||||
fprintf(file_out, "&pot /\n");
|
||||
|
||||
fprintf(file_out, "&overlap /\n");
|
||||
fprintf(file_out, "&coupling /\n");
|
||||
|
||||
}
|
||||
|
||||
//^====================================== two neutron transfer
|
||||
if( abs( iso_a.A - iso_b.A ) == 2 ){
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fprintf(file_out, "#>>>>>############################################# End of File\n");
|
||||
|
||||
file_in.close();
|
||||
fclose(file_out);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
15
frecsoTools/makefile
Normal file
15
frecsoTools/makefile
Normal file
|
@ -0,0 +1,15 @@
|
|||
CC = g++
|
||||
CFLAG = -g -O0
|
||||
|
||||
depend = ClassIsotope.h constant.h potentials.h
|
||||
|
||||
ALL = test
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
test: inFileCreator.cpp $(depend)
|
||||
$(CC) $(CFLAG) test.cpp -o test
|
||||
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(ALL)
|
3594
frecsoTools/mass20.txt
Normal file
3594
frecsoTools/mass20.txt
Normal file
File diff suppressed because it is too large
Load Diff
5868
frecsoTools/nubase_4.mas20.txt
Normal file
5868
frecsoTools/nubase_4.mas20.txt
Normal file
File diff suppressed because it is too large
Load Diff
1073
frecsoTools/potentials.h
Normal file
1073
frecsoTools/potentials.h
Normal file
File diff suppressed because it is too large
Load Diff
8
frecsoTools/script.cpp
Normal file
8
frecsoTools/script.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "ClassIsotope.h"
|
||||
|
||||
void script(){
|
||||
|
||||
Isotope haha("10B");
|
||||
haha.Print();
|
||||
|
||||
}
|
9
frecsoTools/test.cpp
Normal file
9
frecsoTools/test.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "inFileCreator.cpp"
|
||||
|
||||
int main(){
|
||||
|
||||
InFileCreator("FRESCO", "haha.in", 0, 180, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user