c60 = loadStructure('c60.stru') dpc = DebyePDFCalculator() dpc.qmax = 20 dpc.rmax = 20 r3, g3 = dpc(c60, qmin=0) r4, g4 = dpc(c60, qmin=1)
时间: 2024-04-04 20:34:26 浏览: 107
这是一段Python代码,它加载了一个c60.stru结构文件,并使用DebyePDFCalculator计算了c60结构的散射函数(g3和g4)。其中,dpc.qmax和dpc.rmax分别设置了最大的q值和r值。在第四行和第六行中,可以看到dpc被调用两次,分别计算了qmin为0和1时的散射函数。
相关问题
以下程序段用于构成一个简单的单向链表,请填空。 struct STRU { int x,y; float rate; p; }a,b; a.x=0;a.y=0;a.rate=0;a.p=&b; b.x=0;b.y=0;b.rate=0;b.p=NULL;
完整代码如下:
```
#include <stdio.h>
struct STRU {
int x, y;
float rate;
struct STRU *p;
};
int main() {
struct STRU a, b;
a.x = 0;
a.y = 0;
a.rate = 0;
a.p = &b;
b.x = 0;
b.y = 0;
b.rate = 0;
b.p = NULL;
printf("a: x=%d, y=%d, rate=%f, p=%p\n", a.x, a.y, a.rate, a.p);
printf("b: x=%d, y=%d, rate=%f, p=%p\n", b.x, b.y, b.rate, b.p);
return 0;
}
```
其中,结构体 `STRU` 包含三个成员变量:`x`、`y`、`rate`,以及一个指向另一个 `STRU` 结构体的指针 `p`,用于构成单向链表。在 `main` 函数中,先定义了两个 `STRU` 类型的变量 `a` 和 `b`。然后,对变量 `a` 进行初始化,其中 `a.x`、`a.y`、`a.rate` 分别赋值为 `0`,`a.p` 指向变量 `b`。变量 `b` 同样进行了初始化,其中 `b.x`、`b.y`、`b.rate` 分别赋值为 `0`,`b.p` 赋值为 `NULL`。最后,打印出变量 `a` 和 `b` 的成员变量的值。
Oracle 下SQL语句怎么写 SELECT @ROWNUM := @ROWNUM + 1 AS TEMPRANK, @INCRNUM := CASE WHEN @ROWTOTAL = OBJ.YLCOUNT + 1 THEN @INCRNUM WHEN @ROWTOTAL := OBJ.YLCOUNT + 1 THEN @ROWNUM END AS FILERANK, OBJ.* FROM ( SELECT DOCINFO.TITLE, DOCINFO.DOC_ID AS DOCID, DOCINFO.DOC_TYPE AS DOCTYPE, U.USER_NAME AS AUTHORNAME, CONCAT( U.USER_NAME, '/', CASE WHEN O.SHORT_NAME = '' THEN '无' ELSE O.SHORT_NAME END ) AS USERNAME, IFNULL( DOCINFO.DOWNLOAD_NUM, 0 ) AS YLCOUNT FROM DOC_INFO DOCINFO, SYS_USERS U, SYS_ORGAN O, sys_stru WHERE DOCINFO.VALID_FLAG = '1' AND IFNULL( DOCINFO.DOWNLOAD_NUM, 0 ) != 0 AND U.USER_ID = DOCINFO.AUTHOR_ID AND sys_stru.STRU_ID = U.DEPARTMENT_ID AND O.ORGAN_ID = sys_stru.ORGAN_ID GROUP BY DOCINFO.DOC_ID, U.USER_NAME ORDER BY DOCINFO.DOWNLOAD_NUM DESC, DOCINFO.TITLE DESC ) OBJ, ( SELECT @ROWNUM := 0, @ROWTOTAL := NULL, @INCRNUM := 0 ) R
在 Oracle 中,可以将该 SQL 语句写成如下形式:
```
SELECT TEMPRANK, FILERANK, TITLE, DOCID, DOCTYPE, AUTHORNAME, USERNAME, YLCOUNT
FROM (
SELECT DOCINFO.TITLE, DOCINFO.DOC_ID AS DOCID, DOCINFO.DOC_TYPE AS DOCTYPE,
U.USER_NAME AS AUTHORNAME, CONCAT(U.USER_NAME, '/', CASE WHEN O.SHORT_NAME = '' THEN '无' ELSE O.SHORT_NAME END) AS USERNAME,
IFNULL(DOCINFO.DOWNLOAD_NUM, 0) AS YLCOUNT,
@ROWNUM := @ROWNUM + 1 AS TEMPRANK,
@INCRNUM := CASE
WHEN @ROWTOTAL = OBJ.YLCOUNT + 1 THEN @INCRNUM
WHEN @ROWTOTAL := OBJ.YLCOUNT + 1 THEN @ROWNUM
END AS FILERANK
FROM DOC_INFO DOCINFO, SYS_USERS U, SYS_ORGAN O, sys_stru
WHERE DOCINFO.VALID_FLAG = '1'
AND IFNULL(DOCINFO.DOWNLOAD_NUM, 0) != 0
AND U.USER_ID = DOCINFO.AUTHOR_ID
AND sys_stru.STRU_ID = U.DEPARTMENT_ID
AND O.ORGAN_ID = sys_stru.ORGAN_ID
GROUP BY DOCINFO.DOC_ID, U.USER_NAME
ORDER BY DOCINFO.DOWNLOAD_NUM DESC, DOCINFO.TITLE DESC
) OBJ, (SELECT @ROWNUM := 0, @ROWTOTAL := NULL, @INCRNUM := 0) R;
```
在 Oracle 中,变量需要在 SQL 语句外面进行声明和初始化。这里使用了 `@ROWNUM`、`@ROWTOTAL` 和 `@INCRNUM` 三个变量,它们都在 SQL 语句的最后一行进行了声明和初始化。
此外,由于 Oracle 对于 SQL 语句的执行顺序与 MySQL 略有不同,因此需要将临时变量的计算放在子查询中,并使用外层查询来获取这些变量的值。最终的结果集是从子查询中返回的。
阅读全文